#include <p16F84A.inc>__CONFIG _WDT_OFF & _LP_OSC & _PWRTE_ON bsf STATUS,5 movlw 0x01 movwf TRISA movlw 0x00 movwf TRISB bcf STATUS,5START btfss PORTA,0 movlw 0x0f movwf PORTB btfsc PORTA,0 movlw 0xf0 movwf PORTB end
#include <p16F84A.inc>__CONFIG _WDT_OFF & _LP_OSC & _PWRTE_ON bsf STATUS,5 movlw 0x01 movwf TRISA movlw 0x00 movwf TRISB bcf STATUS,5START btfss PORTA,0 movlw 0x0f movwf PORTB btfsc PORTA,0 movlw 0xf0 movwf PORTB goto STARTend
#include <p16F84A.inc>__CONFIG _WDT_OFF & _LP_OSC & _PWRTE_ON bsf STATUS,5 movlw 0x02 movwf TRISA movlw 0x00 movwf TRISB bcf STATUS,5START movlw 0xff movwf PORTB call delay movlw 0x00 movwf PORTB call delaydelay movlw 0x85 movwf 0x08 decfsz 0x08 RETURNend
#include <p16F84A.inc>__CONFIG _WDT_OFF & _LP_OSC & _PWRTE_ON bsf STATUS,5 movlw 0x02 movwf TRISA movlw 0x00 movwf TRISB bcf STATUS,5START movlw 0xff movwf PORTB call delay movlw 0x00 movwf PORTB call delay goto STARTdelay movlw 0x85 movwf 0x08 decfsz 0x08 RETURNend
delay_2sec movlw .8 movwf 0x20 call msec decfsz 0x20,f goto $-2 returnmsec movlw .250nmsec movwf 0x21msecloop movlw .248 call micro4 nop decfsz 0x21,f goto msecloop returnonemsec movlw .249micro4 addlw h'ff' btfss status,z goto $-2 return
cblock 0x0Cdelay1delay2 endc org 0x00start.. call delay_routine....delay_routine loop decfsz delay1,f goto loop decfsz delay2,f goto loopreturnend
Code: [Select] cblock 0x0Cdelay1delay2 endc org 0x00start.. call delay_routine....delay_routine loop decfsz delay1,f goto loop decfsz delay2,f goto loopreturnend try mo nga to...
#include <p16F84A.inc>__CONFIG _WDT_OFF & _LP_OSC & _PWRTE_ON org 0x00 cblock 0x0C count1 count2 endc bsf STATUS,5 movlw 0x03 movwf TRISA movlw 0x00 movwf TRISB bcf STATUS,5START;if RA0 is high then do running lights btfsc PORTA,0 movlw 0x01 movwf PORTB call delay_routine rlf PORTB,1 call delay_routine movwf PORTB rlf PORTB,1 call delay_routine rlf PORTB,1 call delay_routine rlf PORTB,1 call delay_routine rlf PORTB,1 call delay_routine rlf PORTB,1 call delay_routine rlf PORTB,1 call delay_routine rlf PORTB,1 call delay_routine ;if RA0 is low then light up all led btfss PORTA,0 call delay_routine movlw 0xff movwf PORTBgoto STARTdelay_routine loop decfsz count1,f goto loop decfsz count2,f goto loopreturnend
Working na po! Gaano po katagal ito? Pano po pag gusto ko ng specified time
delay_routine loop decfsz count1,f goto loop decfsz count2,f goto loopreturn
((256*3)+3)*256 = 197376 instruction cycle
#include <p16F84A.inc>__CONFIG _WDT_OFF & _LP_OSC & _PWRTE_ON org 0x00 cblock 0x0C count1 count2 endc bsf STATUS,5 movlw 0x00 movwf TRISB bcf STATUS,5main movlw 0x80 movwf PORTB call delay_routine rrf PORTB,1 call delay_routine rrf PORTB,1 call delay_routine rrf PORTB,1 call delay_routine rrf PORTB,1 call delay_routine rrf PORTB,1 call delay_routine rrf PORTB,1 call delay_routine rrf PORTB,1 call delay_routine rrf PORTB,1 call delay_routinegoto maindelay_routine loop decfsz count1,0xff goto loop decfsz count2,0xff goto loopreturnend
#include <p16F84A.inc>__CONFIG _WDT_OFF & _LP_OSC & _PWRTE_ON cblock 0x0Ccount1count2 endc org 0x00 bsf STATUS,5 movlw 0x00 movwf TRISB bcf STATUS,5 movlw 0x80 movwf PORTBmain rrf PORTB,1 call delay_routine goto maindelay_routine loop decfsz count1,0xff goto loop decfsz count2,0xff goto loop returnend
#include <p16F84A.inc>__CONFIG _WDT_OFF & _LP_OSC & _PWRTE_ONorg 0x00cblock 0x0C count1 count2 endc bsf STATUS,5 movlw 0xff movwf TRISA movlw 0x00 movwf TRISB bcf STATUS,5main movlw 0x00 movwf PORTB btfss PORTA,0 goto sw1 btfss PORTA,1 goto sw2 btfss PORTA,2 goto sw3goto mainsw1;if RA0 is high then do running lights rlf btfss PORTA,0 movlw 0x01 movwf PORTB call delay_routine rlf PORTB,1 call delay_routine movwf PORTB rlf PORTB,1 call delay_routine rlf PORTB,1 call delay_routine rlf PORTB,1 call delay_routine rlf PORTB,1 call delay_routine rlf PORTB,1 call delay_routine rlf PORTB,1 call delay_routine rlf PORTB,1 call delay_routine btfsc PORTA,0 goto main goto sw1; ON OFF sw2 btfss PORTA,1 movlw 0xff movwf PORTB btfsc PORTA,1 goto maingoto sw2; running lights rrfsw3 movlw 0x80 movwf PORTB btfss PORTA,2 call delay_routine rrf PORTB,1 call delay_routine rrf PORTB,1 call delay_routine rrf PORTB,1 call delay_routine rrf PORTB,1 call delay_routine rrf PORTB,1 call delay_routine rrf PORTB,1 call delay_routine rrf PORTB,1 call delay_routine rrf PORTB,1 call delay_routine btfsc PORTA,2 goto maingoto sw3delay_routine loop decfsz count1,0xff goto loop decfsz count2,0xff goto loopreturnend