12-02-2015 04:13 AM
I want to read more number of data bytes from com port which is sent by microcontroller in my test board. I am using CVI to read all bytes and log the data. I have set time out as 5s. Input queue = output queue = 32767, baud rate = 38400. First I send a command to micro requesting data from it, then i read the bytes sent. Below is the code. when i am sending command to micro, it is receiving and send the bytes, but CVI is not reading properly. Below is the code.
bytes_sent = ComWrt (comport, send_data,(No_of_CAN_FD_bytes_Ecu2+6));
bytes_read = ComRd (comport, read_data, (No_of_CAN_FD_bytes_Ecu2+6));
bytes_read = ComRd (comport, read_data,(No_of_CAN_FD_bytes_Ecu2+6));
Can anyone help me??
12-02-2015 04:27 AM
To read the entire message in one single command, you should set 5000 in ComRd.
Otherwise you could read in a loop in small chunks and append data to a large buffer; this could be the best option to leave the user interface responsive: on each loop you could test the state of a toggle button used as an 'abort' flag.