A
Hey,
I am trying to get my HMI to display integer values that the PIC18F4550 micro calculates using RS232 and Modbus RTU. I am new to Modbus and am trying to learn the protocols. I am thinking I need to set the Micro as the master and the HMI as the slave. So I send the this packet:<pre>
3.5 Character Start bit at 38K4 baud rate
TXREG = 0x01; //Addresses the HMI as address 1
TXREG = 0x02; //Tells HMI to read registers
TXREG = 4; //Data to send to HMI as a test
crc = CRC16 ();
if (crc = 1) //Data is ok
{
3.5 Character Stop bit at 38K4 baud rate
return;
}
if (crc = 0) //Data is not ok
{
modbus(); //Go through routine again
}</pre>
I am wondering, how do I store the integer value that I want to display on the HMI in an address in the Micro that the Modbus RTU recognizes (40001 and up). Would I put the integer value that I want displayed in the data part of the packet?
I am also wondering, will the HMI send a confirmation value back saying it got the data?
Thanks for any help!
AJ
I am trying to get my HMI to display integer values that the PIC18F4550 micro calculates using RS232 and Modbus RTU. I am new to Modbus and am trying to learn the protocols. I am thinking I need to set the Micro as the master and the HMI as the slave. So I send the this packet:<pre>
3.5 Character Start bit at 38K4 baud rate
TXREG = 0x01; //Addresses the HMI as address 1
TXREG = 0x02; //Tells HMI to read registers
TXREG = 4; //Data to send to HMI as a test
crc = CRC16 ();
if (crc = 1) //Data is ok
{
3.5 Character Stop bit at 38K4 baud rate
return;
}
if (crc = 0) //Data is not ok
{
modbus(); //Go through routine again
}</pre>
I am wondering, how do I store the integer value that I want to display on the HMI in an address in the Micro that the Modbus RTU recognizes (40001 and up). Would I put the integer value that I want displayed in the data part of the packet?
I am also wondering, will the HMI send a confirmation value back saying it got the data?
Thanks for any help!
AJ