Go to Post Genius is one percent inspiration and 99 percent perspiration, which is why engineers sometimes smell really bad. - Koko Ed [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-04-2011, 15:58
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 688
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: Arduino and LabVIEW

Well, we might be but not all that clever, especially when we're short on time. I'll have to check those possibilities, Eric. Where does the data wire(s) get connected? Right now I'm in the "one step back" mode (computer doesn't want to download to the Arduino), so it'll be a bit.

All I need is to send a single number to the Arduino, and it'll turn on some LEDs. Can I do it through a Digital IO (which sounds the simpliest method)? WPI_PWMSetValue.vi?

Just saw Adam's post: Yeah, it's not quite decorative LEDs, so thats out. Any of the LabVIEW I2C examples are good to look at? Or the serial?

Last edited by Roger : 02-04-2011 at 16:05. Reason: WizenedEE snuck in
Reply With Quote
  #2   Spotlight this post!  
Unread 02-04-2011, 17:57
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Arduino and LabVIEW

How big a number?

You can simply use the digital outputs on a sidecar to digital inputs on the Arduino to send a binary number.
You don't need a communications protocol to do that.

Maybe use one DIO to signal when the number has changed and should be read by the Arduino.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #3   Spotlight this post!  
Unread 02-04-2011, 19:12
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 688
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: Arduino and LabVIEW

