Skip to main content

6.22. TOD(Convert to BCD) Convert to BCD

6.22. TOD(Convert to BCD):Convert to BCD

 

Symbol

Relay combination

Factor

src: Source relay (or Number)

dst: Destination relay

Description

If Rung is activated, convert the value of src to BCD and save it to dst.

This command is convenient when using a device that indicates value on 7’ Segment with BCD type.

If dst is byte(B) type, it will convert into 2 digits and if dst is word(W) type, it will convert into 4 digits.

If the value of Src is greater than the converting digits, set SP7=1.

Usage example

TOD(XB3,RB2): Convert the value of XB3 to BCD and save it to RB2.

(Reference, BCD(Binary Coded Decimal) refers to the number that can have a value of 0~9 range with 4bit code value. For BCD, A~F that can be represented with 4 bit (among 0~F) is not used.

If (XB3)=&H7B(123), save &H23(34) into RB2, and set SP7=1 as &H7B(123)>&H63(99).