|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem with Assembly timing script
Programming a 12C509 pic chip in assembly language and having a bit of trouble getting my delay scripts to give the right timing ill attach the code i have already.
If any of you could point out any faults in the syntax and also how to solve my problem id be really grateful. Quetze list p=12c509a #include <p12c509a.inc> __CONFIG _CP_OFF & _WDT_ON & _MCLRE_OFF & _IntRC_OSC temp1 equ 0Ch ;Temporary register 1 temp2 equ 0Dh ;Temporary register 2 ORG 0x000 reset movwf OSCCAL clrf STATUS movlw 0xC8 OPTION movlw 0x08 TRIS GPIO main btfsc GPIO,3 ;test switch for high goto leds bsf GPIO,0 ;dim leds on bsf GPIO,1 bsf GPIO,2 bcf GPIO,0 ;dim leds off bcf GPIO,1 bcf GPIO,2 ;sleep for 18ms sleep leds bsf GPIO,0 ;Bright leds on bsf GPIO,1 bsf GPIO,2 repeat CLRWDT btfsc GPIO,3 ;waiting for unpress goto repeat repeat2 CLRWDT btfsc GPIO,3 ;test switch for high, if high then go to flash. goto flash nop goto repeat2 ;looping to keep leds on. flash CLRWDT btfsc GPIO,3 ;waiting for unpress goto flash repeat3 bcf GPIO,0 ;Bright leds off bcf GPIO,1 bcf GPIO,2 nop call quart bsf GPIO,0 ;Bright leds on bsf GPIO,1 bsf GPIO,2 call quart CLRWDT nop btfsc GPIO,3 goto repeat4 ;return to dim mode nop goto repeat3 repeat4 CLRWDT btfsc GPIO,3 ;waiting for unpress goto repeat4 nop goto main ; Delay subroutine 'onems'=1ms,'tenths'=0.1s onems movlw 0F8h movwf temp1 again1 nop decfsz temp1,1 goto again1 CLRWDT return quart movlw 0F9h movwf temp2 again2 call onems CLRWDT decfsz temp2,1 goto again2 return end |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Programming Tools > Problem with Assembly timing script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|