LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use RS232 to get data from PIC

Hello

 

I am new here and unfortunately not that familiar with Labview.

I spend the whole day finding out how I can use the RS232 (Com1) port of my computer with Labview.

I am getting a data string with 25 bits from the PIC-microcontroller. Every 2 Seconds. It looks like [00,00,00]

I need to transmit the data to the PC and with the help of Labview I want to arrange them so that I can use the data for further calculations.

Maybe I am going to use the array function.

 

How does it work with the RS232?

 

Martin

 

 

 

P.S. Sorry for the English. I still try to improve it.

0 Kudos
Message 1 of 15
(7,738 Views)
Martin,
 
You should be able to look into example folder and locate an an example vi for the task. (Go to Help> Find Examples. It will lauch NI Example Finder. I am assuming you are using LV7.0 or higher)
 
C:\Program Files\National Instruments\LabVIEW 7.0\examples\instr
 
The above folder has a simple srial comm vi. I am also attaching another vi that helps me debug my simple serial communication stuff. I hope it helps
Message 2 of 15
(7,714 Views)
Hi
 
Thank you for the file. I do have a connection now. But the data I am getting looks not like what I had expected.
 
Ì    204   11001100
Ë  203   11001011
Ì    204   11001100
Ë  203   11001011
È  200   11001000
Æ 198   11000110
Å  197   11000101
     0       00000000
 
?
 
 
 
 
0 Kudos
Message 3 of 15
(7,688 Views)

Leo,

are you sending RS232 compatible bitestreams?

Have you checked baudrate, (startbit) stopbit(s), parity, databits ?

 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 4 of 15
(7,675 Views)


@LabLeo wrote:

...

I am getting a data string with 25 bits from the PIC-microcontroller. Every 2 Seconds. It looks like [00,00,00]

...


looks like 3 byte, but that's 3x8=24 bitSmiley Surprised

are you sure you have a rs232 port on your PIC? (That involves some extra circuitry for RS232 voltage level (and inversion?))

If you are using a SPI or I2 style serial communication, you maybe can (ab)use the handshake lines of the COM port to read the data.

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 5 of 15
(7,673 Views)
Martin,
 
Seems Like you are getting good data. What your are getting is same info in three different format separated by space. The first is an ASCII representation of the decimal number displayed next. The last value is visibily the binary equivalent of the decimal.
 
Use an appropriate vi from the String Pallet to parse the values from each line. You can again look into the help folder and get a better idea of what sets of vi will help you.
 
Attached to this post you will find a vi that will explain how you can convert a decimal number into an ASCII and binary equivalent.
Message 6 of 15
(7,671 Views)
Hi
 
Thanks so far.
 
I do have an PIC628A Microcontroller that supports RS232. To get the right voltage level for the PC RS232 I also use one MAX232 Chip.
Baudrate, (startbit) stopbit(s), parity, databits are OK.
Henrik you are right - there are 24bits. I checked it also with the scope. Smiley Wink
 
I do not think the I am getting good data. Because so far I just transmitted zero bits. So the received ASCI, decimal or dual string cannot be right?!?!
By the way. I used the programm COM TERMINAL to get the date. With Labview the output files were even more confusing.
 
Now I am going to try it with Hyperterminal. If that works it should be also work with Labview.
 
Bye
 
0 Kudos
Message 7 of 15
(7,665 Views)

Good Morning

Sometimes a coffee work wonder.

I do now get the right data with Hyperterminal and Labview as well. I made a mistake by connecting the MAX 232 chip.

Data String

01,0,0

02,0,0

03,0,0

.................

 

So now

0 Kudos
Message 8 of 15
(7,636 Views)

Good Morning

Sometimes a coffee work wonder.

I do now get the right data with Hyperterminal and Labview as well. I made a mistake by connecting the MAX 232 chip.

Data String

01,0,0

02,0,0

03,0,0

.................

 

So now I have to

0 Kudos
Message 9 of 15
(7,636 Views)
I have Labview 7.0 talking to a PIC 16F877A using the CCS development kit.  I've attached the labview code and the C code.  If you need anything else let me know.
0 Kudos
Message 10 of 15
(7,612 Views)