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

HELP ! - Using PIC to acquire RS232 data from PC

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



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

HELP ! - Using PIC to acquire RS232 data from PC
PostPosted: Sun Oct 03, 2004 7:59 pm     Reply with quote

Hello,
I've tried to write a function to make PIC16F877A to sleep when input of RB3 changed to LOW (0 V). I've tried the function and it works well. But when I implement it in my actual codes for my application, it DOES NOT work. Why? Please HELP...the program is given below.

#include <16F877A.h>
#fuses XT,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

#define RTC_SCLK PIN_A1 //PIN_B1
#define RTC_RST PIN_A2 //PIN_B2
#define RTC_IO PIN_A3 //PIN_B3
#include <ds1302.c>
#include <lcd.c>
#include <kbd_membrane.c>

int day_off, hour_off, min_off, sec_off, sec_old;
int inc_flag;
int sec_last[11], min_last[11], hour_last[11], day_last[11], mth_last[11], year_last[11]; //10 elements array
int i, previously_OFF;
int timer_sec, timer_min, timer_hour, timer_day; // values of timer when load needs to be OFF
int Just_wokeup;

///////////////////////////////////////// BELOW FUNCTIONS FOR SLEEP !!!
short sleep_mode; // global flag to send processor into sleep mode

// external interrupt when button pushed and released
#INT_EXT
void ext_isr()
{
static short button_pressed=FALSE;

if(!button_pressed) // if button action and was not pressed
{
button_pressed=TRUE; // the button is now down
sleep_mode=TRUE; // activate sleep
printf("The processor is now sleeping.\r\n");
ext_int_edge(L_TO_H); // change so interrupts on release
}
else // if button action and was pressed
{
button_pressed=FALSE; // the button is now up
sleep_mode=FALSE; // reset sleep flag
ext_int_edge(H_TO_L); // change so interrupts on press
}
if(!input(PIN_B3)) // keep button action sychronized wth button flag
button_pressed=TRUE;
delay_ms(100); // debounce button
} //end of ext_isr

byte get_bcd() {
char first,second;

do {
first=kbd_getc();
} while ((first<'0') || (first>'9'));
lcd_putc(first);
first-='0';

do {
second=kbd_getc();
} while ((second<'0') || (second>'9'));
lcd_putc(second);
return((first<<4)|(second-'0'));
}

void set_clock(){
byte day,mth,year,dow,hour,min;
lcd_putc("\fYear 20: "); // Year 2000 -- 2099 //
year=get_bcd();
lcd_putc("\fMonth: ");
mth=get_bcd();
lcd_putc("\fDay: ");
day=get_bcd();
lcd_putc("\fWeekday 1-7: ");
dow=get_bcd();
lcd_putc("\fHour: ");
hour=get_bcd();
lcd_putc("\fMin: ");
min=get_bcd();
rtc_set_datetime(day,mth,year,dow,hour,min);
}

void set_control(){
int sec_buf, min_buf, hour_buf, day_buf;
lcd_putc("\fToff Day: ");
timer_day=get_bcd();
printf("\n\r Day_DEC:%D, Day_HEX:%X, Day_CHAR:%C",timer_day,timer_day,timer_day);
lcd_putc("\fToff Hour: ");
timer_hour=get_bcd();
printf("\n\r Hour_DEC:%D, Hour_HEX:%X, Hour_CHAR:%C",timer_hour,timer_hour,timer_hour);
lcd_putc("\fToff Min: ");
timer_min=get_bcd();
printf("\n\r Min_DEC:%D, Min_HEX:%X, Min_CHAR:%C",timer_min,timer_min,timer_min);
lcd_putc("\fToff Sec: ");
timer_sec=get_bcd();
printf("\n\r Sec_DEC:%D, Sec_HEX:%X, Sec_CHAR:%C",timer_sec,timer_sec,timer_sec);
delay_ms(250);
////////////// HEX to DECIMAL CONVERSION ///////////////////
sec_buf = timer_sec%16; // give the remainder from division of timer_sec
timer_sec = 10*(timer_sec/16) + sec_buf;

min_buf = timer_min%16; // give the remainder from division of timer_sec
timer_min = 10*(timer_min/16) + min_buf;

hour_buf = timer_hour%16; // give the remainder from division of timer_sec
timer_hour = 10*(timer_hour/16) + hour_buf;

day_buf = timer_day%16; // give the remainder from division of timer_sec
timer_day = 10*(timer_day/16) + day_buf;
}

