LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 initialisation and time

Hello !

 

I would like to send some measures and some datas to LabView with RS232 (thanks to a microcontroller)

Here, in this forum, I have found some examples and answers. It's great.

Now, I can properly receive my datas and display them in a chart.

 

However, I still have two problems. That's why, I have decided to create this new topic.

So my problems are :

 

- When I stopped my VI, the last received value is 'recorded'. I mean when I read the new sent datas in another acquisition, the chart diplays the last value of the previous chart.

How can I fix that ?

I took a screenshot (Look the blue plot, the chart begins with a value around 5 instead 0 )  

 

- In a chart, the X-Axis is named 'Time'. 

I would like to display received values every second on LabView.

How can I do that ? 

 

 

Thanks for your help ! 

Download All
0 Kudos
Message 1 of 6
(2,538 Views)

Hi Stuart,

 

1) Did you check (using probes) what you receive from your RS232-attached device? Does it send those leading "5"?

 

2) How often do you read new data values per second? How often does your device send new values? When it assures a contant sample rate all you need to do is change the scaling/offset of your charts. Otherwise you need to put the measurement data into waveforms (with proper t0) and plot them in your charts…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,531 Views)

Stuart51 wrote:

- When I stopped my VI, the last received value is 'recorded'. I mean when I read the new sent datas in another acquisition, the chart diplays the last value of the previous chart.

How can I fix that ?

I took a screenshot (Look the blue plot, the chart begins with a value around 5 instead 0 )  


How does the microcontroller know to stop sending data?  What is likely happening is the data was sent by the microcontroller before you closed the port.  So the data was sitting there in the serial buffer.  You could use the VISA Clear to clear out the buffer after you open the port.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 6
(2,517 Views)

Hi ! 

 

Thanks you both !

I will try to anwser your question.

 

1) Actually, I run my microcontroller. It is sending somes datas.

After a while (when I think it is enough so it is not at a regulary time), so it , I suddenly stopped running the microcontroller (with IDE MPLAB). 

The last sent value in LabView is '5' for my application.

 

If I used a probe, it should display the value is 0 (because I stopped sending datas).

 

 

I have noticed two things :

- if I click on 'clear chart', the plot is erased. But the digital values (next to the chart displays the last value '5'). That's why, when I start again, it begins with this value.

- If I erase or overwrite memory from my microcontroller, it works. The digital values turn into 0 and everything is right.

 

2) I program my microcontroller to send some datas every second (it is a PIC actually).

However, when I monitor the watch, I have the feeling that something is wrong. It displays new values too fast.

 

//When it assures a contant sample rate all you need to do is change the scaling/offset of your charts. 

 Indeed, it assures a contant sample rate

==> How can I define the scale/offset ? 

 

//you need to put the measurement data into waveforms (with proper t0) and plot them in your charts…

==> How can I define t0 ? What have you in your mind ? 

 

//What is likely happening is the data was sent by the microcontroller before you closed the port. 

I am not sure because I stopped first the microcontroller and after Labview.

How can I use in my case the Visa Clear to clear ? 

 

Thanks

 

 

 

0 Kudos
Message 4 of 6
(2,485 Views)

I have made more tests for my second problem.

It seems that  '240 s' from my chart in LabView is equal to '50 s' from my PIC. 

 

Thanks for your help

0 Kudos
Message 5 of 6
(2,478 Views)

Alright, I have found.

Mea culpa, I have used a wrong rate in my code.

Now, I can send every second. It is great

 

I am working on my first problem, now.

Message 6 of 6
(2,446 Views)