LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

I would like to store my rs232 data into a excel file and graph it using cvi.

Hi Mark,
Looks like the software is OK. Heres a couple of things to try - the 13 we're sending for the carriage return - try changeing it to a 10. (this is a new line character instead of a carriage return.)

Also, do you have another PC that you can run Hyperterminal on - we need to check that the PC is in fact sending out Data from the serial port. You'll need a serial cable to connect the two machines.(Null Modem cable - i.e. it crosses over the Tx and Rx lines).
Possibly a little easier to do if you have a connector handy is to do a loopback on the serial port so that whatever you send out comes back in - that verifies both sides of your port. (check out the following URL for more info on a
loopback test)
http://digital.ni.com/public.nsf/websearch/e22da85e97818de78625678c0069bfc9?OpenDocument
I think it's a hardware issue somewhere in the system. We need to isolate that first.

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 11 of 20
(1,298 Views)
Hi Mark,
another quick thought - you have checked the baud rate setting on the DART? Did the manufacturer / seller provide an example (possibly fully built) program that you can check the communication with?

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 12 of 20
(1,298 Views)
Hi Mark,
forgot to say - if you use the hyperterminal method, don't forget to go into the windows settings to change the baud rate / parity etc. of the serial port.

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 13 of 20
(1,298 Views)
I am able to check communication with this instrument and a couple other of these instruments with a winwedge software where I tell it to send BAcr and the program will communicate with the software so I know it isn't a hardware problem. When I run the sample program you supplied I tried changing the baud rate, and request command to BBcr for continuous data output and I am unable to see anything disply in the text box. I know that cvi is sending the BAcr because I can hear the instument make a clicking sound from the instruments that the softwar/hardware from the instrument are getting the request to send data out the RS232 but nothing is getting displayed from the CVI program
. Mark
0 Kudos
Message 14 of 20
(1,298 Views)
Hi Mark,
try putting a breakpoint in the code in the Com Callback function. Run it as debug, then you can see if it gets called at all.
S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 15 of 20
(1,298 Views)
Hi Mark,
just had a though - the data might be there, but if the first character in the buffer is a "\0" (ASCII value 0) then when I try to write to the textbox, it won't write anything.
Try replaceing the code in the com callback function with this

char serialReadData[2048] = "\0";
unsigned char byteRead;
int i;
int inQLength;
inQLength = GetInQLen (1);
for (i=0;i&ltinQLength && i&lt2048;i++)
{
byteRead = ComRdByte (1);
if (byteRead==0)
{
byteRead = 10;
}
serialReadData[i] = byteRead;
}
serialReadData[i+1] = '\0';
SetCtrlVal (panelHandle, PANEL_TEXTBOX, serialReadData);



S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 16 of 20
(1,298 Views)
Hi SachaE,

I tried inserting the code you provided but the only way I was able to get it to compile and run was by getting rid of the lt in your for statement. I know this instrument does send the NA data cr when I tried it with another software to check the rs232.
0 Kudos
Message 17 of 20
(1,298 Views)
Hi Mark,
ok - idiot hat on me - I was incorrectly setting up the com callback - in fact the original code was removing it!
InstallComCallback (1, LWRS_RECEIVE | LWRS_RXFLAG, 3, 13, ComCBFunc, 0);

OK,
I;ve attached a new set of files - they have a few extra indicators and an extra button to force the serial byte in check. (just in case I've made another mistake - sorry)
The time indicator is a 2 second indicator. If you hit the get data button, it checks the outQLen for up to 2 seconds, stopping once all the data has gone - good check)
If you hit the check port button, it checks the inQlen for either 2 seconds, or a length of 3 b
ytes. If there's 3 or more bytes of data in the inQ, it forces a call to the comcallback function.
If this works, we can strip out some of the checking again.

Fingers crossed.

S.
// it takes almost no time to rate an answer Smiley Wink
Download All
0 Kudos
Message 18 of 20
(1,298 Views)
Hi SachaE,

I tried running your program but it doesn't work, where you able to get it to compile. It is stating that identifiers for panel time, panel inqlen, and panel outqlen are not found. mark
0 Kudos
Message 19 of 20
(1,298 Views)
Hi Mark,
I just downloaded the files from here, and created a new project - it compiles and links fine for me. Did you make sure you overwrote the .h file?

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 20 of 20
(1,298 Views)