Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Use/Conversion of Cypress Output Values (http://www.chiefdelphi.com/forums/showthread.php?t=98374)

kws4000 21-11-2011 14:18

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.

Mark McLeod 21-11-2011 14:35

Re: Use/Conversion of Cypress Output Values
 
1 Attachment(s)
Are you looking for something like the attached?

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

kws4000 21-11-2011 17:07

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 (:mad:)

Alan Anderson 21-11-2011 17:16

Re: Use/Conversion of Cypress Output Values
 
Quote:

Originally Posted by kws4000 (Post 1086035)
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?

Greg McKaskle 21-11-2011 17:16

Re: Use/Conversion of Cypress Output Values
 
1 Attachment(s)
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

kws4000 21-11-2011 17:40

Re: Use/Conversion of Cypress Output Values
 
1 Attachment(s)
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.

Joe Ross 21-11-2011 18:42

Re: Use/Conversion of Cypress Output Values
 
Quote:

Originally Posted by kws4000 (Post 1086045)
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

kws4000 22-11-2011 16:27

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?

Greg McKaskle 22-11-2011 16:56

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

kws4000 22-11-2011 17:16

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?

Greg McKaskle 23-11-2011 15:08

Re: Use/Conversion of Cypress Output Values
 
1 Attachment(s)
Quote:

Originally Posted by kws4000 (Post 1086252)

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

kws4000 24-11-2011 22:42

Re: Use/Conversion of Cypress Output Values
 
2 Attachment(s)
Gee thanks, but it doesn't work.:mad:

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

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

Alan Anderson 25-11-2011 08:00

Re: Use/Conversion of Cypress Output Values
 
Quote:

Originally Posted by kws4000 (Post 1086514)
The INPUT array only returns from 0-8.:confused:

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.

kws4000 25-11-2011 12:02

Re: Use/Conversion of Cypress Output Values
 
Quote:

Originally Posted by Alan Anderson (Post 1086537)
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?;) Thanks a lot!

kws4000 05-12-2011 13:53

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


All times are GMT -5. The time now is 09:26.

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