Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5362

How to handle formfeed received on rs232?

$
0
0

Hi,

 

I am new to CVI, however have good knowledge of microcontroller based C programming. I am trying to figure out how to handle formfeeds sent by a device.

 

HARDWARE:

1) I am running LabWindows CVI 2013 on my PC

2) I have a electronic hardware which can serially communication using RS232

 

The Issue:

Basically the hardware responds to the commands sent through the serial port. previously i had been using HyperTerminal for the communication. Hence when the device responded with new data it sent form feed first and then the data.

 

Now I wanted to move on to a HMI development, I have setup the C code in CVI to send out serial commands and using 

 

InstallComCallback (COM_PORT, LWRS_RXCHAR, 0, 0, Event_Char_Detect_Func, 0); 

 

I am trying to read the data into a buffer and display it in a text box

 

void CVICALLBACK Event_Char_Detect_Func (int portNo,int eventMask,void *callbackData)
{
char readBuf[1000] = {0};
int strLen;
strLen = GetInQLen (COM_PORT);
ComRd (COM_PORT, readBuf, strLen);
SetCtrlVal (panelHandle, PANEL_OUTPUT_STRING, readBuf);

return;
}

 

However I am receiving small boxes instead of form feed. I used "LWRS_RXCHAR" so I could read each character individually and then maybe handle formfeeds but the compiler requires readBuf[] to be more then one character showing that it reads the complete RX data que before sending it to textbox (OUTPUT_STRING).

 

I can always make changes to the micro controller, but I want to know if there is a proper way of handling such a situation? or maybe I am doing someting wrong in the code above?? Help needed.


Viewing all articles
Browse latest Browse all 5362

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>