PDA

View Full Version : ADC Display - Plz help



computer guy
09-13-2007, 03:59 PM
How would I display the results of 2 adc inputs in an x,y box. Like in the windows joystick calibration wizard. (Picture of concept below).

http://forums.parallax.com/attachment.php?attachmentid=49287

Thank you http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller robot.tmcp.com.au (http://robot.tmcp.com.au)
If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
anthonybmyatt@yahoo.com.au (mailto:anthonybmyatt@yahoo.com.au)

Graham Stabler
09-13-2007, 05:47 PM
Have a look at the graphics demo, you can draw boxes easily enough and could define the cross as a sprite (lust like the little dogs that go around in a circle) or as two lines.

Everything else is just a matter of scaling your ADC to match the the dimensions of the box

Graham

computer guy
09-13-2007, 08:21 PM
I am not the best at graphics with the propeller. In fact I have never used the graphics capabilities before.
If someone could write a program for me that would be great.

My input goes from 0v to 5v. vref is 5v.

0v should be left. 5v should be right.
0v should be down. 5v should be up.

Thank you http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller robot.tmcp.com.au (http://robot.tmcp.com.au)
If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
anthonybmyatt@yahoo.com.au (mailto:anthonybmyatt@yahoo.com.au)

Graham Stabler
09-13-2007, 08:42 PM
Yes I'm sure it would be great....

It won't take you five minutes to work out how to do this, look:

gr.box(60,-80,60,16)

That is from the graphics demo, do you need to be the best at graphics to use that function?

The other functions are similarly simple you don't need to know anything about video just look at the demo and read the descriptions in the object.

Come on you can do it!

Graham

computer guy
09-14-2007, 02:51 PM
Its just the positioning of the marker that I am worried about. The maths side of it really.

Thank you http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller robot.tmcp.com.au (http://robot.tmcp.com.au)
If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
anthonybmyatt@yahoo.com.au (mailto:anthonybmyatt@yahoo.com.au)

deSilva
09-14-2007, 03:21 PM
A can assure you that you will need nothing but addition, subtraction, multiplication and division.

In rare cases you could need a check for smaller than, equal to, or greater than...

computer guy
09-14-2007, 03:51 PM
Yea but how do I get the binary reading from the adc chip. and work out that 2.5v is half the monitor width (i.e. center)?

Thank you http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller robot.tmcp.com.au (http://robot.tmcp.com.au)
If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
anthonybmyatt@yahoo.com.au (mailto:anthonybmyatt@yahoo.com.au)

Graham Stabler
09-14-2007, 03:57 PM
Computer guy,

Get it coded up to the point where you just need the mathematics and then I'm sure we can help.

But its really just a matter of scaling, you have a position on the screen that is the centre of the box, to that you have to add or subtract a scaled version of your voltage. Remembering that it should add half the width of the box when the voltage is full scale.

Of course when the voltage is 5v the number you have might be 255 for an 8bit ADC or more if you have more bits. If your box was 50 wide then it would be easy just divide the 255 by 10 so when the voltage is 5v you are adding 25 to the central position of the box which is half the width of the box.

So I've sort of told you how to do it but not quite, have a go. The nice thing is that with a graphical output you can see what is going on and guess what the problems might be.

Good luck

Graham

Graham Stabler
09-14-2007, 04:04 PM
Actually it will be easier to work from one corner of the box, again scale the voltage and add it to that position, when at full scale the scaled number should equal the width/height of the box.

Graham

computer guy
09-17-2007, 03:08 PM
Thank you. All works great. http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller robot.tmcp.com.au (http://robot.tmcp.com.au)
If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
anthonybmyatt@yahoo.com.au (mailto:anthonybmyatt@yahoo.com.au)

Graham Stabler
09-17-2007, 04:53 PM
Brilliant!

Well done!