LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to establish serial communication between Labview and Arduino Duemilanove board

This is the kind of thing you should be able to debug on your own by now.

 

The example programs aren't intended to be the "end all be all" programs you should be using.  They are just demonstrations of how you can use the functions that they are trying to demonstrate.

 

What other VI's do you have working with this besides Advanced Serial Read/Write?  In that example, the write button is set up as "Switch action" which means it will continually be true until you actually unpress it yourself.  If you only want to write something once, then you should change it to "Latch action".

 

If you are using other VI's along with this, you'll have to post more information as to how you are using them.

Message 21 of 35
(5,378 Views)

yeah...

Its true.i was going to post a "NEVERMIND, got it" post, but you are a step ahead of me.

I found the solutions to my problem...

 

 

 

 

 

 

Message Edited by krispiekream on 04-13-2009 04:56 PM
Best regards,
Krispiekream
Download All
0 Kudos
Message 22 of 35
(5,368 Views)

Hi Guys:

 

I am able to access the Arduino using the Advanced serial*.vi. My arduino is programmed using bitlash (not arduino sketchbook). I need to query the status of digital i/o pins using bitlash commands. Any ideas how to do this in Labview.

 

Thanks

V

Message Edited by varun_s on 07-28-2009 07:17 PM
0 Kudos
Message 23 of 35
(5,098 Views)
I would think it's just a matter of figuring out the correct command to send to the device. Seems like you're already able to communicate with your device using the Advanced Serial example, so I'd try and find commands you need to get this info.
Justin E
National Instruments R&D
0 Kudos
Message 24 of 35
(5,020 Views)

I haven't used bitlash with an Arduino before, so I took this opportunity to try it out. First, I downloaded and installed bitlash-1.0rc2 in the Arduino's hardware directory. Then, I compiled  bitlash-demo.pde in the Arduino programming Environment and sent it to the Arduino via USB.

 

Getting comms established with the Arduino from LabVIEW was easy and I got the bitlash splash message right away. However, the Advanced Serial Write and Read.vi is very awkward for this kind of communications. If you don't know how big the message coming from the remote device will be. you have to wait until the read times out. If you didn't get all the message you'll have to go again to get it all. Sequencing the write and read commands manually is a pain.

 

Everytime you run this example, it reconfigures the port and bitlash restarts. A more versatile VI should initiate the port once, then enter a loop to either write to the port or read the number of bytes at the port and read them in a loop then wait for more bytes until the whole message has been recieved.  When you're done, close the port before the IV terminates.

 

Plus there are a couple of gotchas with bitlash:
* bitlash requires each command to end with a newline command (\n)
* When the serial port is configured, the default for Enable Termination Char is True. Reset this to false.

 

If you send "print d13 /n", the Arduino will answer back with the current value on the pin. The bitlash docs cover the commands and arguments to set the pins and read them. Sending "while 1:d13=!d13; snooze(100)(\n)" with cause the LED on d13 to flash. Control C will bring control back to the terminal.

 

At first glance, I think bitlash and LabVIEW together will be a powerful combination. If any one going to NI Week wants to meet to discuss possible apps, let me know here so we can organize something.

 

 

 

Message 25 of 35
(4,995 Views)

Hi John

 

Thanks for the information. I tried this and was mostly successfull, except when I type "print d13 \n" (without quotes) I just get this string back instead of the actual state (a bit value of 0 or 1). I cant seem to pinpoint the error here. 

I am attaching the screenshot of my vi bock diagram here, for reference. 

 

 

Regards

0 Kudos
Message 26 of 35
(4,956 Views)
It would be easier to troubleshoot if you posted the actual VI with your string saved as default in the control.  A picture of the block diagram doesn't show us much.  Is your string control in \codes display or normal display when you type that?  Are you actually sending the \n which means new line character (ASCII decimal 10 or hex 0A) or two separate characters of "\" and "n"?  Check your display settings to verify what you typed in actually is what you want to send.
0 Kudos
Message 27 of 35
(4,954 Views)

If the Arduino answers back with the exact text sent including the \n, you'll need to change the string display property for your "String to Write" control from Normal Display to  "\" Codes Display. 

 

 

0 Kudos
Message 28 of 35
(4,916 Views)

Hello !

Recently I did a proyect similar to yours.

Take a look at this.

http://www.youtube.com/watch?v=x1SD_Pag9ig

I don't know how are going your projects, but any questions I will try you to help you 

Regards, 

0 Kudos
Message 29 of 35
(3,749 Views)

Thanks  JohnCS!

 

That is what I needed to know!

0 Kudos
Message 30 of 35
(2,951 Views)