void setup_menu()
{
char cmd, cmd1, cmd2;
lcd_putc("\f1:System 2:Timer"); //lcd_putc("\f*:Reset #:Clear");
lcd_putc("\n3:CTRL 4:Back "); //lcd_putc("\n1:Tstop 2:Back ");

do {
cmd=kbd_getc();
} while ((cmd!='1')&&(cmd!='2')&&(cmd!='3')&&(cmd!='4'));

// SYSTEM RESET MENU //
if(cmd=='1')
{
lcd_putc("\fRESET SYSTEM ? ");
lcd_putc("\n *:YES #:NO ");

do
{ cmd1=kbd_getc(); }
while ((cmd1!='*')&&(cmd1!='#'));

if(cmd1=='*') // RESET CLOCK & TIMER if '*'
set_clock();
} // END OF SYSTEM RESET MENU //

// TIMER MENU //
if(cmd=='2')
{
lcd_putc("\f1:Clear TIMER ");
lcd_putc("\n2:Display Record");

do
{ cmd1=kbd_getc(); }
while ((cmd1!='1')&&(cmd1!='2')&&(cmd1!='#'));

if(cmd1=='1') // CLEAR TIMER VALUE
{
sec_off = 0; // Stores the TOTAL ACCUMULATED duration or how long it has been OFF //
min_off = 0;
hour_off = 0;
day_off = 0;
}

if(cmd1=='2') // RESET CLOCK & TIMER if '*'
{
for (i=1;i<11;i++)
{
printf(lcd_putc,"\fRec%02X: %02X/%02X/%02X",i,day_last[i],mth_last[i],year_last[i]);
printf(lcd_putc,"\n %02X:%02X:%02X",hour_last[i],min_last[i],sec_last[i]);
delay_ms(2000);
}
}
} // END OF TIMER MENU //

// CONTROL MENU //
if(cmd=='3')
{
lcd_putc("\fSET AUTO OFF ? ");
lcd_putc("\n *:YES #:NO ");
do
{ cmd1=kbd_getc(); }
while ((cmd1!='*')&&(cmd1!='#'));

if(cmd1=='*') // RESET CLOCK & TIMER if '*'
set_control();
if(cmd1=='#')
{
timer_sec=0;
timer_min=0;
timer_hour=0;
timer_day=0;
}
}
} // END OF SETUP MENU FUNCTION //
void main() {
char cmd;
byte day,mth,year,dow,hour,min,sec;
day_off = 0;
hour_off = 0; // Timer initialize to 00:00:00
min_off = 0;
sec_off = 0;
sec_old = 0;
i = 0;
for (i=1;i<11;i++)
{
sec_last[i] = 0; // LAST OFF TIME initialize to 00:00:00//
min_last[i] = 0;
hour_last[i] = 0;
day_last[i] = 0;
mth_last[i] = 0;
year_last[i] = 0;
}

timer_sec=0; //
timer_min=0; //// Initial value for AUTO TIMER OFF TIME
timer_hour=0; ////
timer_day=14; //
rtc_init();
lcd_init();
kbd_init();
lcd_putc("\fFLOW MONITORING");
lcd_putc("\n *:Set #:Run ");
do {
cmd=kbd_getc();
} while ((cmd!='*')&&(cmd!='#'));

if(cmd=='*')
set_clock();

output_low(PIN_E2); sleep_mode=FALSE; // init sleep flag
ext_int_edge(H_TO_L); // init interrupt triggering for button press
enable_interrupts(INT_EXT);// turn on interrupts
enable_interrupts(GLOBAL);
printf("\n\n");


while (TRUE) {
cmd=kbd_getc();
if(cmd=='*') // SET REAL TIME CLOCK
{ setup_menu();} // GOTO SETUP MENU
lcd_putc('\f');
rtc_get_date( day, mth, year, dow);
rtc_get_time( hour, min, sec );


if(input(PIN_E0) == 1) //## SPECIAL DESIGN ## || if WATER FLOW ie RE0=1 ==> increase timer ### PORTE,0 == FLOW SWITCH
{

if (sec != sec_old) // ONLY increment sec if SEC != SEC_OLD, if same means no need 2 increase timer
{

sec_off = sec_off + 1; //(sec - sec_old);

if (sec_off == 60) // if sec_off == 60 ie 60sec,then clr & increment min_off
{
sec_off = 0;
min_off = min_off + 1;
}

if (min_off == 60) // if min_off == 60 ie 60 min,then clr & increment hour_off
{
min_off = 0;
hour_off = hour_off + 1;
}

if (hour_off == 24) // if hour_off == 24 ie 24 hours,then clr & increment day_off
{
hour_off = 0;
day_off = day_off + 1;
}
previously_OFF = 1; // previously_OFF flag to indicate previously & currently NO WATER

}
output_high(PIN_E2); // Specially chg to ON RELAY (240Vac) when timer RUN
}

else // if no water is detected !!! (NO FLOW)
{

if(previously_OFF == 1) // if HIGH (1), means PREVIOUSLY/BEFORE THAT 'NO WATER FLOW'
{
previously_OFF = 0; // chg to LOW, to mean that WATER IS FLOWING even for (n-1) cycle
}
output_low(PIN_E2); // Specially chg to OFF RELAY (240Vac) when timer OFF
}


cmd=kbd_getc();
if(cmd=='*') // SET REAL TIME CLOCK
{
setup_menu(); // GOTO SETUP MENU
}
// FOR DISPLAY ON LCD
printf(lcd_putc,"%2X/%2X/%2X %2X%2X%2X",day,mth,year,hour,min,sec);
printf(lcd_putc,"\nt=%02d:%02d:%02d %03dDy",hour_off,min_off,sec_off, day_off);
delay_ms(250);
cmd=kbd_getc();
if(cmd=='*') // SET REAL TIME CLOCK
{
setup_menu(); // GOTO SETUP MENU
}

sec_old = sec; //copy value of sec to sec_old REGISTER; if later in the loop SEC=SEC_OLD,dont increment sec_off

if(((int)timer_day==day_off)&&((int)timer_hour==hour_off)&&((int)timer_min==min_off)&&((int)timer_sec==sec_off))
{
output_low(PIN_E2);
lcd_putc("\f Timer Complete ");
lcd_putc("\n1:End 2:Resume");

do {
cmd=kbd_getc();
} while ((cmd!='1')&&(cmd!='2'));

if(cmd=='1')
{
day_off = 0;
hour_off = 0;
min_off = 0;
sec_off = 0;
lcd_putc("\fEnd of Operation");
lcd_putc("\n#:Restart timer ");

do {
cmd=kbd_getc();
} while (cmd!='#');
}
}

// ==For SLEEP MODE==
if(sleep_mode) // if sleep flag set
{
Just_wokeup = 1; // to make sure LCD & KBD will be INITIALIZED later
printf("Sleep Mode Activated");
sleep(); // make processor sleep if SLEEP_MODE is TRUE !!!
}

if(Just_wokeup == 1)
{
lcd_init();
kbd_init();
Just_wokeup = 0; // Make sure INITIALIZATION is done ONCE ONLY..
delay_ms(1);
printf(lcd_putc,"%2X/%2X/%2X %2X%2X%2X",day,mth,year,hour,min,sec);
printf(lcd_putc,"\nt=%02d:%02d:%02d %03dDy",hour_off,min_off,sec_off, day_off);

}
}
}

