View previous topic :: View next topic |
Author |
Message |
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
18F2620 and delay_ms |
Posted: Fri Apr 29, 2005 9:18 am |
|
|
V3.224
Some of my delay_ms calls work and others get caught in an infinite loop. I can step through the assembly listing and watch the ram locations. The first few delays will decrement the ram and return from the delay routine. Then eventually, the ram quits decrementing and an infinite loop occurs......
Code: |
.................... #use delay(clock=4096000)
*
1B9A: MOVLW 02
1B9C: MOVWF FEA
1B9E: MOVLW 35
1BA0: MOVWF FE9
1BA2: MOVF FEF,W
1BA4: BZ 1BC4
1BA6: MOVLW 01
1BA8: MOVWF 01
1BAA: CLRF 00
1BAC: DECFSZ 00,F //infinite loop occurs here
1BAE: BRA 1BAC //infinite loop occurs here
1BB0: DECFSZ 01,F
1BB2: BRA 1BAA
1BB4: MOVLW 52
1BB6: MOVWF 00
1BB8: DECFSZ 00,F
1BBA: BRA 1BB8
1BBC: NOP
1BBE: NOP
1BC0: DECFSZ FEF,F
1BC2: BRA 1BA6
1BC4: RETLW 00 |
|
|
|
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
|
Posted: Fri Apr 29, 2005 10:00 am |
|
|
I am also getting some horrible results for simple math multiply and divide.....
Code: |
example:
percent = cyclet / fwdepth * mindepth;
where:
cyclet = 1200
fwdepth = 15
mindepth = 15
percent will equal 3924420877
|
I changed chips from 18F252 to 18F2620. The program worked great on the 252 |
|
|
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
|
Posted: Fri Apr 29, 2005 10:21 am |
|
|
Simple fix.....
I had XINST instead of NOXINST. I used the Wizard.... |
|
|
Guest
|
|
Posted: Fri Apr 29, 2005 1:29 pm |
|
|
ljbeng,
What does XINST (and NOXINST) do ?
Michael.- |
|
|
Charlie U
Joined: 09 Sep 2003 Posts: 183 Location: Somewhere under water in the Great Lakes
|
|
Posted: Sat Apr 30, 2005 6:14 am |
|
|
They are fuse keyword/parameters:
XINST: Extended set extension and Indexed Addressing mode enabled
NOXINST: Extended set extension and Indexed Addressing mode disabled (Legacy mode)
Check the device data sheet for a detailed description. |
|
|
|