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

16F688 and 2x16 LCD
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
grovetl



Joined: 29 Oct 2009
Posts: 1
Location: Pittsburgh

View user's profile Send private message

16F688 and 2x16 LCD
PostPosted: Wed Nov 18, 2009 10:56 am     Reply with quote

Neither port A or port C have 8 GPIO pins so, in order to connect the LCD module that I have I must use pins from both ports. After reading through the comments in LCD.c it looks like it allows "pin access". The example shows that all one must do to enable pin access is assign GPIO pins to LCD pins. That seemed logical so I did it but it still seems to want me to assign a port.

I was able to use the flex LCD driver with success. I could continue to do this, however, I'm looking to stick with the CCS supplied driver. Could someone shed some light on whether or not the stock LCD.c driver will actually work with multiple ports? Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Nov 18, 2009 12:57 pm     Reply with quote

Post your test program. Post a list of the modifications that you have
made to the CCS driver, to incorporate your pin list. Don't post the
driver. We have it on our systems. Post a little "Hello World" LCD
program that shows how you are testing the problem. It must compile
with no errors. Also post your compiler version.
GOBER
Guest







PostPosted: Thu Dec 31, 2009 3:37 am     Reply with quote

pls can you post your flex lcd program +16f688 because i tried flexdriver and it worked excellent untill i used 16f688, i think i'm missing something pls as soon as possible i'm working on a project and it has been tooooooooooooooooo late
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 31, 2009 12:38 pm     Reply with quote

Post your list of #define statements that go at the top of the Flex lcd
driver, which show the connections between the PIC and the LCD.

Also post your compiler version.
GOBER
Guest







PostPosted: Sat Jan 02, 2010 7:26 am     Reply with quote

My test program is:
Code:

void main()
{
  //these are generated using the wizard

   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   setup_oscillator(OSC_8MHZ);

   //i added this line because i notices the wizard generates no code for the i/o selection

   SET_TRIS_C(0x00);
   
   lcd_init();
   
   lcd_putc("  hello world  ");

}

PS: I use the PIC wizard. I included the header file and the flex driver as well.

The lcd pin connection is:

Code:

#define LCD_DB4   PIN_C0
#define LCD_DB5   PIN_C3
#define LCD_DB6   PIN_C4
#define LCD_DB7   PIN_C5

#define LCD_E     PIN_C1
#define LCD_RS    PIN_C2

PCM Programmer, I will be absolutely extremely very highly thankful if you can figure out what I'm missing (hope it's not some foolish mistake Laughing )
GOBER
Guest







PostPosted: Sat Jan 02, 2010 7:28 am     Reply with quote

Sorry PCM Programmer forgot to mention that the compiler version is the latest version (4.104) because i have it original not cracked and i always update it
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Sat Jan 02, 2010 1:19 pm     Reply with quote

You have no LCD_RW pin assigned.

Are you forcing the LCD to write-only?

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jan 03, 2010 1:46 pm     Reply with quote

Expanding on what bkamen said, are you using the 6-pin interface mode ?
Do you have this line commented out, in the flex_lcd.c driver ?
Quote:
//#define USE_RW_PIN 1

You need to have it commented out for 6-pin interface mode.
Also, in the 6-pin mode, you need to connect the R/W pin on the LCD
to ground. Do you have that connection ?

Quote:
//these are generated using the wizard
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_oscillator(OSC_8MHZ);

None of this Wizard code is necessary. The built-in startup code
(inserted by the compiler) already sets the analog pins to be all digital,
and it already disables the comparators and vref. I looked at the .LST
file for vs. 4.104 and saw this. The other modules such as Timers
are not needed or are already disabled upon power-on reset anyway.
Delete all the lines above.


Quote:
//i added this line because i notices the wizard generates no code for the i/o selection

SET_TRIS_C(0x00);

If you are using standard i/o mode (the default mode of the compiler)
and not fast_io mode, then you don't need to set the TRIS. The compiler
sets the TRIS by itself. Also, the flex_lcd.c driver requires Standard i/o
mode. You should not attempt to set the TRIS for this driver.


Also, you didn't post a complete test program. Are you using the
hardware UART pins in a #use rs232() statement ? These are pins
C4 and C5. You can't use them for both a serial port and for the LCD.
Comment out the #use rs232() statement or change it to use other
pins that are not on Port C.
GOBER
Guest







PostPosted: Mon Jan 04, 2010 12:35 am     Reply with quote

