|
|
View previous topic :: View next topic |
Author |
Message |
paularina Guest
|
18F65J90 built in LCD function and Compiler Error |
Posted: Mon Aug 10, 2009 3:02 am |
|
|
Hi I am using 18F65J90 to drive LCD using CCS-C built in functions lcd_symbol.
What i noticed was that when increased the number of LCD_symbol function, I can not compile if I use delay_ms() function.
It seems if i use more than a certain number of LCD_symbol function, the compiler won't let me compile with delay_ms function
Code: |
//Mode flags
int8 mode_flag1;
//#bit ACC_TOT_MODE = mode_flag.1
#bit WA = LCDPS.4
void LCD_init(void){
LCDPS = 0b0010000; //WFT = 0(Type A waveform), BIASMD = 0(1/4 bias),
//LCDA = 1(lcd drive module is active), WA = 1(write allowed), LP = 0011(prescaling = 8:1)
//LCDSEx definition
LCDSE0 = 0xFF; //SEG<7:0> All Segment control
LCDSE1 = 0B10111111; //SEG<15:8> do not use 14
LCDSE2 = 0XFF; //SEG<23:16> All segment control
LCDSE3 = 0B11100111; //SEG<31:24>
//LCDCON setup
LCDCON = 0b10011011; // LCDEN = 1, /SLPEN = 1, WERR = 0,unimplemented, CS<1:0> = 10(LFINTOSC/32), LMUX<1:0> = 11(use 4 commons)
LCDREG = 0B00111100;//Unemplemented, CPEN = 0, BIAS<2:0> = 111, MODE13 = 1, CKSEL<1:0> = 00(regulator disabled)s
}
void init_rtn(void){
osccon = 0x71;
LCD_INIT();
}
void update_display(void){
lcd_symbol(digit_map[digit_values[1]], digit1);
lcd_symbol(digit_map[digit_values[2]], digit2);
lcd_symbol(digit_map[digit_values[3]], digit3);
lcd_symbol(digit_map[digit_values[4]], digit4);
lcd_symbol(digit_map[digit_values[5]], digit5);
lcd_symbol(digit_map[digit_values[6]], digit6);
lcd_symbol(digit_map[digit_values[7]], digit7);
// lcd_symbol(digit_map[digit_values[8]], digit8);
// lcd_symbol(digit_map[digit_values[9]], digit9);
lcd_symbol(digit_map[digit_values[10]], digit10);
//lcd_symbol(digit_map[digit_values[11]], digit11);
//lcd_symbol(digit_map[digit_values[12]], digit12);
// lcd_symbol(digit_map[digit_values[13]], digit13);
//lcd_symbol(upper_dot, DOTH);
//lcd_symbol(lower_dot, DOTL);
//lcd_symbol(rate_volume, RATE_VOLUME_MODE);
//lcd_symbol(rate_time, RATE_TIME_MODE);
//lcd_symbol(total_volume, TOTAL_VOLUME_MODE);
}
void main(void){
int8 counter;
int8 counter0;
init_rtn();
delay_ms(1000);
trisb = 0b10111111;
portb = 0b01000000;
update_display();
//while(1);
}
|
I experimented by commenting out some of the LCD_symbol
but get error
Error 53 "main.c" Line 136(13,17): Expecting function name ::
or
Error 12 "main.c" Line 136(13,17): Undefined identifier :: CCP_COMPARE_SET_ON_MATCH
My compiler version is 4.057
Do somebody have same experience or have any idea why it's producing error? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Aug 10, 2009 12:08 pm |
|
|
That's not a complete test program. It's lacking the #include, #fuses,
#use delay(), #byte statements for registers, some function definitions,
and variable declarations.
Add those things, test it, post the code, and indicate the exact lines
that generate an error (not just with the line number, but put a comment
on the line that causes an error).
Make the test program be as short as possible. |
|
|
paularina Guest
|
sorry, some of the coding some how got left out |
Posted: Mon Aug 10, 2009 8:08 pm |
|
|
Code: |
//Main.c
#include<18F65J90.h>
#include<def_18F65J90.h>
#fuses intrC
#use delay(clock = 8000000)
//DIGIT DEFINITION
//****************DP*******G*********F*******E********D********C********B*******A***
#define DIGIT1 COM0+0, COM2+31, COM3+31, COM1+31, COM0+31, COM1+0, COM2+0, COM3+0
#define DIGIT2 COM0+2, COM2+1, COM3+1, COM1+1, COM0+1, COM1+2, COM2+2, COM3+2
#define DIGIT3 COM0+4, COM2+3, COM3+3, COM1+3, COM0+3, COM1+4, COM2+4, COM3+4
#define DIGIT4 COM0+6, COM2+5, COM3+5, COM1+5, COM0+5, COM1+6, COM2+6, COM3+6
#define DIGIT5 COM0+9, COM2+7, COM3+7, COM1+7, COM0+7, COM1+9, COM2+9, COM3+9
#define DIGIT6 COM0+24, COM2+25, COM3+25, COM1+25, COM0+25, COM1+24, COM2+24, COM3+24
#define DIGIT7 COM0+22, COM2+23, COM3+23, COM1+23, COM0+23, COM1+22, COM2+22, COM3+22
#define DIGIT8 COM0+20, COM2+21, COM3+21, COM1+21, COM0+21, COM1+20, COM2+20, COM3+20
#define DIGIT9 COM0+19, COM2+26, COM3+26, COM1+26, COM0+26, COM1+19, COM2+19, COM3+19
#define DIGIT10 COM0+15, COM2+18, COM3+18, COM1+18, COM0+18, COM1+15, COM2+15, COM3+15
#define DIGIT11 COM0+13, COM2+29, COM3+29, COM1+29, COM0+29, COM1+13, COM2+13, COM3+13
#define DIGIT12 COM0+16, COM2+17, COM3+17, COM1+17, COM0+17, COM1+16, COM2+16, COM3+16
#define DIGIT13 COM0+11, COM2+12, COM3+12, COM1+12, COM0+12, COM1+11, COM2+11, COM3+11
//Dot definition
//dot_places 1 2 3 4
#define dotH COM0+0, COM0+2, COM0+4, COM0+6
//dot_places 6 7 8 9 10 11 12
#define dotL COM0+24, COM0+22, COM0+20, COM0+19, COM0+15, COM0+13, COM0+16
//mode definition
// T1(m3) T2(LIT) T3(NM3) T4(NLIT)
#define rate_volume_mode COM3+8, COM2+8, COM1+8, COM0+8
// /SEC /MIN /HR /DAY
#define rate_time_mode COM3+30, COM2+30, COM1+30, COM0+30
// T5(M3) T6(LIT) T3(NM3) T4(NLIT3)
#define total_volume_mode COM3+10, COM2+10, COM1+10, COM0+10
//indexing
#DEFINE EMPTY 10
#DEFINE A 11
#DEFINE C 12
#DEFINE D 13
#DEFINE E 14
#DEFINE F 15
#DEFINE I 16
#DEFINE N 17
#DEFINE O 18
#DEFINE P 19
#DEFINE T 20
#DEFINE U 21
#DEFINE L 22
#DEFINE DASH 23
#DEFINE M_PART 24 //second part of m i.e. n+mpart = m
const int8 DIGIT_MAP[25]= {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x27, 0x7F, 0x67
,0X00, 0X77, 0X39, 0X5E, 0X79, 0X71, 0X06, 0X54, 0X5C, 0X73
,0X78, 0X3E,0x38, 0X40, 0X88};
//Display value storage variables.
int8 digit_values[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int8 upper_dot = 0b00010000;
int8 lower_dot = 0b01000000;
int8 rate_volume = 0B00100000;
int8 rate_time = 0B10000000;
int8 total_volume = 0B010000001;
//Mode flags
int8 mode_flag1;
//#bit ACC_TOT_MODE = mode_flag.1
#bit WA = LCDPS.4
void LCD_init(void){
LCDPS = 0b0010000; //WFT = 0(Type A waveform), BIASMD = 0(1/4 bias),
//LCDA = 1(lcd drive module is active), WA = 1(write allowed), LP = 0011(prescaling = 8:1)
//LCDSEx definition
LCDSE0 = 0xFF; //SEG<7:0> All Segment control
LCDSE1 = 0B10111111; //SEG<15:8> do not use 14
LCDSE2 = 0XFF; //SEG<23:16> All segment control
LCDSE3 = 0B11100111; //SEG<31:24>
//LCDCON setup
LCDCON = 0b10011011; // LCDEN = 1, /SLPEN = 1, WERR = 0,unimplemented, CS<1:0> = 10(LFINTOSC/32), LMUX<1:0> = 11(use 4 commons)
LCDREG = 0B00111100;//Unemplemented, CPEN = 0, BIAS<2:0> = 111, MODE13 = 1, CKSEL<1:0> = 00(regulator disabled)s
}
void init_rtn(void){
osccon = 0x71;
LCD_INIT();
}
void update_display(void){
lcd_symbol(digit_map[digit_values[1]], digit1);
lcd_symbol(digit_map[digit_values[2]], digit2);
lcd_symbol(digit_map[digit_values[3]], digit3);
lcd_symbol(digit_map[digit_values[4]], digit4);
lcd_symbol(digit_map[digit_values[5]], digit5);
lcd_symbol(digit_map[digit_values[6]], digit6);
lcd_symbol(digit_map[digit_values[7]], digit7);
lcd_symbol(digit_map[digit_values[8]], digit8);
lcd_symbol(digit_map[digit_values[9]], digit9);
lcd_symbol(digit_map[digit_values[10]], digit10);
//lcd_symbol(digit_map[digit_values[11]], digit11);
//lcd_symbol(digit_map[digit_values[12]], digit12);
lcd_symbol(digit_map[digit_values[13]], digit13);
lcd_symbol(upper_dot, DOTH);
lcd_symbol(lower_dot, DOTL);
lcd_symbol(rate_volume, RATE_VOLUME_MODE);
//lcd_symbol(rate_time, RATE_TIME_MODE);
//lcd_symbol(total_volume, TOTAL_VOLUME_MODE);
}
void main(void){
delay_ms(1000);
update_display();
//while(1);
}
|
depending on how many lcd_symbol I have crossed out in update_display, the compiler displays error. on delay_ms function |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Aug 10, 2009 8:29 pm |
|
|
I compiled your code with vs. 4.057 and got a GPF. I compiled it with vs.
4.095 and vs. 4.096 and it compiled OK.
I think you have the same problem as described at the end of this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=39555 |
|
|
paularina Guest
|
|
Posted: Tue Aug 11, 2009 12:23 am |
|
|
So it seems I have to buy a new compiler version (please DO correct me if I am wrong (I want to save money)).
Currently I own
IDE PCB, PCM, PCH, PCD versions 4.057
for PIC 18F65J90,
Can I buy only PCH($200) compiler and add to existing bundle? or Do I have to buy all of them($500 or $600)?
What are the advantages and disadvantages of buying them individually and buying them all at once?
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Aug 11, 2009 12:44 am |
|
|
To cure the GPF problem with that PIC and the lcd_symbol() function,
I think you do need to upgrade. But, I don't have an LCD board to
test the current version of PCH in hardware. There might be other bugs
with the lcd_symbol() function that remain to be discovered for the
18F65J90. You might have to work with CCS to get them fixed.
Do you have the individual command line compilers ? Or the IDE ?
You probably have the PCWHD IDE compiler. CCS shows the price
for one year "maintenance" (i.e., download rights) for PCWHD on
this page:
http://www.ccsinfo.com/content.php?page=Purchasing1
It would be cheaper if you wrote your own version of the lcd_symbol()
function. You could make a test program that compiles OK. In other
words, use parameters that don't cause a GPF. Then study the .LST file
to see what they're doing. Put the list file format in "Symbolic" mode in
the project options settings. (Assuming the registers are shown correctly
in your version). Then write your own code to duplicate the lcd_symbol()
function. |
|
|
paularina Guest
|
|
Posted: Tue Aug 11, 2009 4:41 am |
|
|
For me, the most cost vs. time effective solution seems to be buying only PCH part only.
If i buy that part of compiler only, Would i be able to use updated version of the compiler for 18F family? |
|
|
paularina Guest
|
|
Posted: Tue Aug 11, 2009 4:47 am |
|
|
By the way, I am currently using MPLAB IDE
Say, for example, if I only have PCH purchased.
Can I still use only PCH plus plug in to write codes in C and compile??
I am very uninformed because the person who got me started in learning PIC
has set up the development environment for me and now, I can't contact him.
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Aug 11, 2009 1:12 pm |
|
|
Quote: | Currently I own IDE PCB, PCM, PCH, PCD versions 4.057 |
I didn't read your post closely enough before. You do have the IDE
version.
Quote: | By the way, I am currently using MPLAB IDE |
But apparently someone has installed MPLAB and you're using it instead
of the CCS IDE (but with the compilers installed in the IDE's directory).
The CCS IDE compiler is probably installed in this directory:
Quote: | c:\Program Files\Picc |
That's normally where the command line PCH compiler would be installed,
if you bought it. Installing it there would over-write the vs. 4.057 files.
The 4.057 versions of PCB, PCH, and PCD might not work correctly any
more, because vs. 4.096 might not be "in sync" with vs. 4.057 with
respect to DLL files, etc.
I suppose you could install the PCH command line compiler in a different
directory than c:\Program Files\Picc. I've never tried that.
To use it in MPLAB, you would then have to specify different paths for
the compiler files. Then you couldn't use the other IDE compilers.
(I think). It's a mess. I don't really want to have to figure this out for
you. You don't have control over the IDE, I gather. Someone else
installed it for you.
I don't know if CCS allows you to buy "maintenance" for PCH (which
would be cheaper than buying a "new" PCH command line compiler)
if you already have the full IDE. This assumes you have the full IDE
in a legal way.
My advice is, talk to CCS about it. I don't really want to do a lot of
tech support on installing various versions of CCS. |
|
|
|
|
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
|