kkoen

modbus comm errors

Recommended Posts

Hi there,

Thanks for the support i received in the past, I have a few years of positive experience with azeotech.

In my current project i deal with a modbus device.

Reading the registers works ok, I have a channel for each register I want to read and have them all set at 0.1s interval.

Now, I also need to set some registers and I made a small sequence for that.

the button ' zero displacement' invokes this sequence.

the registers I want to set all have their own channel as well.

This works but only sometimes...

with reading every 0.1s I get lots of ' port locked' errors.

I quess that i need to pauze the reading for a moment to make room on the bus for setting the appropriate registers.

Could you give me a hint on how to solve these issues?

Thanks,

Koen

for legacy reasons, I run this file in DAQfactory 5.87c

 

DirksonWTB_22kN_v1.ctl

Share this post


Link to post
Share on other sites

Yes, at 0.1 seconds there may not be any space between the queries to allow for an output.  One way to resolve this is, as you said, to pause the reading.  You can do this by moving the timing of the reads into script.  To do this, put all the input channels into their own channel group, say "Input", and set the Timing of them to 0.  Then create a sequence.  The script would simply be:

while(1)
   channel.readGroup("Input")
   delay(0.1)
endwhile

When the sequence is running, it will query the inputs.  When you stop it, it will stop querying the inputs.  Use beginseq() and endseq() from script to do this.

Share this post


Link to post
Share on other sites

Yes, that works! Only thing is that since the channels are in two different groups now, I can no longer open the channel to see the graph or table view. I can only open the list of channels with all their properties. This is only necesary for debugging, and maybe it has to do with the older DAQ version?

 

Share this post


Link to post
Share on other sites

No, you should see something like:

CHANNELS:
   + Group1
   + Input
   + Main
 

You can click on the plus next to the group and the individual channels in that group will appear.  Then you can get to the channel view with the graph/table.

 

 

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