Tiny 15 port read problem...

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm having troble reading port bits using SBIC and SBIS.
Hree is my setup code:-
CBI 0X17,0
CBI 0X17,1
CBI 0X18,0
CBI 0X18,1
SBI 0X17,2

This code works correctly.:-

iphi:

in temp, pinb ;
andi temp,$02
brne iphi ;wait while high

cbi portb,pb3 ;clear test bit

iplow:
in temp, pinb
andi temp,$02
breq iplow ;wait while low
sbi portb,pb3 ;gone back high
dec r19 ;is back low....
brne iphi ;get 8 bits
cbi portb,pb3 ;clear test bit
sbi portb,pb3 ;final test pulse
cbi portb,pb3

rjmp restart

If I substitute

iplow: in temp, pinb
andi temp,$02
breq iplow

with
iplow: SBIS pinb,pb2
rjmp iplow

It doesn't read the input and I don't get any test pulses.
What am I doing wrong?Do I need a pull up on the input?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

iplow: SBIS
rjmp iplow

That wouldn't even assemble, would it?

iplow:  SBIS PINB, PB1
        RJMP iplow

is what you want, I think.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thx, I'll try...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So simple.... Thanks for the fix.