Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
Posted: Sat Sep 08, 2012 6:10 am
First a few comments:
1) When posting code, please use the 'code' buttons. This will help to preserve the formatting of your code and makes for easier reading.
2) Please only post tested code.
Code:
whiel(1);
This doesn't compile so we know for sure it is not the code you have tested with.
3) Always post your compiler version number
4)
Code:
#byte portb = 0xF81
#byte trisb = 0xF93
These lines can be left out as with CCS the compiler will manage the TRIS register for you, unless you disable this by specifying '#USE FAST_IO'. It is best to have the compiler handle the TRIS register as it keeps your program code smaller and easier to port to other processors where the addresses may be different. Only when memory usage or speed is critical you should manage the TRIS registers yourself.
Now the real problems in your code:
5)
Code:
setup_timer_0(T1_INTERNAL);
Where did this come from? You are using a define for Timer1 in the Timer0 setup!?!?!? Replace by RTCC_INTERNAL. Yes, I know it is stupid that it isn't called T0_INTERNAL, or perhaps this has been fixed in one of the newer compiler versions? I'm still at 4.077
6) Setting up timers is to be done in one call, not in 3 calls. Replace:
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