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 support@ccsinfo.com

Why does this happen??
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah
Guest







PostPosted: Mon Apr 26, 2004 4:14 am     Reply with quote

johnh wrote:
Sorry, left work at Lunch time.

As for the LST code from 0045, i won't be able to get that until monday, so i will post it then. (sorry didn't notice it jumped back up to 0045!)

Is an int signed then unless you specify unsigned int or int8? This could be a problem, i'll change this on monday and check the result.

Cheers for all your help guys, much appreciated. have a good weekend.

John

Yes. This is a 'oddity' of the CCS compiler, and can lead to some unusual behaviour. I prefer to be 'explicit', and use 'int8' for 8bit integers (and int16 for 16bit ones), which defaults to 'unsigned, and makes it obvious what storage size you have. :-)

Best Wishes
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Mon Apr 26, 2004 4:23 am     Reply with quote

And as for the long delay problem, I am away from my setup now (today is a public holiday here), so I can't debug through the code. However it seems the code at 0045 gets executed quite a few times. Even if none of the backwards branches get taken, it will take about 20us for the PIC to go through it. You are looping 5 times, so the loop takes minimum 100us to complete. To see how many times exactly the internal loops in the delay_us() code execute, you can step through the code in the assembly (.LST) window.

It seems if your instruction cycle is already 1us (4MHz crystal), the minimum amount of delay you can get out of delay_us() is around 20us.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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