Basically, I am running the PIC from an ac-dc converter (5V) as the main power but there is a backup battery when the main power is cut-off. When the main power got cut-off, the PIC16F877 needs to go to SLEEP MODE to conserve energy and power to LCD & KEYPAD & other auxilliary IC will also be stopped. I have connected the +5Vdc main power to PIN RB3 together with a 4.7k resistor pulled to ground.
I have tried the program above but it DOES NOT work. It doesn't go to SLEEP MODE and the LCD is still ON.

Please advice... Confused So sorry that the program is rather crude.

Thank You.
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

PostPosted: Sun Oct 03, 2004 8:07 pm     Reply with quote

Sorry... I have posted the wrong subject title.
Anyway, I have reposted it under the correct subject title.

Basically, I am trying to make my PIC16LF877A to SLEEP when the main power supply got cut-off and it will run on backup battery. Hence, the LCD needs to be shut off as well when main power is not available. But the LCD needs to be switched back ON, reset and resume display of previous data immediately after the MAIN power returns.

How can I do that?

Please advise...

Thank You.
Steve H
Guest







PostPosted: Mon Oct 04, 2004 10:08 pm     Reply with quote

In the past I have driven the LCD power pin from one of the PIC's pins - that way you can turn off the LCD power by driving the PIC pin low. Naturally the LCD forgets everything when you turn it off. When the PIC wakes up you can use the restart cause() function to determine how the PIC started and immediately start the LCD and display the data again. Users are mostly used to waiting for a few seconds before seeing the diaplay again thanks to notebook PC's.

