Jump to content

Reading Jazz Timer


Bobkatt

Recommended Posts

Hi

I have built an application for monitoring registers on Unitronics PLC's using the Unitronics.ComDriver with vb.net

Currently I am using the version compiled on 21/01/2013

I am able to read/Write to all registers on all devices except Jazz Timers

When attempting to read either TP or TC Timers I get the following error:

Index and length must refer to a location within the string.

Parameter name: length

The code I am using:

Dim plc_request As ReadWriteRequest() = New ReadWriteRequest(0) {}
Dim plc_read As ReadOperands = New ReadOperands()
plc_read.NumberOfOperands = 1
plc_read.OperandType = OperandTypes.TimerPreset
plc_read.StartAddress = 5
plc_read.TimerValueFormat = TimerValueFormat.SecondsFormat
plc_request(0) = plc_read
plc_con.ReadWrite(plc_request) -- error occurs on this line
Dim plc_value As Object() = DirectCast((plc_request(0).ResponseValues), Object())

The error occurs on the line:

plc_request(0) = plc_read

I have also tried with

plc_read.TimerValueFormat = TimerValueFormat.TimeFormat

I appreciate any help you can provide

Thanks

Link to comment
Share on other sites

Hi, it appears that the U90 timers are different from the Vision timers.

While the vision timers have the Preset and Current stored in an Int32, the U90 timers are stored in an Int16 where the first 14 bits (LSB) are the value and the 2 MSBs are the resolution.

The Communication Driver fails on reading the timers preset/current on the Jazz or M90/91 PLC since it expects 8 characters and gets only 4 (this is why you get the exception of trying to part of strings out of its bounds)...

U90/91 and Jazz PLCs also does not support setting Current and Preset values using PCOM (while the Vision PLC does).

I'm not sure if this issue will ever get fixed.

Since Unitronics share the sources of the communication driver, then you can change the code in order to fix it, or you can use the SendString command in order to sent Read Timer Preset/Curremt commands to the Jazz PLC, and use the reply you got from the PLC in order to get its value. For example:

plc_con.SendString("GP000501")

  • Upvote 1
Link to comment
Share on other sites

Sorry, but not having much luck with this, I changed the code to use:

plc_con.SendString("GP000501")

instead of

plc_con.ReadWrite(plc_request)

but got no reply from the Jazz

Are you able to provide more detail about the string to be sent to the plc?

Thanks

Link to comment
Share on other sites

It should work. I have tested it on a M91 PLC.

It is the same command that is being sent which doing your code:

Dim plc_request As ReadWriteRequest() = New ReadWriteRequest(0) {}

Dim plc_read As ReadOperands = New ReadOperands()

plc_read.NumberOfOperands = 1

plc_read.OperandType = OperandTypes.TimerPreset

plc_read.StartAddress = 5

plc_read.TimerValueFormat = TimerValueFormat.SecondsFormat

plc_request(0) = plc_read

plc_con.ReadWrite(plc_request) -- error occurs on this line

Dim plc_value As Object() = DirectCast((plc_request(0).ResponseValues), Object())

  • Upvote 1
Link to comment
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
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.