NI Home > Community > NI Discussion Forums

LabVIEW

Showing results for 
Search instead for 
Do you mean 
Reply
Member
Nick26
Posts: 21
0 Kudos

UART Communication with Microcontroller using Labview & USB 6509

Hello,

My requirement is to have Communication between tester(PC) and microcontroller via synchronous, serial interface. The tester(PC)
should receive one Byte from the microcontroller, with each Byte transmitted by the tester as a continues loop. Only the message(data)
should be able to change and the micocontroller should respond accordingly. I plan to do this via UART communication.

 

I have ordered USB 6509 DIO hardware for the above requirement. I have Labview 8.5 Full Development SW.

 

Please suggest how can I implement the communication part for the above?

 

Readily available Vi's are also appreciated.

 

Thanks and regards,

 

 Nick

 

 

Trusted Enthusiast
Coq_Rouge
Posts: 2,187
0 Kudos

Re: UART Communication with Microcontroller using Labview & USB 6509

Why not standard labview serial communication?


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Knight of NI
Dennis_Knutson
Posts: 33,702
0 Kudos

Re: UART Communication with Microcontroller using Labview & USB 6509

The 6509 is not capable of performing RS-232 communication rates. Better cancel your order.

 

As mentioned, you can use the serial functions in LabVIEW. You would just need an inexpensive USB-RS232 adapter and possibly a level shifter, depending on the voltage inputs of the micro.

Active Participant
Michael_Munroe
Posts: 266
0 Kudos

Re: UART Communication with Microcontroller using Labview & USB 6509

The 6509 will work for synchronous serial communications at 0-5V, but it lacks the built-in timing and control functions required to decode a serial stream.  With built-in timing, a burst of serial data can be recorded and decoded by the PC.  With an external clock function, the uC could strobe the data into the dio buffer.

 

You might be able to overcome these limitations by using a slow bit rate and a clock line.  I suggest utilizing the "change detection" function of the 6509 to acquire data on one edge of the clock.  Implement a start and stop bit for syncronization and combine the bits into a byte.

 

Look at the reference design for I2C communications to get started:

http://zone.ni.com/devzone/cda/epd/p/id/6080

 

Michael Munroe, ABCDEF
Certified LabVIEW Developer, MCP
Create better code faster with Project Filter and Edit
Member
Nick26
Posts: 21
0 Kudos

Re: UART Communication with Microcontroller using Labview & USB 6509

 

Hello Everyone,

 

Thanks for the reply. Just for some additional Information I am using V850ES/Fx3 series microcontroller.

My requirement for byte sending & receiving is as follows.

 

Waveforms

I have installed the examples from the reference design and now am trying to implement them.

Thanks and regards,

 

Nick

 

 

Member
Nick26
Posts: 21
0 Kudos

Re: UART Communication with Microcontroller using Labview & USB 6509

Hello All,

 

I also would like to add that the microcontroller ports i am using are IO ports.

 

Thanks and regards,

 

Nick

 

Trusted Enthusiast
Coq_Rouge
Posts: 2,187
0 Kudos

Re: UART Communication with Microcontroller using Labview & USB 6509

Please resend your picture. I also have hunch that you have not reveal your actual question yet. The details so far have not been very informative. But generally speaking. Interfacing a a serial device in labview is an easy task on both sides. Especially  since you may write your own communication protocol. The hardest part in instrument communication is often to decode the protocol description:smileyvery-happy: 


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Member
Nick26
Posts: 21
0 Kudos

Re: UART Communication with Microcontroller using Labview & USB 6509

Hello,

 

You are correct I have to write my own communication protocol. The protocol is present on the microcontroller side (C Code), I have to implement in a similar way in Labview (Tester). As you can see from the attached waveforms the tester has to do the following:-

1) Send a Clock, 2) receive an clock echo, 3) send tester data out, 4) receive microcontroller data out.

 

As I have never implemented a serial comunication protocol, I am using this forum for all the help I can get. Earlier I was not sure of which protocol is to be implemented. But now I am sure I have to use SPI through USB 6509.

 

Please correct me if anything is wrong.

 

Thanks and regards,

 

Nick
Trusted Enthusiast
Coq_Rouge
Posts: 2,187
0 Kudos

Re: UART Communication with Microcontroller using Labview & USB 6509

Some years ago I have to do something similar. We wanted to do some simple data communication PC to CPU board for test purposes. We ended up taken a small and cheap micro-controller, which we interfaced to the CPU board. Then we used RS232 from the microcontroller to the PC. The whole setup required 2 circuits, and was soldered up on a prototype board. At the end of the day the project worked as we wanted. If you do not like soldering you may pick up a cheap microcontroller test board. The cost very little compeered to your NI IO unit (USB 6509). I am just passing this as an idea. It may not fit your need.By the way are you sure you do not have a free UART port on your CPU board you can use for your testing


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Member
Nick26
Posts: 21
0 Kudos

Re: UART Communication with Microcontroller using Labview & USB 6509

Hello t06afre,

 

Thanks for the suggestion, but we do not have a free UART port on our CPU & also we should be able to test the CPU in an industrial enviornment. So we had selected the NI USB 6509.

 

Thanks for all the support to all, I will update once I have completed with the software.

 

Regards,

 

Nick