Hi I want to create a flash light during 1 second using pic 16F877A
I tried to do it with timer0 but it didn't work
this is the source code:
Code ASM - [expand] |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
| list p=16f877a
#include<p16f877a.inc>
tmp EQU 0x020
__CONFIG _CP_OFF & _DEBUG_OFF & _WRT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _PWRTE_ON & _WDT_OFF & _HS_OSC
BSF STATUS,RP0
BCF STATUS,RP1
MOVLW B'00000000'
MOVWF TRISB
BCF STATUS,RP0
MOVLW B'00000000'
MOVWF PORTB
CONT MOVLW B'11111111'
MOVWF PORTB
CALL TEMPO
MOVLW B'00000000'
MOVWF PORTB
CALL TEMPO
GOTO CONT
;programme de temporisation
TEMPO MOVLW D'255'
MOVWF tmp
CONT1 MOVLW D'255'
MOVWF TMR0
bcf INTCON,T0IF
CONT2 btfss INTCON,T0IF
GOTO CONT2
decfsz tmp,f
goto CONT1
return
END |
Last edited by a moderator: