Corrected RB port Sequencer
Hi All:
Here is corrected RB Port Sequencer.
I appereciate if you let me know how it
works in your compiler.
You can use this program for your tasks
only by changing values.
Regards,
Leonid
'PIC16F84A
Symbol PORTA = $05
Symbol TRISA = $85
Symbol PORTB = $06
Symbol TRISB = $86
'Symbol Period=10000
'Set Ports
poke TRISA, 255 '31
poke TRISB, 0
'Set constant
b1 = %01100100
b2 = %01101101
b3 = %01001001
b4 = %01011011
b5 = %01010010
b6 = %01110110
b7 = %01110110
b8 = %01010010
b9 = %01011011
b10 = %01001001
b11 = %01101101
b12 = %01100100
w7 = $2710
'Start analizing input
check:
peek PORTA, b0
'Bit0=0 Minus one step from W7
'Bit1=0 Plus one step to W7
'Bit2=1 Rotation Right
'Bit2=0 Rotation Left
'Bit3=0 Go
'Bit3=1 Stop
'Bit4
If bit3 = 0 Then task
Goto check
task:
peek PORTA, b0
If bit3 = 1 Then check
If bit2 = 0 Then rlft
If bit2 = 1 Then rrht
Goto task
rlft:
poke PORTB, b7
pulsout 7, w7
poke PORTB, b8
pulsout 7, w7
poke PORTB, b9
pulsout 7, w7
poke PORTB, b10
pulsout 7, w7
poke PORTB, b11
pulsout 7, w7
poke PORTB, b12
pulsout 7, w7
peek PORTA, b0
call minus
Goto task
rrht:
poke PORTB, b1
pulsout 7, w7
poke PORTB, b2
pulsout 7, w7
poke PORTB, b3
pulsout 7, w7
poke PORTB, b4
pulsout 7, w7
poke PORTB, b5
pulsout 7, w7
poke PORTB, b6
pulsout 7, w7
peek PORTA, b0
call minus
Goto task
minus:
If bit0 = 1 Then plus
w7 = w7 - 1
If w7 < $100 Then limm
Goto task
plus:
If bit1 = 1 Then task
w7 = w7 + 1
If w7 > $5000 Then limp
w7 = $5000
Goto task
limm:
w7 = $100
Goto task
limp:
w7 = $5000
Goto task
End