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 support@ccsinfo.com

lcd driving instructions aren't obvious !

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



Joined: 23 Sep 2013
Posts: 3
Location: Syria-Damascus

View user's profile Send private message

lcd driving instructions aren't obvious !
PostPosted: Mon Sep 23, 2013 2:15 am     Reply with quote

I've 2*16 lcd and I'm totally a beginner so I don't know the instructions to clear the lcd and send some characters. I searched the manual but there's no clear info's about that so please help.

MCU : pic-16f877A
Ttelmah



Joined: 11 Mar 2010
Posts: 19347

View user's profile Send private message

PostPosted: Mon Sep 23, 2013 3:55 am     Reply with quote

The 'manual' has nothing to do with this....

Driving an LCD, is not a 'compiler' feature.

For an LCD, you need to be using a driver. CCS provide one, for standard text LCD's 'LCD.C'. This is documented _in the file_.

There are also examples of using this, with a keyboard, and a thermomemeter. EX_LCDKB.C, and EX_LCDTH.C.

There is also a 'third party' LCD driver in the code forum FLEX_LCD.C. This can be slightly simpler, and used to be a lot more flexible than the CCS driver (the CCS driver has improved in this regard). I'd suspect many of the long term users here actually use this.

However seriously, you need to also get the data sheet for your LCD. Look particularly at what voltages it requires - particularly the bias voltage Vo.

Best Wishes
bhomaidan



Joined: 23 Sep 2013
Posts: 3
Location: Syria-Damascus

View user's profile Send private message

I didn't mean that
PostPosted: Mon Sep 23, 2013 6:47 am     Reply with quote

Driving an LCD, is not a 'compiler' feature.

I've written the code implemented lcd.c & lcd.h
lcd_init();
lcd_putc("\fReady...\n");

but the output on the lcd was full black first row and empty on the second row !
temtronic



Joined: 01 Jul 2010
Posts: 9164
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Sep 23, 2013 7:03 am     Reply with quote

Without seeing your code, it sounds like you don't have the LCD connected to the PIC properly.
The LCD driver has default assignments for the LCD module.
Please recheck your wiring it's easy to cross connect a couple of wires,especially if using the same colour wires.
I do know that the 877,LCD driver, LCD modules will together,that's why I suspect a wiring error.

hth
jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19347

View user's profile Send private message

PostPosted: Mon Sep 23, 2013 8:33 am     Reply with quote

Before going even one step further, have you proved that you are actually able to make the CPU 'work' first?.

Can you attach an LED to one pin of the CPU (with a current limiting resistor), and write a program to flash this. Does the program work, and does the LED flash at the right rate?.

In programming, and electronics, one key thing is to move 'one step at a time'. You need to get the controller working first, before trying to control the LCD.
Once you have this working, and the speed is right, then get the data sheet of the LCD, and triple check your connections. The connections that often give problems, are:
1) Vo.
2) Realising that you connect to D4 to D7 on the LCD, not D0 to D3.
3) Forgetting the ground.

Then realise that if you don't define anything the driver defaults to using the pin connections used in the PicDem board. For your chip it'll be using PORTD. Is this what you have done?. If you want to use your own pin connections, and they don't match these, you need to have a set of defines like:

Code:

#define LCD_ENABLE_PIN  PIN_E0       
#define LCD_RS_PIN      PIN_E1         
#define LCD_RW_PIN      PIN_E2       
#define LCD_DATA4       PIN_D4         
#define LCD_DATA5       PIN_D5       
#define LCD_DATA6       PIN_D6       
#define LCD_DATA7       PIN_D7   

_before_ you load LCD.c

This is explained in the file, which is why you should read it.
bhomaidan



Joined: 23 Sep 2013
Posts: 3
Location: Syria-Damascus

View user's profile Send private message

not that
PostPosted: Wed Oct 09, 2013 6:25 am     Reply with quote

I tried the microcontroller with the lcd on another compiler (microC Compiler) and the LCD worked very fine. But my problem is in the PICC compiler even though I configured it as posted in the upper reply, so please concentrate on this part.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Wed Oct 09, 2013 6:53 am     Reply with quote

You're not giving us enough to work on.

I'm assuming the only difference between what works and what doesn't is the compiler. (Same PCB, chip, layout etc.)

CCS compiler requires a very different mindset. (You're not the first to encounter this problem.)

You need to:-

1) Show that you can get an LED flasher to work at the correct rate with CCS.
2) Tell us EXACTLY what all the relevant connections are.
3) Supply the shortest possible complete compilable code which you think should function.
4) Describe what does and doesn't happen.

Mike
Ttelmah



Joined: 11 Mar 2010
Posts: 19347

View user's profile Send private message

PostPosted: Wed Oct 09, 2013 7:13 am     Reply with quote

I think the key thing is the line:

"I configured it as posted in the upper reply".

This is not what you have to do. You have to change these configurations to match your hardware. These are examples of a set of declarations for an LCD. The set for your hardware, needs to be for your hardware, and nobody else can see this.
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