Pages: [1]   Go Down
Author Topic: read data from 2 pins of ardunio and use it in LABVIEW  (Read 1320 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello reader!
i have seen quite a few ppl read one pin using ardunio and displaying it in labview ...but is it possible to read 2 pins from the ardunio board and display their value in labview...if so, can u pls tell me how to do it and if someone has tried such thing can u pls send me the file.
thanks to all!
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 634
Posts: 34572
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
is it possible to read 2 pins from the ardunio board and display their value in labview.
Yes, lots of ways. Here is one:-
Two pins are just two bits so combine them like this
VlauetoSend = 0x30 | digitalRead(onePin) | (digitalRead(otherPin) <<1);
This generates an ASCII character of 0, 1, 2 or 3 depending on what the value on the two pins are.
Logged

"The old Europe"
Offline Offline
Edison Member
*
Karma: 1
Posts: 2005
Bootloaders suck!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Use the search function my friend! It has been talked about before.

And if you don't find it, use serial I/O with VISA (if that is still available in LV 8 - or whatever the version number happens to be today). There are VIs to set up the com port and equivalents to the .available() and .print() methods. Quite simple.
Logged

• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ya thax for the info but am new to the forum and completly new with interfacing labview and arduino
Quote
There are VIs to set up the com port and equivalents to the .available() and .print() methods

can u share with me how it is done .
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thax for the info mike!
Two pins are just two bits so combine them like this
VlauetoSend = 0x30 | digitalRead(onePin) | (digitalRead(otherPin) <<1);
This generates an ASCII character of 0, 1, 2 or 3 depending on what the value on the two pins are.
but i do not understand how this works ...it would be really helpfull if u could pls explain to me how it would work .
Logged

"The old Europe"
Offline Offline
Edison Member
*
Karma: 1
Posts: 2005
Bootloaders suck!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well... first take a look at the arduino examples. There is one that sends some data over the serial port. It is quite simple. Modify it so it sends something trivial, let's say a single letter like 'X'. You can check if it works with the IDE's serial monitor.

Then start labview, navigate to the example section and try to find Serial I/O. There's got to be an example. There were simple examples in LabView 7, so I doubt they removed those. Play with it. You know that it should receive the letter 'X'.

The best way to get started is learning by doing. Just reading manuals and looking at code won't do. I think I posted an image of the 'backplane' of some labview code that reads data from an arduino in the old forum. You should be able to find it. Search for 'Labview 7.0 Student edition' ;-)
« Last Edit: October 19, 2011, 10:04:48 am by madworm » Logged

• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 634
Posts: 34572
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but i do not understand how this works
Not sure how to answer that because that single line is how it works. That makes up an ASCII character that depends on the state of your input pins. To send that to labview all you need to do is to print it:-
Serial.print(ValueToSend, BYTE);
The labview will pick up a value from the serial port and that value will reflect the state of the two pins.

Once you have the receiving end going like madworm told you replace the sending X with the line I gave.
Logged

Pages: [1]   Go Up
Jump to: