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

flex_lcd driver

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



Joined: 18 Dec 2007
Posts: 76

View user's profile Send private message Send e-mail

flex_lcd driver
PostPosted: Wed Dec 19, 2007 1:45 pm     Reply with quote

C is new, assembly is no problem at all.
I use the PCW compiler and 16F687
I want to use a lcd and used the original flex_lcd driver mentioned in the forum. In the begin I only changed the ports to the LCD.
At that time the hardware failed and I started to debug the code step by step in mplab. I found out the following part didn't work correctly.

PART OF LCD_FLEX DRIVER
lcd_send_nibble(0x02);
for(i=0; i < sizeof(LCD_INIT_STRING); i++)
{
lcd_send_byte(0, LCD_INIT_STRING[i]);
etc..........

The loop is executed 4 times but every time the first constant (28) of the
"LCD_INIT_STRING[4]" is send to the lcd.
I have changed the flex_lcd driver and now it works fine. Now I'm able to initialize the lcd display.

This is what I have changed:
PART OF LCD_FLEX DRIVER
lcd_send_nibble(0x02);
lcd_send_byte(0, LCD_INIT_STRING[0]);
lcd_send_byte(0, LCD_INIT_STRING[1]);
lcd_send_byte(0, LCD_INIT_STRING[2]);
lcd_send_byte(0, LCD_INIT_STRING[3]);
etc.......

This is the first problem and solved for now but i want to know why
variable i is stuck at 0.


The main program has almost the same behaviour.
It's stuck at the first character.
For example:
printf(lcd_putc,"Hello World.");
This displays HHHHHHHH

I don't know why this code doesn't work while I use the same driver and main code as everyone else????

Best regards,
Bas
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 19, 2007 1:52 pm     Reply with quote

Post your compiler version. You can find it at the start of the .LST file
for your project. The .LST file is in your Project directory. The compiler
version is a 4-digit number in this format: x.xxx
basuser



Joined: 17 Dec 2007
Posts: 2

View user's profile Send private message Send e-mail

PostPosted: Thu Dec 20, 2007 1:40 am     Reply with quote

PCM programmer wrote:
Post your compiler version. You can find it at the start of the .LST file
for your project. The .LST file is in your Project directory. The compiler
version is a 4-digit number in this format: x.xxx


This is my compiler version:
CCS PCM C Compiler, Version 4.034, 37576
_________________
Bas
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 20, 2007 2:46 am     Reply with quote

Your version is defective. Vs. 4.034 doesn't create the proper access
code for constant arrays. See the two listings below, which show the
bug in vs. 4.034.

See the CCS versions page:
http://www.ccsinfo.com/devices.php?page=versioninfo
They fixed the problem in vs. 4.035. Vs. 4 was a major change from
vs. 3, and it took a while to make it work properly.
Quote:

4.035 A problem with some constant strings in PCM is fixed


If you have upgrade rights ("maintenance"), then download the current
version. If you don't have them, then possibly you could make the case
to CCS support that your version is unusable in a basic way, and ask
them to upgrade you to a version that doesn't have this bug.

Vs. 4.064 -- Access code for constant array:
Code:

0004:  BCF    0A.0
0005:  BCF    0A.1
0006:  BCF    0A.2
0007:  ADDWF  02,F   <==  This is correct.
0008:  RETLW  28
0009:  RETLW  0C
000A:  RETLW  01
000B:  RETLW  06


For vs. 4.034. Note that it's missing the ADDWF instruction.
Code:
0004:  BCF    0A.0
0005:  BCF    0A.1
0006:  BCF    0A.2  <==  Missing ADDWF 02,F after this line.
0007:  RETLW  28
0008:  RETLW  0C
0009:  RETLW  01
000A:  RETLW  06
basuser



Joined: 17 Dec 2007
Posts: 2

View user's profile Send private message Send e-mail

Thanks
PostPosted: Thu Dec 20, 2007 4:23 am     Reply with quote

Dear mr PCM programmer, thank you for your help.
I already contacted CCS.

Does this bug also explain why the lcd only shows the first character
of the text many times?

Thank you in advance,
_________________
Bas
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 20, 2007 12:30 pm     Reply with quote

Quote:

Does this bug also explain why the lcd only shows the first character
of the text many times?

Yes. The line that's missing is the one that performs the indexing
into the constant array. Without the ADDWF line, the code will always
return the first element in the array.
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