View previous topic :: View next topic |
Author |
Message |
jworam Guest
|
#device 16F54 *=16 |
Posted: Sat May 02, 2009 11:43 am |
|
|
Using the directive #device 16F54 *=16 does not seem to work for 16F54 chips. (using MPlab 7.0 )
Code: | // C static global variables
unsigned char ms_cntr;
unsigned char seconds;
unsigned char minutes;
unsigned char hours;
unsigned char delay_timer; //
unsigned char timer_9V_read;
unsigned char timer_9V_beep;
unsigned char trigger_9V_chirp_flag;
unsigned char Chirp_timer_9V;
unsigned char RTCC_trip_value;
unsigned char beep_toggle_timer;
unsigned char OP_toggle;
unsigned char excess_alarm;
unsigned char pump_state;
unsigned char AC_alarm;
unsigned char Alarm_9V;
unsigned char alarm_state_9V;
unsigned char beep_state;
unsigned char pump_timer;
unsigned char offtimeflag; // 4/28/2009
unsigned char pump_antilock_minute_timer; //
unsigned long pump_accru_timer; |
end of variables |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat May 02, 2009 12:26 pm |
|
|
For the PCB compiler, you would use
But it's not necessary. The 16F54 only has 25 bytes of user RAM and it's
all in one page. The compiler reserves 2 bytes for its own purposes.
Apparently there is a quirk, where if you declare a 'long' variable it
wants to reserve even more. I was able to work around the problem
by changing the long into two byte variables. See below.
It's possible that you could work around the problem by using the
#locate directive, which tells the compiler the exact RAM address
to use for each variable. I didn't try that.
Quote: |
#include <16F54.h>
#fuses XT, NOWDT, NOPROTECT
#use delay(clock=4000000)
unsigned char ms_cntr;
unsigned char seconds;
unsigned char minutes;
unsigned char hours;
unsigned char delay_timer; //
unsigned char timer_9V_read;
unsigned char timer_9V_beep;
unsigned char trigger_9V_chirp_flag;
unsigned char Chirp_timer_9V;
unsigned char RTCC_trip_value;
unsigned char beep_toggle_timer;
unsigned char OP_toggle;
unsigned char excess_alarm;
unsigned char pump_state;
unsigned char AC_alarm;
unsigned char Alarm_9V;
unsigned char alarm_state_9V;
unsigned char beep_state;
unsigned char pump_timer;
unsigned char offtimeflag; // 4/28/2009
unsigned char pump_antilock_minute_timer; //
// unsigned long pump_accru_timer;
int8 temp0;
int8 temp1;
//==============================
void main()
{
while(1);
}
|
|
|
|
jworam Guest
|
#device *=8 |
Posted: Sat May 02, 2009 1:59 pm |
|
|
Thanks for the most helpful tip.
I could never get anything to compile or even tell if it is using the PCB compiler. But once I stripped out enough variables, it did compile.
I opened the list file and saw that it did use the PCB compiler.
Now I have some how got to make the program work with this limited memory.
I bought it from CCS last year and have never got it to work until now.
Thanks so much,
Jworam |
|
|
|