LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Storing 32-bit numbers in plc registers.

I am using Labview 7.1 and DSC/OPC to communicate to an Allen Bradley SLC 5/05 over Ethernet. In my application, I desire to write and read part numbers ranging from 0-99999999 to/from the N registers of the PLC. Now since the N (Integer) registers of the 5/05 can't store a value of 99999999 I attempted to use the split function and store the value into (2) seperate N registers. Then I could take those two registers and use the join function to re-establish the value when reading. What happens is, I will write one value and read something back totally different. If the lower word is greater then 32767 when split, I have bad results.
0 Kudos
Message 1 of 5
(2,892 Views)
 
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 5
(2,872 Views)
 
Chilly Charly    (aka CC)
0 Kudos
Message 3 of 5
(2,872 Views)
Sorry for the blank posts, just an accident !
Now I feel obliged to give some answer...
Display the results in Hexadecimal format and see if your problem is not due to byte inversion.

CC
Chilly Charly    (aka CC)
0 Kudos
Message 4 of 5
(2,871 Views)
"IF the lower word is greater then 32767 when split, I have bad results"

You don't say what OPC you're using, but if it's one of the Industrial Automation/Lookout drivers for AB that came with LVDSC, here's a guess what the problem is:

With a 32bit input, the split function results in two U16 values. A quick check of the IA/Lookout documentation for the AB drivers shows that N registers data members are configured to accept 16 bit _signed_ integers (-32768 to 32767). When you try to write 0x8000 as 32768 to your lo word tag/register, DSC/OPC just coughs.

Suggested possible solution:
Typecast the lo word U16 from your split to I16 and write that value to the tag/register.

If you're using another OPC driver, the problem is probably something similar.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 5 of 5
(2,855 Views)