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

PORTC LCD

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
D.e



Joined: 28 Dec 2009
Posts: 3

View user's profile Send private message

PORTC LCD
PostPosted: Sat Dec 24, 2011 9:19 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Dec 24, 2011 3:21 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Dec 24, 2011 6:56 pm     Reply with quote

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.
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