12-07-2012
11:34 AM
- last edited on
12-10-2012
08:52 AM
by
MaryH
Hi all
I am working on a project for my thesis . i am trying to acquire a ECG signal from the serial port . i have implemented the ECG circuit and it works fine . what i have here as attached files is a VI that i was lately working on . it works perfectly and i am able to acquire the signal from the serial port . but the dilema is im having a hard time with explaining why ?
to go further on the explanation ,
ECG test(1) VI is the VI that i was working on lately.it is giving me a real very noisy signal . i am expecting to have an ECG signal with PQRST complexes .
but when using . ECG vi i am having a real ECG signal with approximately 50 % heart beats shown .
i just wanna go further with the filtering of the signal and applying discrete wavelet transform on the signal so that clinicians can easily read the signal .
can you guys suggest anything ?
12-07-2012
11:44 AM
- last edited on
12-10-2012
08:52 AM
by
MaryH
to be more precise
ECG tes VI is giving me results number 1 .
ECG VI is giving me results number 2
I hope i made it clear.
12-07-2012 11:55 AM
I work a lot with serial comms and also with ECG signals. But I am having trouble understanding your question.
You have two different VIs?
And they are producing 2 different results?
And you want to know why?
If that is the case, can you explain what is different between the two VIs?
I opened them, and they look significatly different. Both in how they acquire and process the data. So oviosuly, they are going to display significantly different results.
But my first thought is that if you are receiving your data via a serial cable, then your LV code will have zero effect on the noise. The noise is already there. Not much you can do about it from the code, except to try and filter it out after-the-fact.
12-07-2012 12:00 PM
Dear josborne . no m not trying to look at the difference in results between the 2 VI.
i mean that i m trying to use the perfect VI among them the thing which allows me to have the best ECG reading ever. ECG VI is giving me a good results . but need to apply filtering on it as well as to apply discrete wavelet transform in order to suppress the high frequencies that are present in the signal .
i have posted the second VI ( ECG test (1) ) in order for you sir to answer me why is it giving me that much noise .
if we can just apply filtering and discrete wavelet transform on one of the VI codes it would be perfect .
12-07-2012 12:09 PM
Bill David,
1. It appears that you have the serial port set to terminate both reads and writes on a line feed character. When using termination characters you do not need to use Bytes at Port. Using Bytes at Port and termination characters simultaneously often produces garbage data because you get partial messages which are then misinterpretted.
2. What do the read string and bytes read indicators show when running?
3. How many data points do you receive (or expect to receive) with each read?
4. What is the format of the data as it comes in on the serial port? The reason I ask this is that your data conversion seems rather convoluted.
5. What does the data in the shift register in ECG Test(1) look like?
Lynn
12-07-2012
12:19 PM
- last edited on
12-10-2012
08:52 AM
by
MaryH
Dear johnsold,
First i was using the basic serial read and write example in the examples . but im not writing anything to the port . im just reading from it . i can delete that . but it feels like it has nothing to do with the reading process as long as i am writing to the port .
1 - the attched picture shows you the string that i am reading from the serial port .
2 - i have no idea about the amount of bytes being sent from the microcontroller . im just reading whatever bytes offered by the serial port and trying to convert those bytes into numbers and then plot them . i dont even know how many bytes are being sent from the microcontroller . because when the analogue signal come in to the input of the UC it just convert it to digital then send it directly to the serial port by USART.
3- the microncontrolller is sending words or bytes to the serial port . ( I am using 16F874 from microchip ) it is an 8bit microcontroller .
12-07-2012 12:38 PM
Bill David,
Both of the VIs you posted send "*IDN?\n" on every iteration of the loop.
1. Try changing the read string indicator to '\' Codes Display or Hex Display. That will indicate all the characters and will show the hex values for any unprintable characters.
2, 3. You are converting the string to an array based on a space character as a separator between elements and End of Line between rows. But because termination characters are enabled on VISA Read, you will never get any EOL characters in read string. Thus you will only get one row in your arrays. If the microcontroller is not sending the space and EOL characters (and you did not mention them), then your conversion process is completely meaningless.
3.a. If the conversions are 8-bit, then you should convert all bytes as individual U8 or I8 integers rather than whatever you are doing now. If the conversions are more than 8 bits, then you need to know exactly how the microcontroller is formatting the data: endian, bit packing, bit padding, ...
Lynn
12-08-2012 10:56 AM
12-10-2012 05:59 AM
Hi Bill David,
I think that trying the above suggestions might help you solving the issue. Trying the NI LabVIEW Biomedical Toolkit as Dennis_Knutson suggested might also help - there is an evaluation version, so that you can simply try the functionality for your signal.