Shop OBEX P1 Docs P2 Docs Learn Events
ADC Display - Plz help — Parallax Forums

ADC Display - Plz help

computer guycomputer guy Posts: 1,113
edited 2007-09-17 08:53 in Propeller 1
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).

attachment.php?attachmentid=49287

Thank you smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller 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
222 x 234 - 2K

Comments

  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-09-13 09:47
    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 guycomputer guy Posts: 1,113
    edited 2007-09-13 12:21
    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 smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller 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
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-09-13 12:42
    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 guycomputer guy Posts: 1,113
    edited 2007-09-14 06:51
    Its just the positioning of the marker that I am worried about. The maths side of it really.

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller 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
  • deSilvadeSilva Posts: 2,967
    edited 2007-09-14 07:21
    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 guycomputer guy Posts: 1,113
    edited 2007-09-14 07:51
    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 smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller 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
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-09-14 07:57
    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 StablerGraham Stabler Posts: 2,507
    edited 2007-09-14 08:04
    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 guycomputer guy Posts: 1,113
    edited 2007-09-17 07:08
    Thank you. All works great. smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller 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
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-09-17 08:53
    Brilliant!

    Well done!
Sign In or Register to comment.