Do you mean (for example) 4 DIOs sending a binary signal for 16 numbers? (And no, I don't have many numbers, but I can think of ways to expand that.) Just using the signal portion of the PWM wire, right? (The Keeper of the Numbers says we have 5 DIOs free for use.) Heh -- I had thought of that too, when we originally thought of using DIOs. It seemed too obvious to be true. Could it really be that simple? Thanks, Mark!

Of course, I spent the day trying to make connections on an older robot to test all this, and now discovered (after connecting all the dots, so to speak) that LabVIEW and the Arduino programming port don't play nice together. I am making a nice collection of laptops around me just to test this.
Reply With Quote
  #4   Spotlight this post!  
Unread 02-04-2011, 19:20
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Arduino and LabVIEW

Quote:
Originally Posted by Roger View Post
Do you mean (for example) 4 DIOs sending a binary signal for 16 numbers? (And no, I don't have many numbers, but I can think of ways to expand that.) Just using the signal portion of the PWM wire, right? (The Keeper of the Numbers says we have 5 DIOs free for use.) Heh -- I had thought of that too, when we originally thought of using DIOs. It seemed too obvious to be true. Could it really be that simple? Thanks, Mark!

Of course, I spent the day trying to make connections on an older robot to test all this, and now discovered (after connecting all the dots, so to speak) that LabVIEW and the Arduino programming port don't play nice together. I am making a nice collection of laptops around me just to test this.
Yes, if you're not doing a high volume of data, this is an easy and viable method.
__________________
-- Marshal Horn
Reply With Quote
  #5   Spotlight this post!  
Unread 02-04-2011, 19:41
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 688
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: Arduino and LabVIEW

Well we are talking about an Arduino. But no, just a signal to change lights.

Howsoever, I did see at FLR a team using an Arduino for sonar processing, but I don't know what kind of data they were sending back to the cRIO -- much more than I'm asking for, I'm sure. These little boards are fun to work with.
Reply With Quote
  #6   Spotlight this post!  
Unread 02-04-2011, 21:55
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 688
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: Arduino and LabVIEW

An update -- I have some LabVIEW code that sends a DIO true/false value depending on a button press, recieved by the Arduino on a digital pin, and blinks the light on the Arduino and also prints out the high/low value (simple test), slowed down to 1/2 second cycle. Currently I'm getting a semi-random highs/lows, even without pressing the button, which I'm guessing is LV's issue, not continually sending the true/false signal? Unfortunately, I lost my LV computer so I can't check it -- maybe I can schedule for a 3 am session?
Reply With Quote
  #7   Spotlight this post!  
Unread 02-04-2011, 21:58
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: Arduino and LabVIEW

If you haven't opened the IO port in your code, I think it may leave the signal pin floating. Does it work when you press the button, or does it ignore the button as well?
Reply With Quote
  #8   Spotlight this post!  
Unread 02-04-2011, 22:27
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 688
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: Arduino and LabVIEW

I think it's opened once in the Begin.vi (the computer got grabbed so I can't look at the code at the moment), and just referenced during the button pressing, and not open/send/closed each time.

There was no discernable difference when the button got pressed.
Reply With Quote
  #9   Spotlight this post!  
Unread 02-04-2011, 22:35
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: Arduino and LabVIEW

Consider the fact that a boolean on the PPC is 4 bytes. Also consider the fact that the Arduino uses little endianness. I am not sure about the PPC on the cRio, it might be a big endian, that might bring up some troubles.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
Reply With Quote
  #10   Spotlight this post!  
Unread 02-04-2011, 22:55
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 688
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: Arduino and LabVIEW

But aren't they both using an on/off electical signal to talk between them? Not code.

(Pay Per Click?)
Reply With Quote
  #11   Spotlight this post!  
Unread 02-04-2011, 23:03
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: Arduino and LabVIEW

Quote:
Originally Posted by Roger View Post
But aren't they both using an on/off electical signal to talk between them? Not code.

(Pay Per Click?)
Well, Boolean only takes up 1 byte (8 bits) in Arduino, the PPC uses 4 Bytes instead (the PPC registers are 32bits). Sending over a boolean from the PPC sends 32 bits of data. Now, considering that you can't fit 32 bits in a 8 bit register, you have to cut the extra data off using some bit manipulation. And the other problem I was pointing to was that the PPC usually are Big endian, but they can be bi (so it can be both, just not at the same time) that means the bits read from left to right, but the little endian reads right to left. So you need to do some switcharoos there.

So on the cRio a "true" would be represented as:
0000_0000_0000_0001B (if big endian)
0001_0000_0000_0000B (If little endian)
Note: I might be wrong about the above regarding the binary

on the Arduino, you need to just take the last 4 bits so it becomes:
0001B

Every microprocessors have millions and billions of transistors, they all use electrical signals.


Now, if there are any veterans here, feel free to rebuke me. I am a student, I make mistakes and then learn from them.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.

Last edited by davidthefat : 02-04-2011 at 23:11.
Reply With Quote
  #12   Spotlight this post!  
Unread 03-04-2011, 00:23
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: Arduino and LabVIEW

Setting a TRUE output on a DIO slot sends 5V of power down the wire. That's one bit, not 32. He's planning on using four DIO slots to send 4 bits of data to the arduino.

Just a note, you can put the PWM cable in sideways on the signal so you use two cables instead of four.

Can you put a multimeter on the slots? Can you post the arduino sketch?
Reply With Quote
  #13   Spotlight this post!  
Unread 04-04-2011, 21:53
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 688
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: Arduino and LabVIEW

It was this that got a train of thought starting:
Quote:
Originally Posted by Mark McLeod
Maybe use one DIO to signal when the number has changed and should be read by the Arduino.
Have one of the four lines be a "control" bit: start with 0 (no info forthcoming), switch to 1 for first group of data (the 3 other lines), pause, switch to 0 for second group of data, pause, switch to 1 for third group, pause, switch to 0 to end. (Obviously you could extend or contract this, as long as the last group is a 1, so to loop back to 0.) I could get 9 bits of info, but that didn't seem right. I may make that last bit a parity or check bit "some day". The "pause" would be long enough to read the pins and do one loop of code, but I was trying not to be too cross-dependent with timing. Even at 1/4 second per group, it would be only a second to transmit the info.

I had scribbled the Arduino and LabVIEW code in bed last night, and got half way thru it by the time I got back to the robot, but my lead programmer had different ideas (a piddly 16 numbers - pft! ), so we went his way. Still haven't tested that it really works, either way.
Reply With Quote
  #14   Spotlight this post!  
Unread 03-04-2011, 01:33
RoboMaster's Avatar
RoboMaster RoboMaster is offline
Alum, former programmer&co-captain
FRC #2472 (The Centurions)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Minnesota, Twin Cities
Posts: 268
RoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant future
Re: Arduino and LabVIEW

Quote:
Originally Posted by Roger View Post
Currently I'm getting a semi-random highs/lows, even without pressing the button...
This sounds VERY much like your pin is floating. This is not really a programming issue, but a wiring/electrical issue.

Watch this video, note why he uses the resistor. If you get it, good, otherwise, I'll explain:
Originally Posted by Roger
But aren't they both using an on/off electical signal to talk between them? Not code.

Yes and no. The cRIO will send out an on/off electrical signal, but the Arduino DIO pin does not "sense" "on or off." It senses 5v or Ground. If you hook it up to nothing (what you may call "off"), it will basically sense the voltage of the wire/air that it is connected to. Ever looked at a volt meter when you haven't yet hooked it up to a power source? It wanders all over the place. This is what your Arduino DIO pin is doing. It could be anything, high or low. You need to use a resistor to specifically connect the DIO pin to Ground when it isn't sensing a 5v from the cRIO DIO pin. This is called using a pull-down resistor (not to be confused with a pull-up resistor, but similar idea).

Do you have a mentor who is an electrical engineer or knows electronics? You should have him help you out. This concept is a little tricky, it took me a while to figure out. Before that I was thinking the same as you.
__________________
My engineering blog: noeticbrainwaves.blogspot.com

I'm not slacking, my code's compiling
...and I'm using LabVIEW

Last edited by RoboMaster : 03-04-2011 at 01:35.
Reply With Quote
  #15   Spotlight this post!  
Unread 03-04-2011, 04:08
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: Arduino and LabVIEW

I'm pretty sure the DIO ports on the C RIO are never left floating (at the very least not after they're initialized), so that doesn't make much sense. There's nothing in the datasheet about it, strangely enough, except that there's a 10K pullup already on it. Maybe that's not disconnected when it switches to output? That wouldn't make much sense though.

I'd say test continuity, and then go to voltage mode on your multimeter, and do one lead on ground and the other on the signal. If you get zero, put the first on 5V. If they're both zero, the pin in floating for whatever reason, if one is zero and the other is 5V, then it's something in the wiring/arduino.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 20:40.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi