LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Send graph information to RS232

Hello,  i found example "serial" in CVI example databse.

 

i have RS232 comport with loopback (i connected pin 2 to pin 3 on the serial port.)

 

I want to mod this program to send not text from the box, but send graph information to RS232, then get that information and plot the same graph with that information. (so there will be 2 graphs)

 

Things that i done so far:

Made a graph, now graph can generate a signal, but now im stuck on how to send it. Any tips?

 

i got few errors:  

NON-FATAL RUN-TIME ERROR: "serial.c", line 112, col 5, thread id 0x00001604: Library function error (return value == -46 [0xffffffd2]). The attribute passed is not valid

 

NON-FATAL RUN-TIME ERROR: "serial.c", line 496, col 5, thread id 0x00001604: Library function error (return value == -58 [0xffffffc6]). The control does not have a value

 

 

if i delete 112 line  then i can generate a graph.

 

added file.

 

0 Kudos
Message 1 of 4
(3,140 Views)

Please respond.

0 Kudos
Message 2 of 4
(3,127 Views)

Hello A Z,

please understand that it's weekend time now: there may be nobody reading the forum...

 

The errors you are founding depend on how you manipulated the example you started from: specifically, you cannot operate on a graph the same way you operate on a textbox (the original control): if you right-click on a control (e.g. the graph control on your panel) and select "Control help" from the context menu the online help will open on the specific page for the control; selecting Graph control attributes" you'll see the list of available attributes that can be manipulated for the given control; an attribute not included in that list will generate the error you are finding.

 

Given this, which exactly is the problem you want to solve? Sending an image of the graph or sending the raw data? Whichever is the case, you'll need to write a receiver program that reads data back from the serial port and shows them, but it will be different in either case.

It is normally better to send the raw data rather than the graph image: from the original data you can rebuild the graph but you can also perform some more operation like for example extracting a portion for a more detailed examination.

 

Since you are generating data inside the program you can write them down in a string (sprintf) and send the string over the serial channel like in the example you are starting from. The reciever will read the string and extract values with sscanf. If you are not likely to have the data available in memory in the sending routine you can retrieve them from the graph with GetPlotAttribute using ATTR_PLOT_XDATA and ATTR_PLOT_YDATA attributes. See the online help for those attributes to understand how to use them.

 

 

One last hint: when attaching code to a message you do not need to add neither cvibuild folder nor .cdb and .exe files: those elements are rebuilt when you run the project and are a waste in forum space.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 4
(3,123 Views)

Thanx, yes i want to send raw data. Now have to think how make a receiver program.

0 Kudos
Message 4 of 4
(3,116 Views)