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 CCS Technical Support

LCD_init

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







LCD_init
PostPosted: Tue Apr 25, 2006 10:43 am     Reply with quote

Hi everybody

This is a part of my whole code below.

The problem is that LCD is not starting up properly.

Sometimes, Wrong characters are printed or nothing is appeared on LCD .

After a few resets, it works properly

Is there any problem with interrupts enable and disable sequence or place.

Any idea will be appreciated...

hundil





....

#include "LCD.C"

......

void main()
{

disable_interrupts(GLOBAL);
clear_interrupt(int_ccp1);
clear_interrupt(int_ccp2);
clear_interrupt(int_timer3);

disable_interrupts(INT_TIMER3);
disable_interrupts(INT_CCP1);
disable_interrupts(INT_CCP2);
disable_interrupts(INT_AD);
disable_interrupts(GLOBAL);

port_b_pullups(false);
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_INTERNAL);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_INTERNAL|T3_DIV_BY_1);

set_tris_a(0x09);
set_tris_b(0xf1);
set_tris_c(0xA6);
set_tris_e(0x00);


disable_interrupts(int_ad);

delay_ms(500);

lcd_init();


output_high(PIN_C0);
printf(lcd_putc,"\f**SYK**");
delay_ms(1000);
output_low(PIN_C0);

setup_ccp1(CCP_CAPTURE_RE);
setup_ccp2(CCP_CAPTURE_RE);
set_timer3(15000);

enable_interrupts(INT_TIMER3);
enable_interrupts(INT_CCP1);
enable_interrupts(INT_CCP2);
enable_interrupts(GLOBAL);

delay_ms(5);
while(!input(PIN_B5)) output_high(PIN_A1);
output_low(PIN_A1);


do{.......

}while(1);

}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 25, 2006 11:05 am     Reply with quote

Is your TRIS setup correct ?

My advice:
1. Get rid of the #fast_io() statement and get rid of these tris statements.
Let the compiler handle the TRIS. You're using CCS pin i/o functions.
The compiler will automatically setup the correct TRIS if you use
"standard i/o" mode instead of "fast_io". Standard i/o mode is the
default mode of the compiler.

set_tris_a(0x09);
set_tris_b(0xf1);
set_tris_c(0xA6);
set_tris_e(0x00);


2. If that doesn't work, then edit the lcd_init() function in LCD.C,
and increase the initial delay_ms() value to 50 ms. CCS has it set
for 15 ms, but some LCD's require a longer delay.
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