CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

18F2620 and delay_ms

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ljbeng



Joined: 10 Feb 2004
Posts: 205

View user's profile Send private message

18F2620 and delay_ms
PostPosted: Fri Apr 29, 2005 9:18 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Apr 29, 2005 10:00 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Apr 29, 2005 10:21 am     Reply with quote

Simple fix.....

I had XINST instead of NOXINST. I used the Wizard....
Guest








PostPosted: Fri Apr 29, 2005 1:29 pm     Reply with quote

ljbeng,

What does XINST (and NOXINST) do ?

Michael.-
Charlie U



Joined: 09 Sep 2003
Posts: 183
Location: Somewhere under water in the Great Lakes

View user's profile Send private message

PostPosted: Sat Apr 30, 2005 6:14 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group