Go to Post Reading the directions is as important as reading the manual. - the man [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 21-11-2011, 14:18
kws4000's Avatar
kws4000 kws4000 is offline
Team Mentor - Programming
AKA: Krazy Karl
FRC #2405 (Divided by Zero)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Fruitport, MI
Posts: 164
kws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the rough
Use/Conversion of Cypress Output Values

Good afternoon, yall.

Going back to LV this year after a short stint in C++ (even though I like C++ better). Trying to use the Cypress board on last year's bot with somewhat identical programming statements for purposes of education.

In C++, I extracted up to 12 Digital values for control of the arm, even though they were hooked up to the Analog pins. I want to do the same with LV, but I can only get 8 from the dedicated Digital I and 8 from the dedicated Analog IO.

I want to convert the Analog I into a usable boolean value for cascading logic statements. After poking around a little bit, I am thouroughly stumped.
__________________
Mentoring:
1) Educating students on the ability to learn and have fun at the same time.
2) Giving back to those who made you who you are.

2009-2011 Student 2405 Electrical/Programming & Asst. Captain
2012-???? Mentor 2405 Programming/Jack-of-all-Trades
Reply With Quote
  #2   Spotlight this post!  
Unread 21-11-2011, 14:35
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
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,795
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: Use/Conversion of Cypress Output Values

Are you looking for something like the attached?

There are 16 Digital inputs available from the Cypress under Enhanced Mode on the Driver Station.
Attached Thumbnails
Click image for larger version

Name:	CheckAnalog.jpg
Views:	59
Size:	7.4 KB
ID:	11107  
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 21-11-2011 at 14:37.
Reply With Quote
  #3   Spotlight this post!  
Unread 21-11-2011, 17:07
kws4000's Avatar
kws4000 kws4000 is offline
Team Mentor - Programming
AKA: Krazy Karl
FRC #2405 (Divided by Zero)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Fruitport, MI
Posts: 164
kws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the rough
Re: Use/Conversion of Cypress Output Values

I reckon that'll work, but I was kinda hoping there would be a single VI included in the pallete to automatically convert.

I'll just follow your advice using the Ratios instead of Voltage, seeing as how I don't want to drag out the multimeter, even though it is supposed to be a guarenteed 3.3V.

Thanks! Gonna look messy though ()
__________________
Mentoring:
1) Educating students on the ability to learn and have fun at the same time.
2) Giving back to those who made you who you are.

2009-2011 Student 2405 Electrical/Programming & Asst. Captain
2012-???? Mentor 2405 Programming/Jack-of-all-Trades
Reply With Quote
  #4   Spotlight this post!  
Unread 21-11-2011, 17:16
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Use/Conversion of Cypress Output Values

Quote:
Originally Posted by kws4000 View Post
I reckon that'll work, but I was kinda hoping there would be a single VI included in the pallete to automatically convert.
The "less than" function is a single VI. It will convert an analog value into a boolean one. If that's not what you're asking for, I don't understand your needs.

If you don't want the gratuitious "2.5" cluttering up the block diagram, you can easily make your own SubVI that takes a voltage input and produces a boolean output, and you can make its icon just large enough to have room for a single input and a single output.

Is there a reason you prefer not to take advantage of the additional digital inputs available in Enhanced Mode?
Reply With Quote
  #5   Spotlight this post!  
Unread 21-11-2011, 17:16
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Use/Conversion of Cypress Output Values

If you connect the cluster of 8 channels to a single < icon, as in Mark's picture, you can then unbundle the comparison results. Another useful trick is to convert clusters to array in order to be able to loop over them more easily with a loop.

Greg McKaskle
Attached Thumbnails
Click image for larger version

Name:	Clipboard 1.png
Views:	27
Size:	6.9 KB
ID:	11108  
Reply With Quote
  #6   Spotlight this post!  
Unread 21-11-2011, 17:40
kws4000's Avatar
kws4000 kws4000 is offline
Team Mentor - Programming
AKA: Krazy Karl
FRC #2405 (Divided by Zero)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Fruitport, MI
Posts: 164
kws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the rough
Re: Use/Conversion of Cypress Output Values

Well, thanks once again.

I did make my own sub-vi because I thought I would have to do each value one at a time. Oh well, there is someone out there that is smarter than me.

I am getting the Enhanced Values. It's just that in C++ I was able to over-read the analog for digital (if that makes any sense)

[ int boolvalue11 = dseio.GetDigital(11); ]

is what I did in C++ even though there should only be 1-8.

