gnupic: simulating a timer
Subject:
simulating a timer
From:
"Maxim Wexler" ####@####.####
Date:
28 Nov 2006 22:04:47 +0000
Message-Id: <a0811460611281404n1a45baf0x75d7c75c276160c0@mail.gmail.com>
Hi group,
Trying to simulate this timer demo:
;=======2000.ASM=====================================9/2/98==
;timer/counter demo
; single time interval
; internal clock divided by 8
; 2000 microsecond pulse out
;------------------------------------------------------------
list p=16f84
radix hex
#include <p16f84.inc>
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _HS_OSC
;------------------------------------------------------------
; cpu equates (memory map)
tmr0 equ 0x01
portb equ 0x06
intcon equ 0x0b
;------------------------------------------------------------
org 0x000
goto start ;skip over location pointed
; to by interrupt vector
org 0x004
goto iserv
;
start movlw b'00000010' ;port B in/out
tris portb
bcf portb,0 ;low
bcf portb,2 ;low
bcf portb,3 ;low
bcf portb,4 ;low
bcf portb,5 ;low
bcf portb,6 ;low
bcf portb,7 ;low
bcf intcon,2 ;clear TMR0 interrupt flag
bsf intcon,7 ;enable global interrupts
bsf intcon,5 ;enable TMR0 interrupts
clrwdt ;clr WDT prep prescale assign
movlw b'11010010' ;set up timer/counter
option
send btfss portb,1 ;switch open?
goto send ;not yet
movlw 0x05 ;inc 250 times to rollover
movwf tmr0 ;start timer/c, clr prescaler
bsf portb,0 ;start pulse
circle goto circle ;wait for interrupt
;
iserv bcf intcon,2 ;clear TMR0 interrupt flag
bcf portb,0 ;end pulse
retfie ;done
;
end
;------------------------------------------------------------
;at blast time, select:
; memory unprotected
; watchdog timer disabled (default is enabled)
; standard crystal (using 4 MHz osc for test) XT
; power-up timer on
;============================================================
The simulation gets stuck in the loop between l.40 and l.41.
Is there some special procedure to simulate a timer that does not rely on
decrementing a counter? FWIW, there were no _CONFIG options originally.
These were the only ones not to return a "symbol not previously defined"
error at compile time.
Maxim