LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read, save data from serial port (write to txt or lvm), and plot data as waveform

still not working 😞
so how about the method in the post above? do you think it'll work?
Regards,
Wen Keat
0 Kudos
Message 21 of 26
(1,710 Views)
i've figured out the problem.. you are right about the 'read number of bytes at port' thing due to the zero byte. i tested by removing that function and set a constant value for bytes to read to 5 then i made my input constant around 300 plus which gives the value eg. 333\00\r as shown in the image i attached.

but the problem is i can't set a constant value to read because my values range from 0 to 1023 which is 1 digit to 4 digits. i don't think i can remove the zero byte from the PIC side because the function to convert values to string is somehow giving the zero byte which i can't understand the reason why.

        itoa(AD_ResultA0, ADstringA0);   //convert the ADC value to string
        putsUSART(ADstringA0);      //send the string to UART
        UARTWriteString("\r");      //add in \r

the \00 zero byte comes in between the value and \r. i tried removing the \r part and found tat the \00 still exist so the problem lies in the first two lines of the commands above.

hope to be able to use the scan string to sort out multichannel data to solve this.


Message Edited by wenkeat on 03-17-2008 10:49 AM
Regards,
Wen Keat
0 Kudos
Message 22 of 26
(1,706 Views)
Hi Wen,

AFAIK in C all strings are terminated with a zero byte - that's why you get that zero from itoa() (Remember: I'm not sure, I'm not a C guru...)

In the attachment you find a sketch how to overcome your problems (using producer-consumer pattern)...

Your idea of using some "pattern" is great. When you do so, you simply strip the first char of the string and wire this to a case structure - it's also sketched in the attachment!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 23 of 26
(1,692 Views)
i've tried your latest VI and it's potting nicely..
but... there's a very big time delay due to all those queuing. i'm working on trying to use the detect string method but it's function is kind of limited because it uses the offset because my data keeps streaming in and i may not know if it scans correctly according to offset.. i tried using it to detect string instead but doesn't seem to work nicely .

is the thing i'm trying to do similar to what u've replied before in this thread?

http://forums.ni.com/ni/board/message?board.id=170&message.id=135538#M135538

thx
Regards,
Wen Keat
0 Kudos
Message 24 of 26
(1,681 Views)
Hello everybody,
I'm new to labview.i want to take ecg signal and want to perform real time procesing on it by using labview. i have already acquired ecg signals by using electrodes and a kit which samples the signal at sampling rate of 9600 bits per second. now problem is that i am unable to access this data in labview from serial port. how can i make this data accessible.
  further i have planned to operate an alarm circuit on the basis of comparision of QR interval between standard and subject.how can i do this?
 
With regards.
 
Puneet Sharma.
B.Tech Student.
 
0 Kudos
Message 25 of 26
(1,614 Views)
Puneet,
 
You would need to install National Instruments VISA for communicating with any serial device. Please download the latest drivers from the following link:
 
 
Also, once you have the VISA drivers installed I would recommend you to use the 'Basic Serial Read and Write' example from the LabVIEW shipped examples to communicate with your device.
 
What action do you want your alarming to do on the satisfaction of a pre-determined condition? More specific information on that will help me in finding a better answer for you.
 
Mehak D.
0 Kudos
Message 26 of 26
(1,596 Views)