I found a problem using the repeat command when I have " repeat 0 ".
I used the following code:
---------------------------
#chip 10F200, 4
#config _MCLRE_OFF & _CP_OFF & _WDT_OFF
movlw 0xC0
option
dir GPIO b'11111110'
repeat 0
nop
end repeat
end
----------------------------
the nop is repeated 255 times
in the assembler code the variable SysRepeatTemp1 is cleared,
nop is executed, the variable SysRepeatTemp1 is decresead and tested if zero, but at this point the value of SysRepeatTemp1 is 255 so, nop is repeated more times.
the assembler code is:
;Program compiled by Great Cow BASIC (0.9 8/2/2007)
;Need help? See the GCBASIC forums at http://sourceforge.net/forum/?group_id=169286,
;check the documentation or email hconsidine@bigpond.com.
;Set up the assembler options (Chip type, clock source, other bits and pieces)
LIST p=10F200, r=DEC
#include <P10F200.inc>
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF
;Start of the main program
movlw 0XC0
option
movlw B'11111110'
tris GPIO
clrf SysRepeatTemp1
SysRepeatLoop1
nop
decfsz SysRepeatTemp1,F
goto SysRepeatLoop1
goto BASPROGRAMEND
BASPROGRAMEND
sleep
goto $
;********************************************************************************
;Subroutines included in program
;********************************************************************************
I found a problem using the repeat command when I have " repeat 0 ".
I used the following code:
---------------------------
#chip 10F200, 4
#config _MCLRE_OFF & _CP_OFF & _WDT_OFF
movlw 0xC0
option
dir GPIO b'11111110'
repeat 0
nop
end repeat
end
----------------------------
the nop is repeated 255 times
in the assembler code the variable SysRepeatTemp1 is cleared,
nop is executed, the variable SysRepeatTemp1 is decresead and tested if zero, but at this point the value of SysRepeatTemp1 is 255 so, nop is repeated more times.
the assembler code is:
;Program compiled by Great Cow BASIC (0.9 8/2/2007)
;Need help? See the GCBASIC forums at http://sourceforge.net/forum/?group_id=169286,
;check the documentation or email hconsidine@bigpond.com.
;********************************************************************************
;Set up the assembler options (Chip type, clock source, other bits and pieces)
LIST p=10F200, r=DEC
#include <P10F200.inc>
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF
;********************************************************************************
;Set aside memory locations for variables
SysRepeatTemp1 equ 16
;********************************************************************************
;Jump to initialisation code when PIC is reset
ORG 0
call INITSYS
goto SystemInitialise
;********************************************************************************
;Various initialisation routines, automatically called by GCBASIC
SystemInitialise
;********************************************************************************
;Start of the main program
movlw 0XC0
option
movlw B'11111110'
tris GPIO
clrf SysRepeatTemp1
SysRepeatLoop1
nop
decfsz SysRepeatTemp1,F
goto SysRepeatLoop1
goto BASPROGRAMEND
BASPROGRAMEND
sleep
goto $
;********************************************************************************
;Subroutines included in program
;********************************************************************************
INITSYS
clrf GPIO
retlw 0
;********************************************************************************
END
Stefano