Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

USB PIC

Hi there,

 

I have already successfully managed to communicate between LabVIEW 7.1 and my PIC18F2450, currently Im just using standard  VISA Read and VISA write functions. I send a request to the microcontroller and immediately afterwards it sends me back around 10-20 bytes of data. That all works fine,

but now I would like to setup a more advanced system. I would like to sample a sine wave with the PIC's A/D converter and display this data  real-time in a LabVIEW VI.

Now I have two ideas on how to do this. I can either send packets of around 100 bytes at a time frequently, or else I can continuously send single bytes immediately after I have sampled the A/D, which one is the better solution and which is the most suitable VISA Control to handle this kind of interrupt ?

 

If anyone has any suggestions I'd be glad to hear about them.

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

Hi eoin87,

 

Glad to hear you've got the initial communication working between the PIC and your VI. If you are looking to sample sine waves using this method, the optimisation would be dependant on the frequency of the input. For higher frequencies, you should send packets of bytes at a time like you say, but for very low frequencies continuously sending single bytes will be fine, considering LabVIEW would be able to finish all the background processes without losing data.

 

You can read the input of the transmission into a shift register. For example, if you are sending packets of 100 bytes, you may want to have your shift register hold 1000 bytes before you start updating the display. This is where your display may be off-real-time. However, if you want to update your display closer to real-time, you must either use a small packet size, or send single bytes. If you have to include a header with every transmission, sending single bytes or small packets may not suit the application though. The best method is to try some scenarios to find the optimal packet size for transmitting.

 

In the NI Example Finder (Help menu -> Find Examples) search for serial, and you will find Basic Serial Write and Read.vi. This example is very good for showing the basics of communication using VISA, and the VI is set up so that you can customise the following settings: baud rate, data bits, parity, stop bits, flow control, and delay.

 

I hope that my input is helpful to you.

Regards,


Imtiaz Chowdhury
Project Manager
Green Running / Austin Consultants

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

Hi Eoin,

Would you post your LABVIEW Vi that you used to read and write from PIC?

Waleed El-Badry MSc.,MCPD, ISTQB Certified Tester
Assistant Lecturer
Mechatronics Department
Faculty of Engineering
Misr University for Science & Technology



View Waleed El-Badry's profile on LinkedIn

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

Hi Eoin,

Would you post your LABVIEW Vi that you used to read and write from PIC?

Waleed El-Badry MSc.,MCPD, ISTQB Certified Tester
Assistant Lecturer
Mechatronics Department
Faculty of Engineering
Misr University for Science & Technology



View Waleed El-Badry's profile on LinkedIn

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