Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 10 months ago.
transfer data to device (modbus protocol)
Sorry i post again. i want to transfer this array command[]={0x08, 0x03, 0x00, 0x01, 0x00, 0x02,0x95,0x52}; to device. and use modbus protocol so i need the device to receive these hex. How could i do ? Thanks very much TAT!!!! the board i use is LPC4088. this is my code~ but maybe i think it may have modbus code for it
#include "mbed.h" Serial micro(p9, p10);//tx, rx Serial pc(USBTX,USBRX);//tx, rx const char command[]={0x08, 0x03, 0x00, 0x01, 0x00, 0x02,0x95,0x52}; int err; int result; int i ; int main() { micro.format(8, Serial::None, 1); micro.baud(9600); pc.format(8, Serial::None, 1); pc.baud(9600); while(1){ while (true) { if (micro.writeable()) { result = micro.puts();//i have no idea so i don't know how to rectify pc.printf("Putc result: %X\r\n",result); break; } } } }