plcpeople / nodepccc

Library for node.js to communicate with some Allen-Bradley programmable controllers (PLCs)
MIT License
81 stars 24 forks source link

Timer and Counter PRE/ACC Values #4

Closed pcainc closed 8 years ago

pcainc commented 9 years ago

Currently testing the code and liking it a lot so far! However, when I attempt to read either a timer or counter, PRE or ACC, I always get a value of "0" with no errors. I have confirmed the addresses and values in the PLC, and at least the PRE values are non-zero. All other types seem to read just fine, so I know it's not a connection issue or malformed tags (as mentioned, no errors). Browsing through the code, I didn't notice anything out of the ordinary, but I will continue to research and report back on anything that I might notice causing the problem. I'm using a Micrologix 1400, series B, and the tags I'm trying to read are "T4:0.PRE", "T4:0.ACC", "C5:0.PRE" and "C5:0.ACC". Please let me know if you might have a possible solution to this issue, or at least where to look. Thanks!

plcpeople commented 9 years ago

I will see if I can repeat the problem on the PLCs I have access to in the next day or so - this doesn't include a 1400, but they should be similar. A wireshark trace or the console log after setting "effectiveDebugLevel" to 3 in the first few lines of code might be useful, but I may not need that if I can duplicate the issue.

plcpeople commented 8 years ago

I found and fixed a bug that was causing this issue. Please try the latest version from today.

You can also request simply "T4:0" and you'll now get an object like: { EN: true, TT: true, DN: false, PRE: 1000, ACC: 500 } - but T4:0.PRE should now return an integer as expected.

I'll leave the issue open until you are able to test as I only have access to a SLC right now.

pcainc commented 8 years ago

Tested it out on our Micrologix 1400 and works fine now. Thanks again!