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

#device 16F54 *=16

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







#device 16F54 *=16
PostPosted: Sat May 02, 2009 11:43 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat May 02, 2009 12:26 pm     Reply with quote

For the PCB compiler, you would use
Code:
#device *=8

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
PostPosted: Sat May 02, 2009 1:59 pm     Reply with quote

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
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