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

PIC18F47k40 and GLCD with T6963C controller
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
JairHdez



Joined: 30 Nov 2017
Posts: 9

View user's profile Send private message

PIC18F47k40 and GLCD with T6963C controller
PostPosted: Thu Nov 30, 2017 3:00 pm     Reply with quote

Hello all,

I am new to ccs and this is the first time to work with an glcd. I'm tryin to use the driver provided in http://www.ccsinfo.com/forum/viewtopic.php?t=49389.

The parts of the code I changed were:
Code:

//inside t6963.h
#byte   PORTA   =   0xF8D
#byte   TRISA   =   0xF88
...
#byte   PORTB   =   0xF8E
#byte   TRISB   =   0xF89
...
#byte   PORTC   =   0xF8F
#byte   TRISC   =   0xF8A
...
#byte   PORTD   =   0xF90
#byte   TRISD   =   0xF8B
...
#byte   PORTE   =   0xF91
#byte   TRISE   =   0xF8C
...
#define LCD_DATA      PORTC      // LCD data port
#define LCD_DATA_TRIS      TRISC      // LCD Data port Tris
#define STA0         PORTC0      // Check command execution capability
#define STA1         PORTC1      // Check data read/write capability
#define STA2         PORTC2      // Check Auto mode data read capability
#define STA3         PORTC3      // Check Auto mode data write capability
#define STA5         PORTC5      // Check controller operation capability
#define STA6         PORTC6      // Error flag. Used for screen peek and screen copy
#define STA7         PORTC7      // Check the blink condition

//Control pin setting
#define LCD_CE         PORTD5      // LCD Enable control line pin number
#define LCD_CE_TRIS        TRISD5      // LCD Enable control line direction pin #
#define LCD_RD         PORTD6      // LCD Read control line  pin number
#define LCD_RD_TRIS      TRISD6      // LCD Read control line direction pin #
#define LCD_WR         PORTD7      // LCD Write control line pin number
#define LCD_WR_TRIS      TRISD7      // LCD Write control line irection pin #
#define LCD_CD         PORTD4      // LCD Control/data Select line
#define LCD_CD_TRIS      TRISD4      // LCD Control/data Select line direction
#define LCD_RST         PORTD3      // LCD RST_ line
#define LCD_RST_TRIS      TRISD3      // LCD RST_line direction
...
#define TEXT_HOME_ADDR     0x0000
#define GRH_HOME_ADDR      0x0200
#define CG_HOME_ADDR      0x1400
#define COLUMN         20      //Set column number to be e.g. 32 for 8x8 fonts, 2 pages
#define MAX_ROW_PIXEL      128      //MAX_ROW_PIXEL the physical matrix length (y direction)                           
#define MAX_COL_PIXEL      160      //MAX_COL_PIXEL the physical matrix width (x direction)


I changed those parts because the directions from portx and trisx are different in the pic I'm using and the one the driver was made for. Also my glcd is a cfag160128b and its dimensions are different.

When I try to compile the project I get the error *** Error 160 "glcd.c" Line 41(1,2): EXTERNal symbol not found mode

My whole project cnad be download here:

https://www.zipshare.com/download/eyJhcmNoaXZlSWQiOiIzNDVmMGFhMy1hZjExLTQ2MzctYjcwNC0wZGE4MjFhNmYzYzciLCJlbWFpbCI6ImphaXIuaGVybmFuZGV6QGRlb24uY29tLm14In0=
temtronic



Joined: 01 Jul 2010
Posts: 6251
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Nov 30, 2017 3:18 pm     Reply with quote

You must have changed something else....

Does the ORIGNAL driver and test program compile ?
If so then copy the original driver to say 'my_glcd.c' and then edit it NOT the original !
Recompile using your unmodified version, it should compile.
NOW do whatever editting you ned, recompile and test.

I don't have that GLCD, don't know which PIC you have so can't properly test the code.
JairHdez



Joined: 30 Nov 2017
Posts: 9

View user's profile Send private message

PostPosted: Thu Nov 30, 2017 3:29 pm     Reply with quote

temtronic



Joined: 01 Jul 2010
Posts: 6251
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Nov 30, 2017 4:02 pm     Reply with quote

OK so now we know the 'glcdex1.c' is where the 'error' is...

1st line is
#include <16F877a.h>

which means 'glcdex1.c' is NOT a 'driver' rather it's a program. Specifically it's been designed for a 16F877 PIC. A 'driver' is a small program that control a device.

does the program 'glcdex1.c' compile ? if not, you'll have to decide to either fix that or try the one on the CCS forum but you cannot 'mix' the two of them ! Also you can't just 'copy' a proram for an 877 ,edit 'some of it' and expect that to work for another PIC , especially from a different 'family'. You have to read and understand every line of code, every register and every bit and then CONFIRM whatever changes YOU make are correct. Yes, it's a LOT of reading
PCM programmer



Joined: 06 Sep 2003
Posts: 20385

View user's profile Send private message

PostPosted: Thu Nov 30, 2017 4:15 pm     Reply with quote

Quote:
When I try to compile the project I get the error *** Error
160 "glcd.c" Line 41(1,2): EXTERNal symbol not found mode

Edit t6963.h and remove the keyword 'extern' that is in front of the
four global variables.

I also get this message:
Quote:
*** Error 12 "pch_test.c" Line 36(41,50): Undefined identifier TO_16_BIT

It's because you have typed in the constant incorrectly.
You have spelled it as "T oh", instead of "T zero".

