ni.com checkout is currently experiencing issues.
Support teams are actively working on the resolution.
ni.com checkout is currently experiencing issues.
Support teams are actively working on the resolution.
11-05-2006 11:36 AM
11-09-2006 04:38 AM
11-11-2006 03:11 AM
11-11-2006 07:16 AM
Hi David, basically modbus permits you to read and write into the PLC memory: it's up to the program resident inside the PLC to determine the content of the memory to read and what to do with the memory written to by the computer.
In order to establish a serial communication with the PLC your program must:
1. Open the serial port with proper parameters the plc can use to communicate
2. Prepare the memory arrays to calculate the CRC
3. Prepare a message with the correct PLC address, function number (0x03: read if I'm not in remembering), addressof memory to read and width of memory read, CRC
4. Send to the PLC which should receive, check the message and respond with an appropriate ACK message
5. Wait for the response and check it (calculate the CRC on the answer and check with the CRC received by the PLC)
6. If it's ok, read the response
What I exactly don't know is which part of the protocol is automatically performed by the PLC and which one is to be written by you inside that device. Shortly I will attach some source code I developed to communicate.
11-11-2006 06:09 PM
11-12-2006 11:57 AM
Hi David,
I have implemented both Modbus and Modbus over ethernet natively in CVI using Ansi C Code.
The Modbus serial implementation is straightforward and I basically used the sample code from the Modicon Modbus manuals. If you need the manuals and /or my code mail me directly.(ni_cviforum@jattie.co.uk)
Best regards
Jattie van der Linde
11-19-2006 02:07 AM
Dear Lee,
I have done only project where I read a temperature from a Brain Child Temperature indicator. The following is the coding. It is proved and working for more than one year.
double ReadTemperature(void)
{
//int i,val,send_array[8]={0x01,0x03,0x00,0x41,0x00,0x01,0xD4,0x1E},read_array[7]={0,0,0,0,0,0,0};
int i,val,send_array[8]={0x01,0x03,0x00,0x40,0x00,0x01,0x85,0xDE},read_array[7]={0,0,0,0,0,0,0};
double temperature=0.0;
for (i=0; i<=7; i++)
ComWrtByte (TCport, send_array[i]);
for (i=0; i<=6; i++)
read_array[i] = ComRdByte (TCport);
read_array[3]=read_array[3]<<8;
val=read_array[3]+read_array[4] ;
temperature=(val-19999)/10;
return (temperature);
}
Regards,
Kumar.E
Using CVI since 1998.
08-30-2007 08:49 AM
02-28-2012 01:52 PM
ni_cviforum@jattie.co.uk email to this id fails.........I need some sample code for Modbus RTU and also the manuals. Please send me at hafeezullah_88@yahoo.com
Thanks
02-28-2012 07:04 PM
Did you see this nice contribution?