08-02-2007 08:34 AM
I have a temperature controller that has a serial communication rs-232,the company of it provide all the necessary docs
Of the communication protocol of the controller. When I sending a command I am receiving a response command .
How can I see this response command ?
08-02-2007 09:01 AM
Hello Sagielka,
What exactly is your problem? You do not know how to check when data is received? You do not know how to get the data from the serial port? Or you do not know how to display the received data in your User Interface?
08-03-2007 04:08 AM
Hi Wim
when i'm transmit data to the controller ,the controller shuold send a respolnse messege. here is the controller rs-232 protocol:
as far of writing to the device there is no problam. i just fill a 6 byte buffer and use comwrt().
i tried the comrd() but no luck there.
suggestions?
Thanks.
08-03-2007 07:05 AM
Hello Sagielka,
The ComRd function should work fine. Are you sure that the device sends a response? If so, how long does it take for the device to respond? Is it possible to post a piece of your code? Maybe that could clear some things out...
08-03-2007 07:09 AM
08-03-2007 02:11 PM
08-03-2007 02:14 PM
Oh and yes, when i'm using ComRd() i do get something,the Buffer is changed but
nothing understandble as should be.
08-03-2007 03:18 PM
08-07-2007 01:49 AM
Thx.
it's working fine now but i have one more problam to solve. The ComRd() takes very long time,about 2sec and even more.
i set up timer that sould read data from 2 controllers. the data transmited in hex.
here is a part of my code:
int CVICALLBACK Control_Timer (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int statA=0,statB;
unsigned char BufferA[20]={0},Read_BufferA[20]={0};
unsigned char BufferB[20]={0},Read_BufferB[20]={0};
char Temp[2];
switch (event)
{
case EVENT_TIMER_TICK:
BufferA[0]=Controller_A_PortNum;
BufferA[1]=0x04;
BufferA[2]=0x10;
BufferA[3]=0x00;
BufferA[4]=0x00;
BufferA[5]=0x01;
ComWrt (Controller_A_PortNum, BufferA, 6);
DelayMili(50);
ComRd (Controller_A_PortNum, Read_BufferA, 6);
DelayMili(50);
Temp[0]=Read_BufferA[4];
Temp[1]=Read_BufferA[5];
SV1=((Temp[0]<<8) | (Temp[1]));
SetCtrlVal (panelHandle, PANEL_NUMERIC, SV1*0.1);
break;
}
return 0;
}
how can i improve the reading time?
08-07-2007 03:19 AM
It would be an idea to read the return value from ComRd() - 2 seconds seems suspiciously similar to the timeout value suggested in a previous post so you should check the return value for errors. (-99 is the timeout code.)
JR