FReD kicked TODd in the knee.

BDKuhns

Member
Join Date
Sep 2003
Location
KC, MO
Posts
78
Not really, but I have some other question about logic
instructions which almost gives me epistaxis.

A while back, we learned about the FRD and the TOD
instruction. I think I understand these (at least
enough to have completed the project). Both are used
to either convert the bit data of an element (16 bit word)
to either from BCD to HEX, or from Hex to BCD.

What happens if there is an 8 bit, 32 bit,
64 bit, or even higher word length?


Also, the time spent on explaining any of the instruction
sets in class (as I can understand), just doesn’t quite
complete the absorption process for me. It seems the one
thing that is lacking, is the application references other
than just one project. I’m not in a position of being
exposed to a great deal of examples (which I hope will
soon change), so I still feel little out in the cold.

Other than converting data from or to I/O’s
like thumbwheels or digital displays,
what other uses can these instructions be
used for?


Anyway…..I need to check out a disturbance on another
page in the book, I wander who it is this time? :mad:
 
Last edited:
BDKuhns said:

Other than converting data from or to I/O’s
like thumbwheels or digital displays,
what other uses can these instructions be
used for?

They come in pretty handy when messaging between the PLC-5's native integer format and the PLC-2's native BCD format.
 
Never thought about that one!

We are using the SLC-500 and the PLC-5 PLC's. That would
come in handy to communicate between the two!
 
BDKuhns said:
Never thought about that one!

We are using the SLC-500 and the PLC-5 PLC's. That would
come in handy to communicate between the two!

Both of them nativly support integer and a bunch of other data formats, so BCD really wouldn't help to communicate between the two of them.
 
Actually BCD has nothing to do with hex, it converts binary to/from integers.

Binary Coded Decimal is simply a way to send a decimal number from 0-9 as Ones and Zeros. The reason you need to convert it is because your thumbwheels and displays are using each set of four bits to hold values, but the 16 bit word is seen as one number, not 4 separate ones. So it basically splits the 16 bit word into 4 sets of 4.

So if your thumbwheel reads: 7436

Your word shows as 0111010000110110

The plc sees this as 29750, and the bcd makes sure it converts it to

0111 0100 0011 0110 and knows that each group of 4 is a different integer, 7436.
 
Actually there is another obscure use for the FRD/TOD pair that I stumbled across recently.

Say for example you want to extract from a decimal number, for example: 23.53, the two parts of the number into 2300 and 53.

(In this case I was entering time of day data via a PanelView )

Like all programming there must be more than one way to skin cat, but this is the scheme I came up with late one night:

1. Convert the Decimal source value to BCD using the FRD.

2. Now the BCD result of 2353 in binary above will be:

0010 0011 0101 0011

3. Put this through a MVM of:

1111 1111 0000 0000 ( or FF00h)

4. The result now is:

0010 0011 0000 0000

5. Put this through a TOD to convert back to decimal and the result is 2300.

6. The rest of the job to extract the 53 is trivial, just subtract 2353 from 2300.

Using BCD like this is a handy trick to extract the exact digits you want from any decimal number.
 

Similar Topics

Anyone seen our friend Fred lately? I'm unable to access the IRC chatroom he set up months back, was kinda fun to pop in there once in a while...
Replies
3
Views
2,154
I was trying to look at a SLC500 processor today. I went through RSLinx and configured my drivers successfully, then opened RSLogix, selected Go...
Replies
14
Views
3,314
We're running Logix 500 V8.4 on XPSP2 and have started to experience slow down saving the program, now minutes to download an average length...
Replies
4
Views
1,983
Back
Top Bottom