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.

Are you looking for something like the attached?

There are 16 Digital inputs available from the Cypress under Enhanced Mode on the Driver Station.

CheckAnalog.jpg


CheckAnalog.jpg

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! :slight_smile: Gonna look messy though (:mad:)

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?

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

Clipboard 1.png


Clipboard 1.png

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.

Analog-Boolean Converter.vi (5.39 KB)


Analog-Boolean Converter.vi (5.39 KB)

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/ControlSystem2009-/CypressPinout.jpg

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?

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

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?

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

Clipboard 1.png


Clipboard 1.png

Gee thanks, but it doesn’t work.:mad:

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

So how will the CONFIG tell the INPUT to change its domain of values?

digital input front panel.jpg




digital input front panel.jpg

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!:o

Would you accept a virtual hug of graditude from me?:wink: Thanks a lot!

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:eek: 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?:confused:

You need to make any and all controls changes the permanent default by clicking on:Edit -> Make Current Values DefaultYou can also click on individual controls and make just one or a couple change, instead of all of them.

That’s so you can play all you want with the controls, but you won’t destroy the original settings until you really want to.

If I understand you correctly, that’s a problem with the default value of the cluster. Set the cluster to have the values you want it to retain, then right click on it and under Data Operations, choose Make Current Value Default. LV should then retain that data for the cluster.
Capture.jpg

Capture.jpg


Capture.jpg

And my Qs are A’ed.

Thanks, sanity has (almost) been restored!:smiley:

If only there was such a clear-cut answer for game hints…:confused: