Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

comunication between labview and a microcontroller

Hi everybody,
 
I want to comunicate labview with a microcontroller like the 16f84. I have the 7.1 version. I think in this version you must to use VISA to make comunications with hardware. With VISA you can read, write and pause the comunication, but i want to send signals to my microcontroller to modify parameters in real time. If someone know something about this please tell me. I only used labview for some mounths.
 
Thanks everybody.
 
David.
0 Kudos
Message 1 of 14
(5,593 Views)
If the micro has a serial port, then you can use VISA to read and write to it.

I'm not sure I understand what you mean by real time. Can you explain a little more. If you are using windows, you don't have real-time or dterministic operating system. The best you can hope for is about 1 msec resolution.
0 Kudos
Message 2 of 14
(5,581 Views)

Hi again,

I want to make a temperature control, and I want to make it with a microcontroller (16f84) and with labview. The microcontroller will control the temperature, its the most important part of the project. With the micro you can set the temperature, sensibility (error) etc., but i want to control all these options with labview too. This is: if a want to change the temperaure, I can change with the micro, but I want to change it with labview too. Can you give me an idea to make this?

Thanks a lot

 

David

 

 

 

 

 

 

 

 

 

 

 

 

 

0 Kudos
Message 3 of 14
(5,490 Views)

Are you talking about the PIC16F84?

I am not sure what is to be gained by using the PIC as an intermediary. I'd just use the LABVIEW to control the temperature directly whatever it is.

What is this temperature device the PIC is interfacing to?

Message Edited by nyc on 08-21-2006 09:39 AM

0 Kudos
Message 4 of 14
(5,485 Views)

yes, it's the pic16f84. And the device is a sensor that gives the temperature to the pic. Then, the pic gives the temperature to labview.

I can do it all with only labview I know, but its a project for the university.

 

Thanks a lot

 

David

0 Kudos
Message 5 of 14
(5,455 Views)
From the little I know of the PIC, they have I/O ports that I would imagine you need to read with LabVIEW.
0 Kudos
Message 6 of 14
(5,448 Views)
So your µC has a sensor, an output (PWM?) and the control algorithm (PID,TBH,... ) 
and you want to set parameters, read and display the sensor value with LabVIEW , right?
 
Easy communication: RS232 
Your µC will need a level shifter/driver for the RS232 (MAXIM/Linear/NS.... )  most µC already support RS232 look in the app notes and you can find code and shematics
Your PC need the VISA driver and an serial port (or an USB-RS232 'cable')
 
Now you have to define your protocol
baud rate, bits, parity, ...
checksum ?
echo?
push or pull or both 
commands?
Temp as ASCII value or HEX ?
 
You don't have to reinvent the wheel, browse manuals of commercial stuff, try to get the idea of the concept and prove what may fit your needs
 
And ...       follow YOUR IDEAS to improve !!  
 
AND ... KISS  (Keep it stupid simple)
 
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 ǝɥʇ'


0 Kudos
Message 7 of 14
(5,428 Views)

hi again,

I send with the microcontroller a value of temperature, and I receive ok with labview. But, when I send with labview the temperature, the micro only receives the first number. For example, I send 25, the micro receives 2. The problem is that I do the same with hyperterminal and works perfectly, receives the two numbers. I don't understand. Labview works perfectly in hyperterminal too.

Someone know why it happened?

Thanks a lot

David

P.D: I use the vi "basic serial write and read".

0 Kudos
Message 8 of 14
(5,366 Views)

what you need is a inter-byte-delay ....

Your µC cant read the bytes as fast as you are sending them.  If you type your values in hyperterminal, you already have that delay 😉

Send your values byte by byte with a short (2-5ms) delay or try a slower baudrate.

 

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 ǝɥʇ'


0 Kudos
Message 9 of 14
(5,362 Views)


Send your values byte by byte with a short (2-5ms) delay or try a slower baudrate.


The PIC is probably fast enough to handle this without having to introduce a delay, but you need to make sure that you are keeping your ISR as fast as possible.  I did this with a 8MHz PIC once, and didn't have any trouble receiving data at 9600 baud.  My ISR didn't do much more than read the byte and set a couple variables, so it was easily ready for the next byte.  I don't know what rate you are using, so if it is much higher than 9600 you may need to introduce the delay.
0 Kudos
Message 10 of 14
(5,281 Views)