|
|
View previous topic :: View next topic |
Author |
Message |
Ttelmah Guest
|
|
Posted: Mon Apr 26, 2004 4:14 am |
|
|
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
|
|
Posted: Mon Apr 26, 2004 4:23 am |
|
|
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. |
|
|
|
|
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
|