in data 07-09-2013 07:27 AM
Hello Everyone,
I downloaded modbus library and try to use modbus ethernet query to communicate with PLC. I found modbus can only read about 100 register one command but I need to read way more than 100 registers and record the data to a spreadsheet and export the final result as a csv file. I am really new to this field and wondering how can this be done ?(my guess is using while loop?)
in data 07-09-2013 04:13 PM
Do multiple reads in series with each. The first 100 registers, then the next 100, then so on. Then you can combine the results to write to your CSV file.
in data 07-10-2013 01:56 PM
Hello Knight of NI,
Thank you for replying. I am wondering why cannot use a while or for loop?
in data 07-10-2013 03:08 PM
I don't understand your question. You'll have to show me an example of how you are thinking that a while loop is going to help you read more than 100 registers at a time.
in data 07-11-2013 12:52 AM
Hi Sophia,
actually RavensFan is implicitly suggesting to use a while/for loop.
Do you need to read 10000 registers?
Run a for loop 100 times placing a modbus read of 100 registers inside.
Regards,
Marco
in data 07-11-2013 08:40 AM
@MarcoMauri wrote:
Hi Sophia,
actually RavensFan is implicitly suggesting to use a while/for loop.
Do you need to read 10000 registers?
Run a for loop 100 times placing a modbus read of 100 registers inside.
Regards,
Marco
Not exactly.
You use a while loop to do repetitive readings of the same registers for an unspecified number of times. You use a For loop to do repetitive readings of the same registers for a known number of times.
You can use a for loop for different registers, but you have to set it up correctly. You'd need to use arrays that would define each group of registers that you can auto-index on that array so that each iteration of the For Loop will handle the different groups. Of course modbus is returning data, so you need to figure out a way to send that data to different places since each group represents different data.
in data 07-11-2013 10:36 AM
What have you tried? Please pose your code.
in data 07-11-2013 10:50 AM
Hi RavensFan,
Thank you so much for your advice. I am still working on the program. Since it's the first time I ever use labview, I did lots of readings for the past few days try to understand better. I will post my code as soon as I am done.
Sophia