Hello and thanks for reply.

First, I did comment the r/w line in the flex lcd driver.
Code:
//#define USE_RW_PIN 1

and I already connected the r/w pin to ground.

Second, even if the inserted code is unnecessary, it should not affect my program.

Third, I already started the code without setting the tris cause I know it will be set by the compiler in the default standard io mode, but I inserted it then just for being suspicious that the compiler might have some bug here.

Fourth, I'm not using the rs232, which is turned off by default.

Now, here is my complete test program:
Code:

#include "C:\Users\Alaa\Desktop\Flex LCD162 Test 16F688\Flex LCD162 16F688.h"
#include "C:\Users\Alaa\Desktop\Flex LCD162 Test 16F688\FLEXLCD162.C"

void main()
{
  //these are generated using the wizard

   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   setup_oscillator(OSC_8MHZ);

   //i added this line because i notices the wizard generates no code for the i/o selection

   SET_TRIS_C(0x00);
   
   lcd_init();
   
   lcd_putc("  hello world  ");

}

and the pin map in the flex driver is:

Code:
#define LCD_DB4   PIN_C0
#define LCD_DB5   PIN_C3
#define LCD_DB6   PIN_C4
#define LCD_DB7   PIN_C5
#define LCD_RS    PIN_C2
#define LCD_E     PIN_C1

//#define LCD_RW    PIN_E2

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

One more thing to mention, I'm using Proteus to test my program if it is working even though I have the board. I tried in Proteus to switch to the 16f690 (works for me even if I have to change the design) and tried a test program that you (PCM Programmer) posted somewhere and it also didn't work.

PS: I don't think there is a problem in the flex driver because I stayed up all night trying it on the pic16f877a randomly selecting the pin map for the lcd and I tried it 1000000000000000 of times and it was working excellent. I only had the problem in the 16f688 and 16f690, where I noticed the existence of a comparator and a USART multiplexed on the same pins I'm using for the LCD.

I hope I didn't forget anything.
GOBER
Guest







PostPosted: Thu Jan 07, 2010 4:06 am     Reply with quote

PLS somebody post a reply i really need this
Confused
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Jan 07, 2010 7:48 am     Reply with quote

The #use delay statement is missing in the example.

I see no reason, why the code shouldn't work with 16F688. I expect a hardware problem, e.g. wrong LCD connection.

Did you verify, if the processor is executing code at all, e.g setting the port to output, pulsing the LCD pins?

P.S.: Also show the #fuses.
GOBER
Guest







PostPosted: Fri Jan 08, 2010 12:27 am     Reply with quote

The #use delay is contained in the header file included as it is generated by the project wizard. Also I'm using the Proteus virtual simulation to test my program and it is not showing anything. I'm sure that the processor is executing because I tested inputs and outputs separately and they are all fine. Someone told me to generate the header file that includes all the register names (tools->device selector->registers->make include files) and the program started to display only numbers on the lcd but no text (ex: if I send to the lcd the following: hello:12, then it will only display 12), so what the heck is going on.

PLS SOMEBODY WHO HAS SOME EXPERIENCE IN THE 16F688 IS THERE A BUG IN ITS REGISTER DEFINITION IN THE MAIN HEADER FILE> OR ELSE...
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri Jan 08, 2010 12:35 am     Reply with quote

16F688 is generally O.K. with CCS C.

You don't show the fuses, so please check them yourself.

I can't say anything about Proteus, but you should be able to see, what is not working with 16F688. That's the purpose of a simulator, isn't it?
GOBER
Guest







PostPosted: Fri Jan 08, 2010 12:41 am     Reply with quote

ok i will go with you that I'm making some mistake somewhere. I mean it's the last thing that i can come with after two weeks of trying.
Can you pls post me now a small hello world program using pic16f688 and I will be greatly thankful so that i will know what was i missing.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri Jan 08, 2010 3:55 am     Reply with quote

I'm not using LCD with 16F688, but here's a typical chip setup. The unused peripherals (ADC, timer,
comparator) are disabled by default, so they don't need to be considered in the setup.
Code:
#include   <16F688.h>
#fuses NOWDT,INTRC_IO,NOCPD,NOPROTECT,PUT,MCLR, NOBROWNOUT,NOIESO,NOFCMEN
#use delay(clock=8000000)

void main(void) {
  setup_oscillator(OSC_8MHZ);

}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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