Hi,
Is there a simple way to invert the dta you want,ie
I have an input going from 5 volt to 0 volts, but I would like
the converted value to read 0 - 5 volts.
I have a Sunday Brain Block!
regards
Peter
Hi,
Is there a simple way to invert the dta you want,ie
I have an input going from 5 volt to 0 volts, but I would like
the converted value to read 0 - 5 volts.
I have a Sunday Brain Block!
regards
Peter
Pete
Depending on what you need...
T VAR BIT
B VAR BYTE
T = ~PORTB.0 ; Single pin
B = ~PORTB ; Invert Full Port
B = PORTB ^ %00000001 ; Read full port and invert bit 0
OR, if you meant Analog values, simply subtract the value from the highest possible A/D reading.
; --- For 8bit results ---
ADCIN 0, B
B = 255 - B
; --- For 10bit results ---
ADCIN 0, W
W = 1023 - W
<br><br>
Last edited by Darrel Taylor; - 21st August 2005 at 07:50.
DT
Darryl, your light helped!
Of course all waht you do is subract it from the highest number. as analogue 1024-value.
thks!
Peter
Pete
Make sure you use 1023, not 1024.
10bit values go from 0 to 1023<br><br>
DT
Bookmarks