lcd not working in easy dspic4

General discussion on mikroC for dsPIC30/33 and PIC24.
Post Reply
Author
Message
pravvish
Posts: 3
Joined: 03 Jan 2009 14:11

lcd not working in easy dspic4

#1 Post by pravvish » 03 Jan 2009 14:21

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? :cry: :cry: :cry:

picluigi
Posts: 17
Joined: 23 Jan 2009 20:56

#2 Post by picluigi » 23 Jan 2009 23:18

Same thing to me. I tried with the card EASYdsPic4. Then I asked SUPPORT an example of code to write LCD on the value of an analog input voltage. I'm waiting for answers. Unanswered throw it all away. I've already lost too much time.
:evil:

Sobrietytest
Posts: 619
Joined: 05 Jul 2008 06:05
Location: Thailand

#3 Post by Sobrietytest » 25 Jan 2009 03:24

Picluigi: I think you have to be a bit more realistic; the MikroE team probably get hundreds of similar requests every day, it's not their job to write code for individuals.

If you post your code here and give a full description of the problem, you are much more likely to get a successful reply!

picluigi
Posts: 17
Joined: 23 Jan 2009 20:56

#4 Post by picluigi » 26 Jan 2009 19:50

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

Sobrietytest
Posts: 619
Joined: 05 Jul 2008 06:05
Location: Thailand

#5 Post by Sobrietytest » 27 Jan 2009 10:09

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?

dane.radakovic
mikroElektronika team
Posts: 95
Joined: 04 Dec 2008 14:19

#6 Post by dane.radakovic » 27 Jan 2009 17:22

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

picluigi
Posts: 17
Joined: 23 Jan 2009 20:56

#7 Post by picluigi » 27 Jan 2009 18:59

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.

Sobrietytest
Posts: 619
Joined: 05 Jul 2008 06:05
Location: Thailand

#8 Post by Sobrietytest » 28 Jan 2009 17:38

Hi Picluigi, I'm going to be out on field ops for the next few weeks so I'll be limiting my time on the forum. Keep trying though, the LCD functions really do work as described in the help files.

picluigi
Posts: 17
Joined: 23 Jan 2009 20:56

#9 Post by picluigi » 28 Jan 2009 21:49

OK.
I tried with another LCD: everything as before.
I think:
1°- the compiler produces a file.hex not good;
or
2°-USB port card corrupts the file.hex;
or
3°-LCD libraries have not been adequately tested.

To you the word.
Greetings to all friends.

piort
Posts: 1379
Joined: 28 Dec 2005 16:42
Location: Laval,Québec,Canada,Earth... :-)
Contact:

#10 Post by piort » 28 Jan 2009 23:05

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 :

Code: Select all

Lcd_Init_EasyDsPIC4();
delay_ms(200);
Lcd_Cmd(LCD_CURSOR_OFF);
hth a bit ;-)

picluigi
Posts: 17
Joined: 23 Jan 2009 20:56

#11 Post by picluigi » 29 Jan 2009 18:07

Thank piort. My LCD works perfectly with PicBasicPro.

Post Reply

Return to “mikroC for dsPIC30/33 and PIC24 General”