LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial communication,problem reading signals in labview

hello,

 

i have 4 digital signals coming from a bluetooth, 2 AC and 2 DC. the data is coming in a 16-bit strings. I should seperate these four signals in labview and analyse them for medical device in real time.
I know I should use a serial port in visa but I have no idea how to split 4 signals in visa.

 

Regards

0 Kudos
Message 1 of 23
(3,719 Views)

Bluetooth or Serial? Which is it. You say you need to use a serial port in visa so I am assuming you are not trying to talk via Bluetooth from with in LabVIEW.

 

What is the format of the digital signal data that is being sent to the serial port? Is it 4 binary numbers each read or is it ASCII text of the data? Can you give us an idea of the format of the data that you are reading. Binary arrays or ASCII text string. 

Omar
0 Kudos
Message 2 of 23
(3,710 Views)

the signal type is binary and im getting it from UART. maybe i defined it wrong, but i use a bluetooth communication. isnt it a kind of serial one?

0 Kudos
Message 3 of 23
(3,701 Views)

So you are getting back an array of numbers (U8 U16 or U32)

 

Use array functions to break apart the signals based of the format of the data.

Do you know how the data is formated in the binary data? 

Omar
0 Kudos
Message 4 of 23
(3,697 Views)

the thing is that im getting 4 sequence of 16 bits signals , and each of it comes in 2 sequence of 8 bits. first i get the second 8 bits, and then i get the first 8 bits.

whatever all of 64 bits will come in a lne. my problem is that i dont know how shud i seperate them into 4 different signals that i want to analyze.  this is the code which samples the data (code for the bluetooth module) and send it to my computer: isnt it a binary data?


int main(void)
{
unsigned int PPG_IR_AC;
unsigned int PPG_IR_DC;
unsigned int PPG_R_AC;
unsigned int PPG_R_DC;

// Insert code

do
{

// init the port
// Ex
DDRD = OUT7 | OUT6 | IN5 | IN4 | IN3 | IN2 | IN1 | IN0;
SetBitMask(PORTD, BIT6);

//Power On
SetBit(PORTD,7);


while(TRUE)
{
PPG_IR_AC = GetAdcADS8341(ADS8344_CH5);
PPG_IR_DC = GetAdcADS8341(ADS8344_CH6);
PPG_R_AC = GetAdcADS8341(ADS8344_CH7);
PPG_R_DC = GetAdcADS8341(ADS8344_CH2);

UartSendByteUB(PPG_IR_AC>>8); // How to send measured data to bluetooth transmitter
UartSendByteUB(PPG_IR_AC); // How to send measured data to bluetooth transmitter

UartSendByteUB(PPG_IR_DC>>8);
UartSendByteUB(PPG_IR_DC);

UartSendByteUB(PPG_R_AC>>8);
UartSendByteUB(PPG_R_AC);

UartSendByteUB(PPG_R_DC>>8);
UartSendByteUB(PPG_R_DC);


Delay(1024, 0.013); // delay


}

}while(0);

return 0;
}

0 Kudos
Message 5 of 23
(3,690 Views)

It looks like you get a singl byte of data with each read

You have to read twice to get both the high byte and the low byte of a single 16 bit value

 

Read 1 IR_AC (high byte)
Read 2 IR_AC (low byte)

Read 3 IR_DC (high byte)
Read 4 IR_DC (low byte)

Read 5 R_AC (high byte) 
Read 6 R_AC (low byte)

Read 7 R_DC (high byte)
Read 8 R_DC (low byte)

undefined

Omar
0 Kudos
Message 6 of 23
(3,674 Views)
0 Kudos
Message 7 of 23
(3,673 Views)

the thing is that im getting 4 sequence of 16 bits signals , and each of it comes in 2 sequence of 8 bits. first i get the second 8 bits, and then i get the first 8 bits.

whatever all of 64 bits will come in a lne. my problem is that i dont know how shud i seperate them into 4 different signals that i want to analyze.  this is the code which samples the data (code for the bluetooth module) and send it to my computer: isnt it a binary data?


int main(void)
{
unsigned int PPG_IR_AC;
unsigned int PPG_IR_DC;
unsigned int PPG_R_AC;
unsigned int PPG_R_DC;

// Insert code

do
{

// init the port
// Ex
DDRD = OUT7 | OUT6 | IN5 | IN4 | IN3 | IN2 | IN1 | IN0;
SetBitMask(PORTD, BIT6);

//Power On
SetBit(PORTD,7);


while(TRUE)
{
PPG_IR_AC = GetAdcADS8341(ADS8344_CH5);
PPG_IR_DC = GetAdcADS8341(ADS8344_CH6);
PPG_R_AC = GetAdcADS8341(ADS8344_CH7);
PPG_R_DC = GetAdcADS8341(ADS8344_CH2);

UartSendByteUB(PPG_IR_AC>>8); // How to send measured data to bluetooth transmitter
UartSendByteUB(PPG_IR_AC); // How to send measured data to bluetooth transmitter

UartSendByteUB(PPG_IR_DC>>8);
UartSendByteUB(PPG_IR_DC);

UartSendByteUB(PPG_R_AC>>8);
UartSendByteUB(PPG_R_AC);

UartSendByteUB(PPG_R_DC>>8);
UartSendByteUB(PPG_R_DC);


Delay(1024, 0.013); // delay


}

}while(0);

return 0;
}

0 Kudos
Message 8 of 23
(3,653 Views)

So you have a big endian vs. little endian problem?

 

In that case, use unflatten from string.  Set the byte order.  And set the input for array size prepended to false.

 

0 Kudos
Message 9 of 23
(3,641 Views)

I use array,do you think it is correct or not?

0 Kudos
Message 10 of 23
(3,595 Views)