
Untitled
By: a guest on
May 16th, 2012 | syntax:
None | size: 1.38 KB | hits: 17 | expires: Never
Programming 8255 over 16f84a
bsf PORTA,3 ; activate 8255's reset pin
call jDelay
bcf PORTA,3 ; deactivate 8255's reset pin
movlw b'00000001' ; Control byte for 8255 (B0->D7....B7->D0) /reverse of 10000000 (all set to output)
movwf PORTB
movlw b'00000011' ; mode 11 to write control register and also PortA.3-> 8255.WR (activate with 0 ,WR pin active-low)
movf PORTA ;portA.0->8255.A0&& portA.1->8255.A1
call jDelay ; Delay to write control byte
bsf PORTA,2 ; Deactive Write pin of 8255 (Active-low , 1 deactivates)
main
movlw B'10110110' ; Digit value for 5
movwf PORTB
movlw b'00000000' ; mode 00 and activate WR pin
movwf PORTA ; write to portA so -> 8255
call jDelay ; Delay to write byte
bsf PORTA,2 ; Deactivate 8255's WR pin(active-low)
Delay ;endless loop
goto Delay
jDelay ; Delay loop
Loop3 decfsz COUNT1,1
goto Loop3
decfsz COUNT3,1
goto Loop3
return
end