After you fix those things, it should compile.
JairHdez



Joined: 30 Nov 2017
Posts: 9

View user's profile Send private message

PostPosted: Thu Nov 30, 2017 4:18 pm     Reply with quote

I tried to compile the 'glcdex1.c' which it is using 't6963.c' and 't6963.h'. When I compile it I get me the 'error'. I'm not using the glcdex1.c in my project with the 47k40, I'm using the 't6963.c' and 't6963.h' in my program, the file I'm editing is the 't6963.h' I use in my program. Also I compare the 't6963.c' and 't6963.h' used in 'glcdex1.c' and the ones in the CCS forum using www.diffchecker.com and they are almost the same, the only difference is the CCS forum have one more functions to draw 3d figures.
JairHdez



Joined: 30 Nov 2017
Posts: 9

View user's profile Send private message

PostPosted: Thu Nov 30, 2017 4:27 pm     Reply with quote

Thanks PCM, but this is weird,
Quote:

I also get this message:
Quote:
*** Error 12 "pch_test.c" Line 36(41,50): Undefined identifier TO_16_BIT

It's because you have typed in the constant incorrectly.
You have spelled it as "T oh", instead of "T zero".


because if I try to compile with 'T(zero)' I get error, and if I compile with T(oh) The program compiles fine, and the timer runs fine in the hardware.
PCM programmer



Joined: 06 Sep 2003
Posts: 20385

View user's profile Send private message

PostPosted: Thu Nov 30, 2017 4:39 pm     Reply with quote

What's your compiler version ? It's a 4-digit number given at the top of
the .LST file after a successful compilation. Examples of version numbers:
http://www.ccsinfo.com/devices.php?page=versioninfo
JairHdez



Joined: 30 Nov 2017
Posts: 9

View user's profile Send private message

PostPosted: Thu Nov 30, 2017 4:45 pm     Reply with quote

My version is 5.070
PCM programmer



Joined: 06 Sep 2003
Posts: 20385

View user's profile Send private message

PostPosted: Thu Nov 30, 2017 4:51 pm     Reply with quote

Your version is defective. It has both these constants spelled incorrectly:
Code:

// One of the following may be OR'ed in with the above using |
#define TO_8_BIT                  0x1000 
#define TO_16_BIT                 0x0000

Fix it by editing the 18F47K40.h file, and change those two lines to this:
Code:

// One of the following may be OR'ed in with the above using |
#define T0_8_BIT                  0x1000 
#define T0_16_BIT                 0x0000
JairHdez



Joined: 30 Nov 2017
Posts: 9

View user's profile Send private message

PostPosted: Fri Dec 01, 2017 9:23 am     Reply with quote

I change the 18F47K40.h and now I can compile with T(zero)_16_bit. Back to the glcd I don't see anything displayed in it. Now I'm only using the driver from the CCS forum. I post my modified code.


https://www.zipshare.com/download/eyJhcmNoaXZlSWQiOiI1Y2EzMDhhMy00ZWYxLTQwZWItODM0NS1iMDRmYTZiZjBiYzkiLCJlbWFpbCI6ImphaXIuaGVybmFuZGV6QGRlb24uY29tLm14In0=
temtronic



Joined: 01 Jul 2010
Posts: 6251
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Dec 01, 2017 9:53 am     Reply with quote

OK.. let's talk basic HARDWARE...

What voltage is the PIC running at ?
What's the GLCD make/model/pcb ?
What voltage does it require? Most 'peripheral devices' these days are 3 volt and you can't connect them to a 5 volt PIC without 'logic level translation'.

Does the PIC actually run a 1Hz LED program? This is a basic test to 'flash an LED'. Yes, simple BUT it's really the first program to run as it'll confirm 1) hardware works, 2) compiler works, 3) programmer works.

Even IF the GLCD code is correct, you could have a small hardware problem.

Jay
JairHdez



Joined: 30 Nov 2017
Posts: 9

View user's profile Send private message

PostPosted: Fri Dec 01, 2017 11:00 am     Reply with quote

OH I forgot to mention what glcd I'm using. I'm using the CFAG169128B, its datasheet says it can run with 5v. The pic is runnig at 5v. And the led is blinking at 1Hz I saw it in the oscilloscope.

All the hardware is connected in one protoboard. It is powered by a wall mounted power supply 9V/1.11A to two LM2596S modules, one to power the pic and the other to power the glcd.
Ttelmah



Joined: 11 Mar 2010
Posts: 13538

View user's profile Send private message

PostPosted: Fri Dec 01, 2017 11:07 am     Reply with quote

Why?.

The 2596 can deliver 3A. More than the wall wart can deliver. KISS and have a single supply.

Can you give a link to the LCD data sheet?. The part number is not being recognised.
JairHdez



Joined: 30 Nov 2017
Posts: 9

View user's profile Send private message

PostPosted: Fri Dec 01, 2017 11:16 am     Reply with quote

Sorry I made a typo the glcd is CFAG160128B the link is https://www.google.com.mx/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=0ahUKEwia47byp-nXAhWF8YMKHRqbAmwQFggvMAE&url=https%3A%2F%2Fwww.crystalfontz.com%2Fproducts%2Fdocument%2F90%2FCFAG160128B-TMI-TZDatasheetReleaseDate2017-09-20.pdf&usg=AOvVaw3vj6sLcr6oE1fboN-1Zxiw

I need the 2596 because I will use a sim800l which has peaks of 2A
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