Hope this helps....

Steve H.
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

How to turn ON LCD and display data correctly...
PostPosted: Tue Oct 05, 2004 12:19 am     Reply with quote

Hi...

I have tried both ways ie. driving the LCD using external power supply and supplying the power to LCD using one of the PIC I/O pin. However, everytime after I turn off the power to the LCD and resupply it back later, the data that is being displayed would be JUNK!. From the Hyperterminal, I can see that the PIC is working fine and PIC can display the data thru Hyperterminal as well.

So, what is wrong with the LCD?
The LCD works well when I turn ON the power together with PIC but after that, it doesn't work when I turn OFF the LCD power without turning off the PIC.

What can I do to solve this problem? Confused

Thanks...
Steve H
Guest







PostPosted: Tue Oct 05, 2004 9:36 am     Reply with quote

What I do is to wait a about 100 mSec for everything to settle out. Then you must re-initilize the LCD. Then it will work OK. Make sure that you give the LCD enough time to wake up before initilizing it. As I recall some of the LCD data sheets specified this time.

Steve H.
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

Hmm...My LCD still refuses to startup
PostPosted: Wed Oct 06, 2004 11:52 pm     Reply with quote

I've put in 100ms delay after the power to LCd returns before initializing the LCD but it still couldn't startup properly. The LCD still gives me JUNK display even though i've tried with 50ms, 100ms, 150ms, 200ms and 250ms delay.

Is there something wrong with my program/LCD?
Why can it work when I power up the LCD together with MCU?

if(input(PIN_C5)==0) //RC5 to check for main power (1=yes,0=no)
{
output_float(PIN_B0); //set all I/O to LCD to float
output_float(PIN_B1);
output_float(PIN_B2);
output_float(PIN_B4);
output_float(PIN_B5);
output_float(PIN_B6);
output_float(PIN_B7);
OUTPUT_FLOAT(PIN_C6); //set Tx & Rx to float
OUTPUT_FLOAT(PIN_C7);
// PORT_B_PULLUPS(TRUE);
Just_wokeup = 1; //flag to indicate power to LCD just returned
}
else // if RC5==1 ie main power back, then ALLOW LCD DISPLAY
{
delay_ms(150);
if(input(PIN_C5)==1) // check 2nd time to ensure main power is back
{
if(Just_wokeup==1)
{
delay_ms(150); //tried with 50,100,200, 250 ms to let LCD time to power up properly
lcd_init();
kbd_init();
lcd_putc("\f Power Returned ");
lcd_putc("\n ");
printf("\f Main Power Returned");
delay_ms(150);
Just_wokeup = 0;
}
}
}
Guest








PostPosted: Thu Oct 07, 2004 7:26 am     Reply with quote

Does the LCD ever work when you power it from the MCU?
What kind of display is it?
What is the voltage to the display when driven from the MCU?

Steve H.
ernest



Joined: 11 Feb 2004
Posts: 51

View user's profile Send private message

PostPosted: Fri Oct 08, 2004 4:55 am     Reply with quote

Anonymous wrote:
Does the LCD ever work when you power it from the MCU?
What kind of display is it?
What is the voltage to the display when driven from the MCU?

Steve H.