This all answers my questions.
Attached Files
File Type: vi Analog-Boolean Converter.vi (5.4 KB, 2 views)
__________________
Mentoring:
1) Educating students on the ability to learn and have fun at the same time.
2) Giving back to those who made you who you are.

2009-2011 Student 2405 Electrical/Programming & Asst. Captain
2012-???? Mentor 2405 Programming/Jack-of-all-Trades
Reply With Quote
  #7   Spotlight this post!  
Unread 21-11-2011, 18:42
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,563
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Use/Conversion of Cypress Output Values

Quote:
Originally Posted by kws4000 View Post
I am getting the Enhanced Values. It's just that in C++ I was able to over-read the analog for digital (if that makes any sense)

[ int boolvalue11 = dseio.GetDigital(11); ]

is what I did in C++ even though there should only be 1-8.

This all answers my questions.
Looking at your C++ code, I don't think you were "over-read"ing analog to get digital. I think you used the enhanced I/O to configure all 16 digital i/o to inputs and used the enhanced IO to read them.

What pin did you connect your switch 11 to? I think you connected it to P6_6. If it was analog 3, it would have been P0_2. http://team358.org/files/programming...ressPinout.jpg

Last edited by Joe Ross : 22-11-2011 at 16:34.
Reply With Quote
  #8   Spotlight this post!  
Unread 22-11-2011, 16:27
kws4000's Avatar
kws4000 kws4000 is offline
Team Mentor - Programming
AKA: Krazy Karl
FRC #2405 (Divided by Zero)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Fruitport, MI
Posts: 164
kws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the rough
Re: Use/Conversion of Cypress Output Values

Alright, now that I have the hardware in front of me instead of a spanish textbook.....

I reconfigured the Digital Output into Digital Input on the DS I/O tab.

Well, I just found the SetEnhancedDigitalConfig VI, which I think will allow me to tinker around with it. So, how do I program this little thingamajigger?
__________________
Mentoring:
1) Educating students on the ability to learn and have fun at the same time.
2) Giving back to those who made you who you are.

2009-2011 Student 2405 Electrical/Programming & Asst. Captain
2012-???? Mentor 2405 Programming/Jack-of-all-Trades
Reply With Quote
  #9   Spotlight this post!  
Unread 22-11-2011, 16:56
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Use/Conversion of Cypress Output Values

The config VI you mentioned has help that explains its purpose ...

"This VI returns sets the mode of each digital channel. All 16 channels can be inputs with configurable pull up/down resistors and can be driven as outputs. Some channels have additional capabilities as listed in the mode ring. Additionally, this VI configures the PWM and encoders for the I/O device connected to the driver station."

You have the choice of doing the configuration using the dialog on the DS, or on the robot's code, whichever you think will be more predictable. You can also reconfigure during the match, via the robot code, but that would be unexpected.

The other VIs in the palette allow you to configure the other types of I/O and set/get the various values.

It is a dense little thingy, so feel free to ask questions if you have them.

Greg McKaskle
Reply With Quote
  #10   Spotlight this post!  
Unread 22-11-2011, 17:16
kws4000's Avatar
kws4000 kws4000 is offline
Team Mentor - Programming
AKA: Krazy Karl
FRC #2405 (Divided by Zero)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Fruitport, MI
Posts: 164
kws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the rough
Re: Use/Conversion of Cypress Output Values

Dense little thingy indeed.

How would I set the Digital Mode? Looks like I have to bundle a cluster with values attached to it, but what values?

Also, would setting the Digital Mode for [9-16] to Input instead of Output allow me to extract more from the GetEnhancedDigitalInput VI?
__________________
Mentoring:
1) Educating students on the ability to learn and have fun at the same time.
2) Giving back to those who made you who you are.

2009-2011 Student 2405 Electrical/Programming & Asst. Captain
2012-???? Mentor 2405 Programming/Jack-of-all-Trades
Reply With Quote
  #11   Spotlight this post!  
Unread 23-11-2011, 15:08
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Use/Conversion of Cypress Output Values

Quote:
Originally Posted by kws4000 View Post

How would I set the Digital Mode? Looks like I have to bundle a cluster with values attached to it, but what values?

