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 Problem

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







LCD Problem
PostPosted: Fri Jan 17, 2003 12:23 pm     Reply with quote

Hello,
I'm trying to use a Hitachi 2x16 LCD with CCS C Compiler. but I cannot see any message on the lcd (I see the black boxes that appears when the LCD Poweres Up, and I test the LCD using another compiler). My code is this:

#include <16F76.h>
#device *=16
#fuses HS,NOWDT,PUT,BROWNOUT

#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C0,rcv=PIN_C1,Invert,Stream=ECU)

#include <LCD.C>
#define TXPin PIN_C0
#define LED PIN_A0
void main() {
// Inicilizacion de Perifericos Integrados
setup_adc_ports(NO_ANALOGS);
setup_spi(FALSE);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_OFF);
setup_ccp2(CCP_OFF);
lcd_init();

output_high (LED);
delay_ms(1000);
output_low (LED);
output_low (TXPin);
delay_ms(500);
lcd_putc ("\f");
printf (lcd_putc,"Test");
delay_ms(1500);
}

I don't see "Test" on the LCD, Why?

Thank you, Ezequiel
___________________________
This message was ported from CCS's old forum
Original Post ID: 10759
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: LCD Problem
PostPosted: Fri Jan 17, 2003 3:21 pm     Reply with quote

:=Hello,
:= I'm trying to use a Hitachi 2x16 LCD with CCS C Compiler. but I cannot see any message on the lcd (I see the black boxes that appears when the LCD Poweres Up, and I test the LCD using another compiler).
---------------------------------------------------------

What is the part number of the Hitachi LCD ?

Can you give us a list of the connections between the LCD
and the PIC ? (ie., which PIC pin goes to which LCD pin ?).
___________________________
This message was ported from CCS's old forum
Original Post ID: 10763
Phil G
Guest







Re: LCD Problem
PostPosted: Fri Jan 17, 2003 3:43 pm     Reply with quote

:=Hello,
:= I'm trying to use a Hitachi 2x16 LCD with CCS C Compiler. but I cannot see any message on the lcd (I see the black boxes that appears when the LCD Poweres Up, and I test the LCD using another compiler). My code is this:
:=
:=#include <16F76.h>
:=#device *=16
:=#fuses HS,NOWDT,PUT,BROWNOUT
:=
:=#use delay(clock=20000000)
:=#use rs232(baud=9600,parity=N,xmit=PIN_C0,rcv=PIN_C1,Invert,Stream=ECU)
:=
:=#include <LCD.C>
:=#define TXPin PIN_C0
:=#define LED PIN_A0
:=void main() {
:= // Inicilizacion de Perifericos Integrados
:= setup_adc_ports(NO_ANALOGS);
:= setup_spi(FALSE);
:= setup_timer_1(T1_DISABLED);
:= setup_timer_2(T2_DISABLED,0,1);
:= setup_ccp1(CCP_OFF);
:= setup_ccp2(CCP_OFF);
:= lcd_init();
:=
:= output_high (LED);
:= delay_ms(1000);
:= output_low (LED);
:= output_low (TXPin);
:= delay_ms(500);
:= lcd_putc ("\f");
:= printf (lcd_putc,"Test");
:= delay_ms(1500);
:=}
:=
:=I don't see "Test" on the LCD, Why?
:=
:=Thank you, Ezequiel

Take a look at your printf function, as it looks like a syntax error to me. printf(lcd_putc,"\%s", "test");.
But why not simply lcd_putc("test");

Phil
___________________________
This message was ported from CCS's old forum
Original Post ID: 10764
Ezequiel
Guest







Re: LCD Problem
PostPosted: Sat Jan 18, 2003 3:50 am     Reply with quote

Hello,
I'm using the LCD.C library that is include in the Driver directory (PCM and PCB 3.094), I set the define to use PortB. So, I have LCD DataBus (DB4 - DB7)at PortB Low Nib (RB.4 to RB.7). In PortB.0 I have the Enable Pin, and in PortB.1 I have the RS Pin. The LCD is a Powertip PC1602F B, and it's working okey (I tested it with a Basic Compiler for PIC).
Thank you very much
Ezequiel
___________________________
This message was ported from CCS's old forum
Original Post ID: 10775
Ezequiel
Guest







Re: LCD Problem
PostPosted: Sat Jan 18, 2003 7:43 am     Reply with quote

