Advertisement
Guest User

TP1 clignotement V2

a guest
Oct 30th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<p18F4550.inc>
  2.  
  3. count1 equ H'00' ; count1 address
  4. count2 equ H'01' ; count2 address
  5.    
  6. res_vect code 0x0000 ; processor reset vector
  7.     goto prog_start ; go to the beginning of program
  8.    
  9. main_prog code ; let linker place main program
  10.  
  11. init
  12.     goto main_loop
  13.    
  14. not_pressed
  15.     btfss PORTD , RD0
  16.     goto not_pressed
  17.     goto pressed
  18.    
  19. pressed
  20.     btfsc PORTD , RD0
  21.     call main_loop
  22.     goto pressed
  23.    
  24. prog_start
  25.     clrf TRISC ; set PORTC as output
  26.     clrf PORTC ; clear PORTC
  27.     goto not_pressed
  28.    ;goto main_loop
  29.    ;goto not_pressed
  30.  
  31.    
  32. main_loop
  33.     bsf PORTC, RC0 ; put RC0 on 1 (LED ON)
  34.    ;incf PORTC
  35.     call my_delay ; wai
  36.     bcf PORTC, RC0 ; put RC0 on 0 (LED OFF)
  37.    ;incf PORTC
  38.     call my_delay ; wait
  39.     goto not_pressed
  40.  
  41. my_delay
  42.     decfsz count2
  43.     goto my_delay
  44.     decfsz count1
  45.     goto my_delay
  46.     return
  47.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement