![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
hundil Guest
|
LCD_init |
Posted: Tue Apr 25, 2006 10:43 am |
|
|
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);
} |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 25, 2006 11:05 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|