View previous topic :: View next topic |
Author |
Message |
bschriek
Joined: 18 Dec 2007 Posts: 80
|
flex_lcd driver |
Posted: Wed Dec 19, 2007 1:45 pm |
|
|
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
|
|
Posted: Wed Dec 19, 2007 1:52 pm |
|
|
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
|
|
Posted: Thu Dec 20, 2007 1:40 am |
|
|
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
|
|
Posted: Thu Dec 20, 2007 2:46 am |
|
|
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
|
Thanks |
Posted: Thu Dec 20, 2007 4:23 am |
|
|
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
|
|
Posted: Thu Dec 20, 2007 12:30 pm |
|
|
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. |
|
|
|