Shop OBEX P1 Docs P2 Docs Learn Events
Converting the digital reading from ADC to a whole number — Parallax Forums

Converting the digital reading from ADC to a whole number

faisalfaisal Posts: 14
edited 2008-01-06 22:16 in BASIC Stamp
Hello,

I have just done the example in the basic analog and digital book regarding the ADC, it finds the analog input from the digital output by taking the remainders method and outputs to the degub screen by using the following code:

Display:
· DEBUG HOME
· DEBUG "8-bit binary value:· ", BIN8 adcbits

· DEBUG CR, CR, "Decimal value: ",DEC3 adcbits

·· DEBUG CR, CR, "volts: ",DEC1 v , "." , DEC2 v2

· RETURN

...

Instead of saying display v then display v2, is there a way to concatenate v and v2 to make it one variable instead of two?

Any help would be greatly appreciated.

Cheers

·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-06 22:16
    How about v = v * 100 + v2?

    This does what you're saying, but may not really be what you want.
    Note that v should be declared as a word for this to work for voltages
    greater than 2.55
Sign In or Register to comment.