Also, would setting the Digital Mode for [9-16] to Input instead of Output allow me to extract more from the GetEnhancedDigitalInput VI?
Setting the digital mode is done with the Enhanced Set Digital Config VI. As with lots of WPILib, if the summary description doesn't make sense, the most obvious way to determine how it works is probably to open its panel. The attached image shows that there are sixteen selectors with options generally of Input (high, low, or floating), Output, and sometimes other functions such as PWM (first four channels), or Analog comparator (last two channels). If you right click on the terminal of the original icon and create a control or constant, it will bring along all of those enum selectors. You can also copy/paste it to the calling diagram. As mentioned in the other post, you can also do this once on a DS, and it will save the settings to its ini file and use them the next time. If you have a shared DS, the robot config may make more sense, but otherwise, I'd probably do the DS, since it is the closest to the Cypress board and the rest of the driving switches, etc.

To extract data from the digital inputs, you use the Get Enhanced Digital Input VI, and it returns an array of sixteen values. There can be up to sixteen inputs. If you haven't configured a pin to be an input, then the value for that position is not all that useful and may in fact be misleading.

Greg McKaskle
Attached Thumbnails
Click image for larger version

Name:	Clipboard 1.png
Views:	15
Size:	20.8 KB
ID:	11119  
Reply With Quote
  #12   Spotlight this post!  
Unread 24-11-2011, 22:42
kws4000's Avatar
kws4000 kws4000 is offline
Team Mentor - Programming
AKA: Krazy Karl
FRC #2405 (Divided by Zero)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Fruitport, MI
Posts: 164
kws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the rough
Unhappy Re: Use/Conversion of Cypress Output Values

Gee thanks, but it doesn't work.

I got the CONFIG good.
The INPUT array only returns from 0-8.

So how will the CONFIG tell the INPUT to change its domain of values?
Attached Thumbnails
Click image for larger version

Name:	digital input front panel.jpg
Views:	10
Size:	51.9 KB
ID:	11120  Click image for larger version

Name:	digital input.jpg
Views:	18
Size:	73.8 KB
ID:	11121  
__________________
Mentoring:
1) Educating students on the ability to learn and have fun at the same time.
2) Giving back to those who made you who you are.

2009-2011 Student 2405 Electrical/Programming & Asst. Captain
2012-???? Mentor 2405 Programming/Jack-of-all-Trades
Reply With Quote
  #13   Spotlight this post!  
Unread 25-11-2011, 08:00
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Use/Conversion of Cypress Output Values

Quote:
Originally Posted by kws4000 View Post
The INPUT array only returns from 0-8.
The Array To Cluster function creates a cluster of 9 elements by default. Right-click on it and select Cluster Size... from the popup menu to change it to 16.
Reply With Quote
  #14   Spotlight this post!  
Unread 25-11-2011, 12:02
kws4000's Avatar
kws4000 kws4000 is offline
Team Mentor - Programming
AKA: Krazy Karl
FRC #2405 (Divided by Zero)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Fruitport, MI
Posts: 164
kws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the rough
Re: Use/Conversion of Cypress Output Values

Quote:
Originally Posted by Alan Anderson View Post
The Array To Cluster function creates a cluster of 9 elements by default. Right-click on it and select Cluster Size... from the popup menu to change it to 16.
FACEPALM! Ok, it wasn't that obvious, but hey, the devil's in the details!

Would you accept a virtual hug of graditude from me? Thanks a lot!
__________________
Mentoring:
1) Educating students on the ability to learn and have fun at the same time.
2) Giving back to those who made you who you are.

2009-2011 Student 2405 Electrical/Programming & Asst. Captain
2012-???? Mentor 2405 Programming/Jack-of-all-Trades
Reply With Quote
  #15   Spotlight this post!  
Unread 05-12-2011, 13:53
kws4000's Avatar
kws4000 kws4000 is offline
Team Mentor - Programming
AKA: Krazy Karl
FRC #2405 (Divided by Zero)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Fruitport, MI
Posts: 164
kws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the roughkws4000 is a jewel in the rough
Unhappy Re: Use/Conversion of Cypress Output Values

Okay, now I have a realitively big issue that is not stopping me any, but may be an issue in the future.

In the Teleop VI, with the Set Enhanced Digital Config VI, with the Enum Cluster pulled out as a control to the Front Panel of the Teleop VI, the values continioulsy reset after I close the Teleop VI after I am done with it.

Is this an error with LV, or something hardwired in the Set Config VI that I don't want to mess around with?
__________________
Mentoring:
1) Educating students on the ability to learn and have fun at the same time.
2) Giving back to those who made you who you are.

2009-2011 Student 2405 Electrical/Programming & Asst. Captain
2012-???? Mentor 2405 Programming/Jack-of-all-Trades
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 09:26.

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