Jump to content
Pascal BRIANTO

Error When reading timer value

Recommended Posts

Which PLC Model?

 

I just tested it with a V130 and it worked (the small example from the documentation).

 

I see that in your first post, your code shows that the protocol used as ASCII. V130 and any of the enhanced PLCs should use a Binary message for read and write.

Furthermore, I see, from the stack trace, that the error message arrives from ReadIntegersMessage, so unlike the code example that you gave me, the first error is related to read operation, while the code examples are related to write operation.

I'm confused.

Share this post


Link to post
Share on other sites

Yes, you are correct.

The Timers preset and current works differently in the U90 / Jazz PLCs (I just confirmed it).

While the Vision PLCs return a string which is the preset, where each byte (represented as hex) is either the hour, minutes, seconds, or milliseconds, 

In the U90/Jazz PLCs, the value (in hex) is a 16bit integer where the 2 MSBs are the resolution, and the rest of the 14 LSBs are the raw value depending on the resolution.

(Resolution: 10ms = 0, 100ms = 01, 1s = 10, 10s = 11 ..... the numbers are bits) .

 

The fix is not as simple as it looks (since changing the value from 32 to 16 would still cause an exception, and the returned value will be incorrect.

 

Share this post


Link to post
Share on other sites

OK. I've did some fix that should allow both U90 and Vision PLCs support Read of timer Preset and Current values.

I don't think that write preset or current values is supported in the U90 (It doesn't work when I send the command, and I also don't see the U90 Ladder allows changing timer current or preset value during Online.

Unitronics.ComDriver.dll

Share this post


Link to post
Share on other sites

I did give you a new DLL that allows you to read the timer value.

I'm not sure that you can  write the preset. Maybe you can write a "Protocol" by yourself, and then change it from ladder. I'll investigate the U90 Ladder code myself again in order to see if maybe there is some sort of code that does allow writing timers values.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×