Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 16th, 2012  |  syntax: None  |  size: 1.38 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Programming 8255 over 16f84a
  2. bsf     PORTA,3                 ; activate 8255's reset pin
  3.             call jDelay
  4.  
  5.             bcf     PORTA,3                 ; deactivate 8255's reset pin
  6.  
  7.             movlw   b'00000001'                 ; Control byte for 8255 (B0->D7....B7->D0) /reverse of 10000000 (all set to output)
  8.             movwf   PORTB
  9.             movlw   b'00000011'                 ; mode 11 to write control register and also PortA.3-> 8255.WR (activate with 0 ,WR pin active-low)
  10.             movf PORTA                          ;portA.0->8255.A0&& portA.1->8255.A1
  11.  
  12.             call    jDelay                      ; Delay to write control byte
  13.  
  14.             bsf     PORTA,2                     ; Deactive Write pin of 8255 (Active-low , 1 deactivates)
  15.  
  16. main
  17.  
  18.  
  19.     movlw      B'10110110'       ; Digit value for 5
  20.     movwf       PORTB
  21.         movlw b'00000000'       ; mode 00 and activate WR pin
  22.         movwf PORTA             ; write to portA so -> 8255
  23.         call jDelay             ; Delay to write  byte
  24.         bsf     PORTA,2         ; Deactivate 8255's WR pin(active-low)
  25.  
  26.         Delay                   ;endless loop
  27.         goto Delay
  28.  
  29.         jDelay                   ; Delay loop
  30.         Loop3               decfsz              COUNT1,1
  31.                         goto Loop3
  32.                             decfsz              COUNT3,1
  33.                         goto Loop3
  34.  
  35.     return
  36. end