Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview and Microcontroller interfacing

Hi. I have written a simple program for my microcontroller so that when character A is sent, one of the output ports turns high. I am trying to establish a serial communication between microcontroller and labview using "Basic serial Read and Write.vi" and DB9 serial port. I have checked the serial commutation using loop-back test with labview and i am able write and read the characters over serial communication, but still my microcintroller is not responding when i try to write certain string character. Labview is not displaying any error. NI- VISA is working fine. Is there any limitation in using microcontroller? or i have to use specific microcontroller for this purpose? Please help.
0 Kudos
Message 1 of 7
(7,929 Views)

A UART serial port is a UART serial port.  It doesn't matter what you are talking to, as long as both sides are using the same configuration and your wiring is done correctly.

 

Make sure you have the same baud rate and the other settings the same in both LabVIEW and your microcontroller.  After that, check your wiring.  Then start looking at your microcontroller code.


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 2 of 7
(7,925 Views)
I sent string characters serially using "Basic Serial and read and Write.vi" and then received them correctly in matlab GUI on my other system. Also loop-back test shows that there is no problem with my serial communication. Some tips regarding communication with microcontroller? Please help.
0 Kudos
Message 3 of 7
(7,912 Views)
A loopback test is pretty worthless. It does not tell you if your com parameters are correct, the cable is correct, or the command is correct. A VISA Write without an error is equally meaningless. You could have nothing connected and not get an error. We have no idea what you are actually sending or how you have programmed the micro. Instead of wasting time trying to write to a matlab program, try a standard terminal emulation program (hyperterminal, putty, MAX, etc) to debug your communication. Once that works, then you can write your own code.
0 Kudos
Message 4 of 7
(7,907 Views)

The only thing needed here is keep your protocol simple and clear.

Something you should worry about is sending an acknowledgement (1 byte) or NOT acknowledgement (ack and nack) so that the sender knows that something is received that is understandable or that something is wrong.

In case of no ack and no nack you can expect that there is no communication.

Furthermore. send this (ack/nack) immediately when the message is understood or not understood, meaning that an error in executing the command must be handled in another way.

Maybe by returning error code possibly with a detailed explanation because there is plenty of time in case of an error and clear ommunication solves that in the fastest way.

greetings from the Netherlands
0 Kudos
Message 5 of 7
(7,889 Views)

How is your hardware interfaced? When I have done this in the past, I had to use a converter such as the MAX232 to convert the microprocessor 0-5V to +/-V found in computer serial ports.

0 Kudos
Message 6 of 7
(7,824 Views)

hi if you are working with a microcontroller such 18F45550 this has a UART port can be directly connected, these outputs are specifically pins 25, 26 (Tx-Rx), these pin serial communication can be used for asynchronous transmission, the output these pins you can connect any USB-RS232 converter to connect to the computer.

Bearing this in mind when installing the converter please verify COM port is installed in the device manager, the same port must be the same as configured in your LabVIEW program (velicidad, bits, parity, etc.) to avoid any configuration error

0 Kudos
Message 7 of 7
(7,553 Views)