word to bit or bits by themselves.. to excel???

Altair

Member
Join Date
Feb 2003
Posts
28
Which format would be easier for other techs to decipher and also be portable?
Taking an integer and breaking it down to it's binary equivalent or just reading the individual bits themselves.
The application. 4 words with a total of 53 significant bits (each of the 53 bits represent a fault) are set up in the AB 5-20. I have linx gateway. The goal is to record the faults when the occur onto an excel spreadsheet. But I'm not sure if looking at each individual bit or the integer value would be easier for other techs to decipher.
with the integer values I would look at each word. If it is >0 then I'll need to break the word down to it's bits and see which ones are high. Each high bit is significant. Tied to this could be a count-up so that an array can be generated to hold all of the fault bit values (as each bit will have a value attached to it that will be placed on the excel sheet). I can think of at least 3 arrays needed: 1 for every bit, 1 for the value attached to the bit (subscripts would keep them in line) and a third for the number of values needed to be placed on the sheet (possibly a listcount command would work better instead and remove some of the nesting).
The alternative is to read each and every bit. While that seems simple enough, it just doesn't sound logical. There are 53 faults at this site, but some sites have 2x as much. The same format I'll be using on this unit will be replicated at other sites. So a generic routine that would work at all the sites seems to be the best way to go.
What do you guys think? Any tips/suggestions would be greatly appreciated.




Regards,
Russ
 
Hmm. I'm not sure about the storage part, but if you were just looking for a live display of all 53 bits, I'd address them individually.

Since they're packed into Words together, RSLinx will automatically optimize the Read command and just read four Words in one message instead of reading 53 Bits in 53 individual messages.

I'm sure there are some Excel gurus around who can tell you more about storing data away periodically.
 
VBA

Transfer the data using DDE it's much simpler than OPC. If you use OPC
you can address individual bits but if in fact you have what it takes
to implement OPC the issue of individual bits would be a minor one.
If you use DDE to get data to the Excel spreadsheet, transfer it as
consecutive integers. Use VBA to obtain individual bits,
AND integer data with 1,2,4,8,16,32, ....32768.
 
Consider this approch:
use XOR to detect changes to faults, A is the faults, B is all zero at 1st, if dest is greater than zero, a change has occured to one or more of the 16 Bits of that word. Only then will the following logic need to be performed.

Use a count down counter to create a FOR/NEXT LOOP of sixteen cycles
during each loop perform a BSL siultaniously to the A word Bits and the Dest Word Bits. when Dest Bit is Set (1)
Use an XIC of A words Bit (The fault state )to enable sending notification of fault using ACC value which will match that fault number for that BIT.
Use an XIO to enable notification when fault has CLEARED.

After the loop is done, move the A fault word with its new bit state,
to the ADDRESS of the XOR's B word. This controlls that only one notification will be sent. The B word is Holding 1's for current faults. if that fault clears, the Dest Word will Trigger the Loop so you can send the proper notification

*****Notice***********
create all the BSL pairs needed by the size of the Fault Array, one pair for each Fault word. then simply ADD 16 to the ACC Value for the 2nd words bit value, 32 to the 3rd, 48 to the 4th, etc...

Also, remember to Create XOR for each too.

I believe this is Generic Soution to your problem. :cool:
 

Similar Topics

Hi. I'm struggling over some basic stuff here. 41001 I is a 16 bits integer that I'm able to read with InTouch. What I need to do is to read...
Replies
1
Views
90
Hello How to convert dword to bit in Siemens plc s7؟ Thank you
Replies
15
Views
2,762
All, Forgive my lack of attention to detail, today a student asked me why when he printed his ladder in an RSLogix 500 report, even though he had...
Replies
10
Views
1,882
Well I am trying to cleanly convert a decimal value in a DINT to the corresponding bit in a different DINT So if I have the number 11 on in...
Replies
11
Views
1,957
Hi everyone, I am reading a alarm word from a device via Modbus using Crimson. I would like to create a flag tag for each of the 16 bits so I can...
Replies
3
Views
1,389
Back
Top Bottom