![]() |
|||||||||||||||||
![]() |
|
Custom Search
Readers
comments
|
|||||||||||||||
16F84a Counting RA4 Input : output to single LEDsPIC 16F84A Assembler
solution...
Sponsored Links...
For the moment there are some problems in displaying comment text directly so I have re-created Colins entry here: PIC Assembler solution: ;Project: Count Inputs on RA4 List P = 16F84 #include <p16F84.inc> __CONFIG 1Bh ;_CP_OFF & _PWRTE_ON & _WDT_OFF & _RC_OSC fileA equ 20h fileB equ 21h swflag equ 25h ORG 0 ;Load the code at address 000 SetUp BSF 03,5 ;Select Bank1 MOVLW 10h ;Put 0001 0000 into W MOVWF 05 ;Load TrisA. Make RA4 input. Others output BCF 03,5 ;Select Programming area - Bank0 GOTO Main ;1mS delay _1mS decfsz fileA,1 goto _1mS retlw 00 ;100mS delay _100mS movlw 60h movwf fileB AA call _1mS decfsz fileB,1 goto AA retlw 00 Main CLRF swflag CLRF 05 ;Clear Port A Main1 CALL _1mS BTFSS 05,4 ;Test the input line GOTO Main2 btfsc swflag,0 ;first time? GOTO Main1 bsf swflag,0 bcf 05,2 ;turn off the third line bsf 05,0 ;turn on the first line goto Main1 Main2 btfss 05,0 ;Is first line ON and no input signal? GOTO Main1 CLRF swflag Main3 CALL _1mS BTFSS 05,4 ;Test the input line GOTO Main4 btfsc swflag,0 ;first time? GOTO Main3 bsf swflag,0 bcf 05,0 ;turn off the first line bsf 05,1 ;turn on the second line goto Main3 Main4 btfss 05,1 ;Is second line ON and no input signal? GOTO Main3 CLRF swflag Main5 CALL _1mS BTFSS 05,4 ;Test the input line GOTO Main6 btfsc swflag,0 ;first time? GOTO Main5 bsf swflag,0 bcf 05,1 ;turn off the second line bsf 05,2 ;turn on the third line goto Main5 Main6 btfss 05,2 ;Is third line ON and no input signal? GOTO Main5 GOTO Main1 END For more details: Colin Mitchell talking :at: tpg.com.au End of page: 16F84A RA4 Assembler solution
Sponsored Links...
Jump from 16F84A RA4 counting assembler solution to Best-Microcontroller-Projects Home Page |
|||||||||||||||||
|
|
|||||||||||||||||
|
|||||||||||||||||