lcd not working in easy dspic4
lcd not working in easy dspic4
i have a JHD 162A 16x2 LCD connected to easy dspic 4 . i then programmed the lcd_custom example given with the cd .. but after i programmed it ,nothing changed . what is wrong with this ?? the lcd works perfectly but not when connected to easydspic4. can any one help me?
-
- Posts: 619
- Joined: 05 Jul 2008 06:05
- Location: Thailand
Thank Sobrietytest. This is my code.
Only after writing "adpcfg = 0xFFEF" The LCD has shown signs of life. I applied a voltage of 2Vdc in RB4: LCD writes 113 in the second row start. Sometimes LCD writes the same number at the end of the line. For my application, in RB4, I should apply a sine wave 50Hz. Can be done? And how?
void main()
{
char val;
char buf[8];
trisf=0x00;
trisb=0x10;
trisd=0x00;
adpcfg=0xFFEF;
delay_ms(1000);
lcd_clear;
lcd_custom_config(&portb,3,2,1,0,&portd,0,2,1);
while(1)
{
val=Adc_Read(4);
portf=val;
ByteToStr(val,buf);
delay_ms(50);
lcd_custom_out(2,1,buf);
}
}
Greetings to all
Only after writing "adpcfg = 0xFFEF" The LCD has shown signs of life. I applied a voltage of 2Vdc in RB4: LCD writes 113 in the second row start. Sometimes LCD writes the same number at the end of the line. For my application, in RB4, I should apply a sine wave 50Hz. Can be done? And how?
void main()
{
char val;
char buf[8];
trisf=0x00;
trisb=0x10;
trisd=0x00;
adpcfg=0xFFEF;
delay_ms(1000);
lcd_clear;
lcd_custom_config(&portb,3,2,1,0,&portd,0,2,1);
while(1)
{
val=Adc_Read(4);
portf=val;
ByteToStr(val,buf);
delay_ms(50);
lcd_custom_out(2,1,buf);
}
}
Greetings to all
-
- Posts: 619
- Joined: 05 Jul 2008 06:05
- Location: Thailand
Hi Picluigi, you need to initialise the LCD before trying to send any commands to it, this may explain why your value keeps appearing in the wrong place. Also, the lcd_clear needs to be within an LCD command:
Lcd_Custom_Cmd(LCD_CLEAR);
Your while loop is very short and will execute approximately 20 times per second, this is a bit too fast for display purposes, try slowing the loop down to, say, once per second.
Can you tell us which PIC/development board you are using?
Lcd_Custom_Cmd(LCD_CLEAR);
Your while loop is very short and will execute approximately 20 times per second, this is a bit too fast for display purposes, try slowing the loop down to, say, once per second.
Can you tell us which PIC/development board you are using?
-
- mikroElektronika team
- Posts: 95
- Joined: 04 Dec 2008 14:19
Hi,
Please read carefully LCD Custom Library topic in help section of your compiler,
The mikroC for dsPIC30/33 and PIC24 provides a library for communication with LCDs
(with HD44780 compliant controllers) through the 4-bit interface.
You should check if your LCD controller is HD44780 compliant.
Regards
Please read carefully LCD Custom Library topic in help section of your compiler,
The mikroC for dsPIC30/33 and PIC24 provides a library for communication with LCDs
(with HD44780 compliant controllers) through the 4-bit interface.
You should check if your LCD controller is HD44780 compliant.
Regards
Sobrietytest and other friends:
I slowed down the cycle WHILE (1000msec) but without result. Maybe my LCD (Truly MCC162A4-5) is not HD44780 compatible.
I'm working with EASYdsPIC4 and PIC30F4013 with OSC10MHz.
To digitize a 50Hz sine wave should be used A / D converter with MCP3204, built from Mikroelektronika? Is there a less expensive solution?
Regards.
I slowed down the cycle WHILE (1000msec) but without result. Maybe my LCD (Truly MCC162A4-5) is not HD44780 compatible.
I'm working with EASYdsPIC4 and PIC30F4013 with OSC10MHz.
To digitize a 50Hz sine wave should be used A / D converter with MCP3204, built from Mikroelektronika? Is there a less expensive solution?
Regards.
-
- Posts: 619
- Joined: 05 Jul 2008 06:05
- Location: Thailand
hi picluigi,
with some HD44780 compatible buy on ebay ( so im sure is chiness stock...lol ) , i have to add a delay just after the lcd_init. the most common one is :
hth a bit
with some HD44780 compatible buy on ebay ( so im sure is chiness stock...lol ) , i have to add a delay just after the lcd_init. the most common one is :
Code: Select all
Lcd_Init_EasyDsPIC4();
delay_ms(200);
Lcd_Cmd(LCD_CURSOR_OFF);