problem getting value from INA
I wrote this routine, the serial portion works just fine. I'm having problems getting a value from an input pin. I don't think the problem is in the code, but I'll paste it below anyway. On the propeller board I have an input pin connected to ground with a 200 ohm resistor and a another 200 ohm resistor connected to 3.3V that I use to 'turn on' the input pin. On the serial monitor I keep getting 0's. And it's quite annoying.
(edit) -I have tried using smaller resistors on one or the other side, I know 200 across 200 ohms is going to give 1.15V
CON
_clkmode = xtal1 + pll4x
_xinfreq = 6_000_000
PUB Main
cognew(@IR,0)
Dat
org 0
IR
:initialization
or dira,tx
or outa,tx
:receive
waitpne rx,rx
mov time,delay
add time,cnt
waitcnt time,delay
:getData
test ina,dIn wc
if_c mov data,#49
if_nc mov data,#48
:readyData
mov tx_dat,data 'sample first byte of data
or tx_dat,#$100 'attach stop bit
shl tx_dat,#$1 'shift left to assign start bit
mov nBits,#10 'total number of bits for serial byte is equal to 10 - send that many
:txLoop
ror tx_dat,#1 wc
muxc outa,tx
djnz nBits,#:txLoop
jmp #:getData
dIn long $0000_8000
tx long $4000_0000
rx long $8000_0000
delay long 120
time res 1
data res 1
tx_dat res 1
nBits res 1
(edit) -I have tried using smaller resistors on one or the other side, I know 200 across 200 ohms is going to give 1.15V

Comments