View previous topic :: View next topic |
Author |
Message |
D.e
Joined: 28 Dec 2009 Posts: 3
|
PORTC LCD |
Posted: Sat Dec 24, 2011 9:19 am |
|
|
Hello,
I have a standard 16x2 LCD on PORTC pins, but it doesn't work. My code is so simple, it must work but it doesn't. Normally it works with other pics. Is there a special issue that I don't know?
LCD-PIC Connections:
1-GND
2-VDD
3-GND (for max contrast)
4-PIN_C1
5-PIN_C2
6-PIN_C0
11-PIN_C4
12-PIN_C5
13-PIN_C6
14-PIN_C7
Code: |
#include<18f25k80.h>
#use delay(clock=4m)
#fuses HSM,NOPLLEN,NOWDT,NOXINST,NOFCMEN,NOIESO
#define LCD_DATA_PORT getenv("SFR:PORTC")
#include<lcd.c>
void main()
{
delay_ms(500);
lcd_init();
lcd_putc("\fHello World..");
while(TRUE)
{
}
}
|
Last edited by D.e on Sat Dec 24, 2011 6:51 pm; edited 1 time in total |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Sat Dec 24, 2011 3:21 pm |
|
|
Step back and try a simple 'toggle a pin' code. Try it on another port. Does this work?. If so, then try it on portC. Does this work?. If so, then try it on the top couple of pins of portC. If this works, then the LCD code ought to work. If not, then possibly you have to turn off the CAM peripheral?. If none work, then something is wrong with the fuses. What are you using for an oscillator?. You have it setup for an external medium power resonator/crystal at 4MHz.
Best Wishes |
|
|
D.e
Joined: 28 Dec 2009 Posts: 3
|
|
Posted: Sat Dec 24, 2011 6:56 pm |
|
|
Thank you for your reply Ttelmah.
I found that pic uses portc pins for sosc at startup. I turned it off and it works now. |
|
|
|