I had an interesting call from a customer this week.
He was trying to use a Data Sample object to monitor a switch changing state. He needed to log when the switch changed state.
The switch was triggering a B3 bit in an Allen Bradley PLC . In the Data Sample object he could use the bit to trigger the Data Sample but had no Word to put in the Read address that showed the B3 bit's state. Eventually he made a rung of logic that put the bit state in an N word in the PLC and then logged the word.
I have recommended adding bit logging capability to the software developers as an improvement for the next version EB8000.
Still, some might ask "What if I can't change the logic in the PLC?"
Here is a quick work around using a Macro.
1. Create a Macro called BitLog that uses the following code:
macro_command main()
bool bBit //bit for general use
GetDataEx(bBit, "Allen-Bradley DH485", B3, [B3 address], 1) //get the bit state
SetData(bBit, "Local HMI", LW, 7000, 1) //save the bit state to an internal word
SetData(bBit, "Local HMI", LB, 7000, 1) //save the bit state to an internal bit
end macro_command
2. Create a PLC Control object that triggers the Macro with the B3 [B3 address], (OFF<->ON)
3. Create a Data Sampling object triggered by LB7000 (OFF<->ON) that uses a Read Address of LW7000.
When the B3 bit changes state, the Macro is triggered. That, in turn, triggers the Data Sample object. The only draw back is that the time could be off by 1 to 5 seconds. This is slightly longer than using the logic change mentioned at the beginning of this post.
Macro's are a handy tool for making HMI interfaces do much more than expected. You might want to explore the Macro help and try out some Macro coding. It is not as scary as some people make it out to be.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment