Functional Block

Paradigm1999

Member
Join Date
Sep 2011
Location
Asia
Posts
10
Hi, I am writing a function block to process some boolean algebra and the result with be processed. I am using a Omron CX programmer and under the function block, I can only choose the output as UINT (unsigned integer) and cannot choose Hex. My functional block result will be the SV of my timer TIM. However, when i transfer the value from the functional block in UINT to the SV of TIM, it convert the int to hexidecimal value which become incorrect for the timer SV.

e.g. The functional block result is 50 and when transferring to the TIM, the SV become #32 and therefore become wrong timing.

My question will be. Is there a way to transfer the 50 UNIT and become #50 for my timer function instead of letting the CX programmer converting from Int to Hex?

Or is there a formula to convert int = 50 to 80 (50H) and so on. So i can write another function block to covert any int to it hex. Thanks a lot
 
Your computer speaks binary. People speak base 10 decimal and Hex.

50 decimal = 0000 0000 0011 0010 in binary.
32 hex = 50 decimal = 0000 0000 0011 0010 in binary.

Decimal and Hex look different to a Human but as you can see above they are exactly the same to a computer. Hex is a human format that helps make working with binary a little easier. The programming software can be configured to display values using a base 10 or a base 16 format.


I suspect that where you are getting confused is on BCD verses decimal. BCD is a format that looks to us Humans like both base 10 numbers and like hex for numbers when the equivalent base 10 digit is less than ten. However to a computer a BCD looks very different, and it has to be converted.

I believe that the Omron function block to convert BCD to binary is BIN.

I hope that helps.
 
Paradigm1999,

TIM instruction uses the SV as a BCD value. In CS1/CJ1/CP1 series PLCs, you can set the PLC to use binary SV for timers / counters instead of BCD. This is available through "PLC Properties" dialog after right-clicking the PLC icon in project explorer. If you use this option, you have to use the TIMX, TIMHX etc. instructions instead of TIM and TIMH. Then you can use your FB result in UINT form directly as SV. If you are using CJ2 series then you don't have the setting but you can use TIMX instruction instead of TIM directly.

If you don't want to use this option then you have to use BCD instruction to convert the result before using in TIM instruction.

SVN
 
Last edited:

Similar Topics

Dear Experts!!! Could you please provide me the sample of "QD75MS Module & MR-J3-B program with functional block" As you can see the page...
Replies
0
Views
2,546
I need to call a IO LINK functional block multiple times by triggereing the REQ bit. But every call I want to pass different parameters like...
Replies
15
Views
8,677
For RSLogix 5000, Which software do we need to install in order to work with Functional Block Diagram and with Structured Text ? Currently I can...
Replies
6
Views
4,583
I am somewhat new and very much still learning the trade. I have a written a functional block diagram where I use the same output reference twice...
Replies
2
Views
2,210
Hi all, I was wondering if anyone had any good methods for developing functional spec / test sheets for equipment interlocks. I find the best...
Replies
3
Views
1,348
Back
Top Bottom