- Yes, I've tried powering the LCD from the PIC and it works fine.
- The problem is, whenever I switch OFF the LCD (I/O pin that's powering the LCD to output_low), the LCD cannot be switched back ON. There are no display at all shown.
- One of the info. that the LCD need to display is the Real Time Clock value from DS1302.
- The PIC is supplying about 4.34V of power(when output high) to the LCD

I've tried numerous ways and modifications but the problem is still unsolved.

The while loop of the codes is as follow:

while (TRUE) {

if(input(PIN_C5)==0)
{
output_low(PIN_C4); //switch OFF LCD when main power OFF
// while(input(PIN_C5)==0)
// { Just_wokeup = 1; }
Just_wokeup = 1;
}
else // if RC5==1 ie MAIN POWER SUPPLY AVAILABLE, then execute the following
{

cmd=kbd_getc();
if(cmd=='*') // SET REAL TIME CLOCK
{
// To switch ON backlight of LCD --> PIN PORTA,5 //
output_high(PIN_A5);

////////////////////////////////////////////////////
setup_menu(); // GOTO SETUP MENU

// To switch OFF backlight of LCD --> PIN PORTA,5 //
output_low(PIN_A5);

////////////////////////////////////////////////////
}

lcd_putc('\f');
rtc_get_date( day, mth, year, dow);
rtc_get_time( hour, min, sec );



if(input(PIN_E0) == 1) //## SPECIAL DESIGN ## || if WATER FLOW ie RE0=1 ==> increase timer ### PORTE,0 == FLOW SWITCH
{

if (sec != sec_old) // ONLY increment sec if SEC != SEC_OLD, if same means no need 2 increase timer
{

sec_off = sec_off + 1; //(sec - sec_old);

if (sec_off == 60) // if sec_off == 60 ie 60sec,then clr & increment min_off
{
sec_off = 0;
min_off = min_off + 1;
}

if (min_off == 60) // if min_off == 60 ie 60 min,then clr & increment hour_off
{
min_off = 0;
hour_off = hour_off + 1;
}

if (hour_off == 24) // if hour_off == 24 ie 24 hours,then clr & increment day_off
{
hour_off = 0;
day_off = day_off + 1;
}
previously_OFF = 1; // previously_OFF flag to indicate previously & currently NO WATER

}
output_high(PIN_E2); // Specially chg to ON RELAY (240Vac) when timer RUN
}

else // if no water is detected !!! (NO FLOW)
{

if(previously_OFF == 1) // if HIGH (1), means PREVIOUSLY/BEFORE THAT 'NO WATER FLOW'
{
//////////// TO SAVE 10 PREVIOUS DOWN TIME
sec_last[1] = sec; // 1st
min_last[1] = min; // 1st
hour_last[1] = hour; // 1st
day_last[1] = day; // 1st
mth_last[1] = mth; // 1st
year_last[1] = year; // 1st
//TO SAVE 10 PREVIOUS DOWN TIME //
previously_OFF = 0; // chg to LOW, to mean that WATER IS FLOWING even for (n-1) cycle
}

// if PORTE,0 == LOW, PORTE,2 == LOW TO SWITCH OFF SOXHLET
output_low(PIN_E2); // Specially chg to OFF RELAY (240Vac) when timer OFF
}
/////////////////////////////////// END OF CHECKING WATER FLOW AT PIN_RE0 /////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



cmd=kbd_getc();
if(cmd=='*') // SET REAL TIME CLOCK
{
// To switch ON backlight of LCD --> PIN PORTA,5 //
output_high(PIN_A5);
////////////////////////////////////////////////////

setup_menu(); // GOTO SETUP MENU

// To switch OFF backlight of LCD --> PIN PORTA,5 //
output_low(PIN_A5);
////////////////////////////////////////////////////
}
} // END OF ELSE CLAUSE in line 396





if(input(PIN_C5)==0) // if NO MAIN POWER detected
{
input(PIN_B0); //tried ==>output_float(PIN_B0) as well
input(PIN_B1);
input(PIN_B2);
input(PIN_B4);
input(PIN_B5);
input(PIN_B6);
input(PIN_B7);
input(PIN_C6);
input(PIN_C7);
// PORT_B_PULLUPS(TRUE);
Just_wokeup = 1;
// while(input(PIN_C5)==0) // keep on looping here until RC5==1
// { Just_wokeup = 1; }
}
else // if RC5==1, then ALLOW DISPLAY
{
// delay_ms(50);
// if(input(PIN_C5)==1)
// {
if(Just_wokeup==1)
{
output_high(PIN_C4); // switch ON LCD
delay_ms(500); // delay 100ms to let LCD power up properly
lcd_init();
kbd_init();
lcd_putc("\f Power Returned ");
lcd_putc("\n ");
printf("\f Main Power Returned");
delay_ms(150);
Just_wokeup = 0;
}

// FOR DISPLAY ON LCD
printf(lcd_putc,"%2X/%2X/%2X %2X%2X%2X",day,mth,year,hour,min,sec);
printf(lcd_putc,"\nt=%02d:%02d:%02d %03dDy",hour_off,min_off,sec_off, day_off);

// FOR DISPLAY USING RS-232
printf("\f Current Date & Time : %2X/%2X/%2X %2X:%2X:%2X",day,mth,year,hour,min,sec);
printf("\n\r Last Stopped Time : %2D/%2D/%2D %2D:%2D:%2D",day_last,mth_last,year_last,hour_last,min_last,sec_last);
printf("\n\r Total Down Time : %02d:%02d:%02d %03d Day",hour_off,min_off,sec_off, day_off);
printf("\n\r Selected ON/OFF time: %02D:%02D:%02D %03D Day",timer_hour,timer_min,timer_sec,timer_day);
// }
delay_ms(250);

} // end of ELSE on top (line 569)


if(input(PIN_C5)==0)
{
output_low(PIN_C4); //switch OFF LCD when main power OFF
// while(input(PIN_C5)==0)
// { Just_wokeup = 1; }
Just_wokeup = 1;
}
else // if RC5==1 ie MAIN POWER SUPPLY AVAILABLE, then execute the following
{


cmd=kbd_getc();
if(cmd=='*') // SET REAL TIME CLOCK
{
// To switch ON backlight of LCD --> PIN PORTA,5 //
output_high(PIN_A5);
////////////////////////////////////////////////////

setup_menu(); // GOTO SETUP MENU

// To switch OFF backlight of LCD --> PIN PORTA,5 //
output_low(PIN_A5);
////////////////////////////////////////////////////
}


cmd=kbd_getc();
if(cmd=='*') // SET REAL TIME CLOCK
{
// To switch ON backlight of LCD --> PIN PORTA,5 //
output_high(PIN_A5);
////////////////////////////////////////////////////

setup_menu(); // GOTO SETUP MENU

// To switch OFF backlight of LCD --> PIN PORTA,5 //
output_low(PIN_A5);
////////////////////////////////////////////////////
}

sec_old = sec; //copy value of sec to sec_old REGISTER; if later in the loop SEC=SEC_OLD,dont increment sec_off


//////////////////////////////////
if(((int)timer_day==day_off)&&((int)timer_hour==hour_off)&&((int)timer_min==min_off)&&((int)timer_sec==sec_off))
{
output_low(PIN_E2);
lcd_putc("\f Timer Complete ");
lcd_putc("\n1:End 2:Resume");

do {
cmd=kbd_getc();
} while ((cmd!='1')&&(cmd!='2'));

if(cmd=='1')
{
day_off = 0;
hour_off = 0;
min_off = 0;
sec_off = 0;
lcd_putc("\fEnd of Operation");
lcd_putc("\n#:Restart timer ");

do {
cmd=kbd_getc();
} while (cmd!='#');
}
} // END OF IF CLAUSE for TIMER

} // END OF ELSE clause that check for PIN RC5 (line 611 )

} // Closing Brace for WHILE Loop
Steve H.
Guest







PostPosted: Fri Oct 08, 2004 1:36 pm     Reply with quote

4.34 Volts at the PIC pin? If you are running from a 5 volt supply, that sounds like a huge drop! I assume the LCD has a backlight? If so then use an external PMOS FET as a switch to the LCD. It is pretty easy to get a FET with less than an ohm on resistance. See the power switch on my PIC-DAS project at www.geocities.com/hagtronics

Also make sure that the other I/O pins are set to low or as inputs when powering up the LCD. I'll bet some of the pins are supplying just enough power to the LCD to prevent it from resetting completely.

I also remember that some of the LCD's have a maximum rise time spec on the power supply line. be sure that you check the data sheet for this or the display may not reset properly.

Hang in there - we'll get it fixed...

Steve H.
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