list p=16F84A ; list directive to define processor
#include <p16F84A.inc> ; processor specific variable definitions
errorlevel -302, -207
__config _XT_OSC & _WDT_OFF & _CP_OFF
;============
; Declarations:
acc_level equ 0x0c
Test equ 0x0d
#define main_eng PORTA, 1
#define accel PORTB, 6
#define slow_down PORTB, 5
#define RF_in PORTB, 1
#define RF_out PORTB, 2
org 0x0000
goto Setup
org 0x0004
ISR bsf PORTB, 7
bcf PORTB, 7
bcf INTCON, 1
retfie
Setup nop
clrf acc_level
;;;
clrf PORTA ; resets Port A
clrf PORTB
bsf RF_out
bsf STATUS,RP0 ; BANK1
movlw b'0000' ; RA0: LED, RA1-3: not connected
movwf TRISA
movlw b'01011011'
movwf TRISB
movlw b'10010000'
movwf INTCON
movlw b'11010100'
movwf OPTION_REG
bcf STATUS, RP0
;============
Main
movfw acc_level
movfw Test
btfsc accel
call gazi
btfsc slow_down
call tormuzi
; Start Engine
call Going
call RFC
goto Main
Going clrf TMR0
bsf main_eng
Mda movfw acc_level
subwf TMR0, 0
btfss STATUS, Z
goto Mda
call W8ing
retlw 0
W8ing movfw TMR0
sublw 0xFF
bcf main_eng
movwf Test
decfsz Test,F
goto W8ing
retlw 0
gazi movfw acc_level
sublw 0xFE
btfss STATUS, Z
incf acc_level,F
retlw 0
tormuzi movfw acc_level
sublw 0x00
btfss STATUS, Z
decf acc_level,F
retlw 0
RFC btfsc RF_in
bcf RF_out
btfss RF_in
bsf RF_out
retlw 0
end