Hello,
I think I discovered something but don't know how to fix it.
I connected all PortB Pins with leds. My program works okey here, I could see
some blinks at the Enable Pin (RB.0), and in the Data Pins (RB.4 to RB.7). Also
the Led at PortA.0 and the TXPin at PortC.0 also "lights". So I disconnected all
leds at portB.0 and restart the PIC. What happens here?, The program starts, light
PortA.0 Led, and stops!!!. So, a pin in PortB needs a path to ground to work, I connected
PortB.7 to ground using a 10K resistor, and my program starts working Okey. Could anybody
tell me why? If the same PIC, and the same LCD, with a different compiler works okey
without any extra component. Then I hock up the LCD (with the pull down resistor at RB.7),
and the program start working, but I couldn't see anything on the LCD.
My programmer is EPIC Win Programmer, the fuses are: No WatchDog, HS Crystal,
Brown Ou Enable, Power Up Timer Enable, Code Proctection Off. My CcS Compiler is version 3.094
Does somebody writes another driver for Hitachi LCDs or everybody use CCS driver?
If I want to write my own driver, How I can write to the entire Port, or to the high nibble at once?

Hope somebody could help me,

Thank you very much.
Ezequiel
___________________________
This message was ported from CCS's old forum
Original Post ID: 10776
Tomi
Guest







Re: LCD Problem
PostPosted: Sat Jan 18, 2003 8:33 am     Reply with quote

1. You have to use 3 control lines. You wrote about 2 lines but what is about R/W (to control the data direction: read or write) ?
2. You must connect pin3 of LCD to a small voltage dep'd on the LCD type. Try to connect it to GND.

:=Hello,
:= I think I discovered something but don't know how to fix it.
:=I connected all PortB Pins with leds. My program works okey here, I could see
:=some blinks at the Enable Pin (RB.0), and in the Data Pins (RB.4 to RB.7). Also
:=the Led at PortA.0 and the TXPin at PortC.0 also "lights". So I disconnected all
:=leds at portB.0 and restart the PIC. What happens here?, The program starts, light
:=PortA.0 Led, and stops!!!. So, a pin in PortB needs a path to ground to work, I connected
:=PortB.7 to ground using a 10K resistor, and my program starts working Okey. Could anybody
:=tell me why? If the same PIC, and the same LCD, with a different compiler works okey
:=without any extra component. Then I hock up the LCD (with the pull down resistor at RB.7),
:=and the program start working, but I couldn't see anything on the LCD.
:= My programmer is EPIC Win Programmer, the fuses are: No WatchDog, HS Crystal,
:=Brown Ou Enable, Power Up Timer Enable, Code Proctection Off. My CcS Compiler is version 3.094
:= Does somebody writes another driver for Hitachi LCDs or everybody use CCS driver?
:=If I want to write my own driver, How I can write to the entire Port, or to the high nibble at once?
:=
:= Hope somebody could help me,
:=
:=Thank you very much.
:=Ezequiel
___________________________
This message was ported from CCS's old forum
Original Post ID: 10777
Ezequiel
Guest







Re: LCD Problem
PostPosted: Sat Jan 18, 2003 10:18 am     Reply with quote

Hello,
I've the LCD R/W set with a 10k resistor to ground (Write Mode), and I have a variable resistor to control the contrast in the LCD Vo Pin.
Ezequiel
___________________________
This message was ported from CCS's old forum
Original Post ID: 10781
Tomi
Guest







Re: LCD Problem
PostPosted: Sat Jan 18, 2003 10:44 am     Reply with quote

Fault. You _must_ control the R/W bit. A byte or a nibble is written into the LCD as:
1. Set R/W to 1 (read mode) and the port to input.
2. Read D7 (the busy signal) and wait until the LCD is busy.
3. Reset R/W and write out the next byte.

In the CCS C library:
void lcd_send_byte( byte address, byte n ) {
lcd.rs = 0;
while ( bit_test(lcd_read_byte(),7) ) ; // !!!!!!!!!!
................

And the lcd_read_byte():
byte lcd_read_byte() {
byte low,high;
set_tris_lcd(LCD_READ); // !!!!!
lcd.rw = 1; // !!!!!!!
delay_cycles(1);


:=Hello,
:= I've the LCD R/W set with a 10k resistor to ground (Write Mode), and I have a variable resistor to control the contrast in the LCD Vo Pin.
:=Ezequiel
___________________________
This message was ported from CCS's old forum
Original Post ID: 10783
Ezequiel
Guest







Re: LCD Problem
PostPosted: Sat Jan 18, 2003 11:13 am     Reply with quote

Thank you very much, I was used to avoid the use of the RW line, as my Basic Compiler doesn't need it.
Ezequiel
___________________________
This message was ported from CCS's old forum
Original Post ID: 10784
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