Home > other > Write using Linux with a serial port function to send data to lower place machine failure?
Write using Linux with a serial port function to send data to lower place machine failure?
Time:09-30
The younger brother to lower place machine using Linux in the write function to send data code below String s_command="$CFGMSG, 4, 1"; Char * command=new char [s_command length () + 1); for(int i=0; I & lt; S_command. Length (); I++) { The command=s_command [I] [I]; } The command [s_command length ()]='\ 0'; Int n=write (fd, command, s_command. The length () + 1); Cout & lt; <"N" & lt; S_command this string is I want to send to the next bit machine orders, he put in command of the dynamic array, and then to write this command using the write function into the fd device, the return value n is normal, but the machine seems to be no response, I don't know how to get? There are under the guidance of the eldest brother?
CodePudding user response:
A serial port parameters are consistent? With another serial port + serial debugging assistant to see if normal?
CodePudding user response:
PC normally receives the data of the board, but write data using the write function is not successful