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

using portA with flex_lcd

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



Joined: 08 Sep 2008
Posts: 84

View user's profile Send private message

using portA with flex_lcd
PostPosted: Wed Sep 10, 2008 12:38 pm     Reply with quote

Hi all,

can anybody tell me why I failed to use the PortA to drive the LCD (using flex_lcd.c driver)?


-this is my main progam:


Code:
#include <16F876.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)

#include "flex_lcd.c"
   
//==========================
void main()
{

byte byte_b;


//T0CS = 0


set_tris_a(0);
set_tris_b(0xff);



   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);


while(1)

  {

byte_b=input_b();

if (byte_b==0x01)      // start the LCD with a push-botton connected to RB0
    {
    lcd_init();  // Always call this first.
    lcd_putc("\fHello World\n");
    lcd_putc("Line 2.");
    }

  }
 




changes in flex_lcd.c:


(I only changed the pins to fit my board and commented out #define USE_LCD_RW 1 as written in the comments.

Code:
// flex_lcd.c

// These pins are for the Microchip PicDem2-Plus board,
// which is what I used to test the driver.  Change these
// pins to fit your own board.

#define LCD_DB4   PIN_A0
#define LCD_DB5   PIN_A2
#define LCD_DB6   PIN_A4
#define LCD_DB7   PIN_A5

#define LCD_E     PIN_A1
#define LCD_RS    PIN_A3
//#define LCD_RW    PIN_A2

// If you only want a 6-pin interface to your LCD, then
// connect the R/W pin on the LCD to ground, and comment
// out the following line.

//#define USE_LCD_RW   1



this is a printscreen from the simulation (before activating the LCD)





printscreen when the LCD is activated (but no display !- notice the changements in portA pins)




thanks for any kind of help.

Rq :I have read the I/O section of the 16F876 datasheet before asking
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Sep 10, 2008 12:54 pm     Reply with quote

The contrast pin on the LCD is not connected to anything.
Try connecting it to 0.45v with a voltage divider created with
a 10K and a 1K resistor. Or, maybe just connect it to ground.
You're doing all this in a simulator anyway. Maybe it will
accept ground as a "correct" Vee voltage on the LCD.
(Read the spec on the LCD for the simulator).
meereck



Joined: 09 Nov 2006
Posts: 173

View user's profile Send private message

PostPosted: Wed Sep 10, 2008 3:47 pm     Reply with quote

why is RA4 connected to ground on the left side of the scheme?
The external pull-up doesnt work because there is ground all the time
Salenko



Joined: 08 Sep 2008
Posts: 84

View user's profile Send private message

PostPosted: Thu Sep 11, 2008 5:41 am     Reply with quote

meereck wrote:
why is RA4 connected to ground on the left side of the scheme?
The external pull-up doesnt work because there is ground all the time


oooh, you're right !! Embarassed

well now, it running , thank you !! Wink


Last edited by Salenko on Thu Sep 11, 2008 5:44 am; edited 1 time in total
Salenko



Joined: 08 Sep 2008
Posts: 84

View user's profile Send private message

PostPosted: Thu Sep 11, 2008 5:43 am     Reply with quote

PCM programmer wrote:
The contrast pin on the LCD is not connected to anything.
Try connecting it to 0.45v with a voltage divider created with
a 10K and a 1K resistor. Or, maybe just connect it to ground.
You're doing all this in a simulator anyway. Maybe it will
accept ground as a "correct" Vee voltage on the LCD.
(Read the spec on the LCD for the simulator).


www.brokerscreen.com/manufacture/HITACH/pn/LM016L.htm

thank you.
meereck



Joined: 09 Nov 2006
Posts: 173

View user's profile Send private message

PostPosted: Thu Sep 11, 2008 3:35 pm     Reply with quote

glad that it works now.
regards
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