|
|
|
| You infrared my mind. |
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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. |
|
#2
|
|||||
|
|||||
|
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. Last edited by Mark McLeod : 21-11-2011 at 14:37. |
|
#3
|
||||
|
||||
|
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 ( ) |
|
#4
|
|||||
|
|||||
|
Re: Use/Conversion of Cypress Output Values
Quote:
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? |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
||||
|
||||
|
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. |
|
#7
|
||||||
|
||||||
|
Re: Use/Conversion of Cypress Output Values
Quote:
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. |
|
#8
|
||||
|
||||
|
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? |
|
#9
|
|||
|
|||
|
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 |
|
#10
|
||||
|
||||
|
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? |
|
#11
|
|||
|
|||
|
Re: Use/Conversion of Cypress Output Values
Quote:
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 |
|
#12
|
||||
|
||||
|
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? |
|
#13
|
|||||
|
|||||
|
Re: Use/Conversion of Cypress Output Values
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.
|
|
#14
|
||||
|
||||
|
Re: Use/Conversion of Cypress Output Values
Quote:
Would you accept a virtual hug of graditude from me? Thanks a lot! |
|
#15
|
||||
|
||||
|
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? ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|