LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 and LabView: It won't make new lines

Hi everybody,

 

I've got a microcontroller board here which sends some text over RS232. For example

[quote='HTERM']

UART'4': Key SW2 pressed<\r><\n>
UART'4': Key SW2 pressed<\r><\n>
UART'4': Key SW2 pressed<\r><\n>
UART'4': Key SW2 pressed<\r><\n>
UART'4': Key SW2 pressed<\r><\n>

[/quote]

 

In LabView I can see

[quote='LabView']

UART'4': Key SW2 pressed

[/quote]

 

I think I need some kind of buffer. I compared my VI to a LabView made hyperterminal. I filtered all the receiving thins out and optimized my own VI but it won't make several lines  like it has to make it.

 

I attached my and the terminal (hyperterminal) VI. Maybe someone know why it won't work or rather where the differences are.

 

Kind regards,

Marc

Download All
0 Kudos
Message 1 of 8
(3,907 Views)
If you look at the VISA Configure Serial Port and read the help for it, you will see that there is an input called Enable Termination Character. the default is true and when the termination character is detected, the read will stop. You have a multi-line message with a termination character after each line. You have to disable the termination character.
Message 2 of 8
(3,899 Views)

Hi Marc,

 

please read the context help for "Configure serial port"! Here you can set a term[ination] char - and the default is "Use term char"=True and "term char"=\n. The help also says how to change those parameters...

 

If you switch off term char, you should receive \n\r too in your output string.

 

Edit:

Ok, Dennis beats me by some minutes - but basically we are advising exactly the same Smiley Wink

Message Edited by GerdW on 03-02-2010 06:10 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 8
(3,891 Views)

Thank you. It works better but not as fine as it should:
[quote='LabView']

'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 p

[/quote]

 

After about 30sec the text disapears. I took another look at the terminal.vi. There I saw a shiftregister for the output string. I will compare both VI's in a few minutes again and try to implementate a shiftregister. I think it would work then.

 

0 Kudos
Message 4 of 8
(3,885 Views)

Hi BlackDevil,

 

you should also include a small delay in your loop. It's no good to poll the serial port for each single char...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 8
(3,879 Views)

I found a solution that works. But the main memory of my virtual winxp is too small to handle it Smiley Surprised (192MB). Hm after a restart (the program crashed) it works fine :D.

 

[quote="LabView"]

UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW3 pressed
UART'4': Key SW3 pressed
UART'4': Key SW3 pressed
UART'4': Key SW3 pressed
UART'4': Key SW3 pressed
UART'4': Key SW3 pressed
UART'4': Key SW3 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW2 pressed
UART'4': Key SW3 pressed
UART'4': Key SW3 pressed
UART'4': Key SW3 pressed
UART'4': Key SW3 pressed
UART'4': Key SW3 pressed
UART'4': Key SW3 pressed


Welcome to UART4 of the SK-FR-144PMC Evaluation-Board
================================================================
After Reset => 7-Segm. LED-Display shows counter
Key SW2, SW3 will change count direction
UART'4' will be echoed
UART'5' will be echoed
UART'5' will be send to CAN with ID #3
CAN ID #2 receive will be send to UART5
Key SW2, SW3 will result in UART output
================================================================

[/quote]

 

 

 

Maybe someone would take a look 🙂

 

 By the way: How's my english? Every time I have the chance I try to get some response about it 🙂

 

Thanks for helping me

Best regards,

Message Edited by BlackDevil on 03-02-2010 12:45 PM
0 Kudos
Message 6 of 8
(3,858 Views)

Hi Marc,

 

some points:

- You should initialize the shift register. Use an "empty string" constant for this purpose...

- You collect data in your while loop. As the loop may run for a long time the collected data may grow and use a lot of memory. In fact it uses memory twice the size of the string, one buffer for the shift register and one for the string indicator! Sooner or later you get a "memory full" error as you have a buffer allocation in your code. (Btw. LV isn't showing a buffer allocation on the "Concat string" function, but IMHO there should be an allocation... Maybe the allocation is done in the shift register). So you should implement some mechanism to limit memory usage of string display.

- The program itself should start with as little as 1kB of memory buffer. Don't know why it should crash on first start. But see second point.

- Implement some more error detection. No need to run the loop endlessly when the VISA commands return an error (like on my computer, don't have a COM3 port).

 

 

Your English seems ok for me - but I'm not a native speaker...

Message Edited by GerdW on 03-02-2010 08:57 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 8
(3,844 Views)

Thank's for your answer. I know, there has to be some more mechanism and a initialization for the shift registers. It was just a test how easy it is to handle the COM Port.

 

In the next step I'm making a kind of monitor for several measured data from a race car. There a microcontroller sends the speed, labda value, oil pressure, oil and water temperature and so on over RS232. The challenge is to visualize the data. There I want to make some more security mechanism for the memory.

 

Thank's for helping 🙂

0 Kudos
Message 8 of 8
(3,838 Views)