LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview + proteus + ccs

help me, please ! i'm connecting labview to MCU by virtual terminal . i use pic 16f887 to transmit data from MCU to labview, MCU transmit 12 datas regarded as 12 channels. but there are still errors. i simulate on proteus , write code on ccs.q3.pngq1.pngq1.pngq4.png

0 Kudos
Message 1 of 14
(6,763 Views)

Why are you using bytes at port?  That loop is running as fast as it can and just grabbing whatever bytes happen to be at the port, or even no bytes.  You are likely to have incomplete messages.

 

Does the device send a termination character?  Use that.  Just read a sufficiently large number of bytes and the VISA read will return the complete message once the termination character arrives.

0 Kudos
Message 2 of 14
(6,736 Views)

i think that the property bytes at port used to transmit datas which have big size, when i remove the property bytes at port, my code don't active and there is error.

0 Kudos
Message 3 of 14
(6,698 Views)

Is your problem solved?  You marked my post as the solution.  But then you say "and there is error".

 

Are you getting an error?  If so, give some details like the error number or description.

 

I'm confused by your last message.

 

Looking at your text based code, it looks like you aren't sending a termination character.  You are sending a literal backslash 'n' backslash 'r'.

 

You aren't sending a linefeed character (the default terminator for LabVIEW's configure serial port VI), which you send if you were doing a printf of chr$(10) or something like that.

 

 

0 Kudos
Message 4 of 14
(6,683 Views)

sorry, i pressed wrong, I still unsolved, i use printf("\n\r")(\n : new line, \r : carriage return) to create space between 2 datas because labview's program take three of the first number to check channel and next the number ( before excute printf("\n\r") ) is the value to display on waveform chart.
b[] is the array contain channels and a[] is the array contain values.
MCU send the value regarded as channel. (sorry i know a little english)

0 Kudos
Message 5 of 14
(6,665 Views)

But printf("\n\r") sends 4 characters.  The backslash, the letter n, the backslash, finally the letter r.  That is not the same thing as a new line feed character and a carriage return.

 

You should visit a forum that discusses C-based code to learn how to send the line feed and carriage return characters.

0 Kudos
Message 6 of 14
(6,627 Views)

sorry, i don't understand. i think printf("\n\r") command used to create distance between 2 channel, it don't influence labview's execution

0 Kudos
Message 7 of 14
(6,587 Views)

You still haven't said what error you are getting.

 

Yes "\n\r" separates some values, but they ARE NOT the carriage return or line feed termination characters.  (If that is what you mean by "create distance".

0 Kudos
Message 8 of 14
(6,580 Views)

you can see in the picture 2.
for example : the signal 2, MCU always send one value is 2 regarded as the channel 2 but sometime signal is 0. i don't know how to repair that error

0 Kudos
Message 9 of 14
(6,546 Views)

You will need to debug your own C code.

0 Kudos
Message 10 of 14
(6,524 Views)