|
|
View previous topic :: View next topic |
Author |
Message |
truread
Joined: 09 Jul 2009 Posts: 2
|
problem with Picdem LCD2 |
Posted: Sun Jul 12, 2009 12:25 pm |
|
|
I have just purchased a PICDEM LCD2 board.
The processor is a PIC18F85J90
I am evaluating different compilers for a project. I am new to the CCS compiler.
Code I wrote is below and when I select backplane COM1 it comes back with an error saying function lcd_symbol() not defined.
When I hover over lcd_symbol(0xff,digit_f1); it says lcd_symboldelay().
Any ideas what is wrong?
If I set COM to COM0 it compiles but does not run.
Header:
Code: |
#include <18F85J90.h>
#device ICD=TRUE
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES DEBUG //Debug mode for use with ICD
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES NOSTVREN //Stack full/underflow will not cause reset
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOFCMEN //Fail-safe clock monitor disabled
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES PRIMARY //Primary clock is system clock when scs=00
#FUSES RESERVED //Used to set the reserved FUSE bits
#use delay(clock=8000000)
|
MAIN:
Code: |
#include "D:\pic_lcd\main.h"
#include <stdio.h>
#define DIGIT_F1 COM1+18
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_spi(SPI_SS_DISABLED);
setup_lcd(LCD_MUX14,2);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_oscillator(OSC_8MHZ|OSC_INTRC|OSC_31250|OSC_PLL_OFF);
lcd_symbol(0xff,digit_f1);
}
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jul 12, 2009 12:45 pm |
|
|
Post your compiler version. |
|
|
truread
Joined: 09 Jul 2009 Posts: 2
|
version |
Posted: Sun Jul 12, 2009 12:51 pm |
|
|
version is 4.084 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jul 12, 2009 1:03 pm |
|
|
The code that you posted compiles OK with vs. 4.084. Post the code
that fails, so I can duplicate the problem. |
|
|
Guest
|
more input |
Posted: Sun Jul 12, 2009 1:18 pm |
|
|
I have changed the example 92LCD to below;
I have rechecked and the version I have is 4.068 not 4.084.
Comes back with the following:
*** Error 112"test_92LCD.c " Line 81 (1,1): function used but not defined
If I miss out the last delay_ms(100):
it works.
Code: |
#include <18f85j90.h>
#fuses HS,NOWDT
#use delay(clock=20000000)
/////////////////////////////////////////////////////////////////////////////////////////
// LCD Configuration //
/////////////////////////////////////////////////////////////////////////////////////////
// Digit segments A B C D E F G DP
// b7 b6 b5 b4 b3 b2 b1 b0
#define DIGIT4 COM1+26, COM1+17, COM2+17, COM3+26, COM2+25, COM1+25, COM2+26, COM3+17
#define DIGIT3 COM1+24, COM1+16, COM2+16, COM3+24, COM2+23, COM1+23, COM2+24, COM3+16
#define DIGIT2 COM1+22, COM1+19, COM2+19, COM3+22, COM2+21, COM1+21, COM2+22, COM3+19
#define DIGIT1 COM1+20, COM1+18, COM2+18, COM3+20, COM2+28, COM1+28, COM2+20, COM3+18
//
// character 0 1 2 3 4 5 6 7 8 9
byte const Digit_Map[10] = {0xFC,0x60,0xDA,0xF2,0x66,0xB6,0xBE,0xE0,0xFE,0xE6};
#define BLANK 0
#define DASH 11
/////////////////////////////////////////////////////////////////////////////////////////
byte lcd_pos;
void lcd_putc(char c) {
byte segments;
if(c=='\f')
lcd_pos=0;
else {
if((c>='0')&&(c<='9'))
segments=Digit_Map[c-'0'];
else
segments=BLANK;
switch(lcd_pos) {
case 1 : lcd_symbol(segments,DIGIT4); break; // fill 1000s place
case 2 : lcd_symbol(segments,DIGIT3); break; // fill 100s place
case 3 : lcd_symbol(segments,DIGIT2); break; // fill 10s place
case 4 : lcd_symbol(segments,DIGIT1); break; // fill 1s place
}
}
lcd_pos++;
}
void main() {
long number = 0;
setup_lcd(LCD_MUX14,LCD_INTRC);
while(TRUE) {
printf(lcd_putc,"\f%4lu",number);
if(number++==10000)
number=0;
delay_ms(100);
}
} |
|
|
|
Guest
|
more info |
Posted: Sun Jul 12, 2009 1:36 pm |
|
|
It only appears to be a problem with the 18F85J90.
Changing to another micro seems to work.
Also it fails with the delay_ms() line.
Chaning to delay_uS(100) is OK. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jul 12, 2009 3:17 pm |
|
|
I think there's a bug in the lcd_symbol() function with the 18F85J90.
Quote: | lcd_symbol(segments, 1, 2, 3, 4, 5, 6, 7, 155); |
If any of the segment parameters is greater than 155, it causes an
"access violation" on my system. '155' corresponds to COM3, seg12.
Anything higher causes an error. The segments can go up to seg47,
so clearly this is a limitation that shouldn't be there.
It's possible that in the PC-based compiler code that handles the
lcd_symbol() function, CCS did not allocate enough memory for an
array. If you try to compile code that has a segment value that's greater
than 155, it exceeds the boundary of the array and this causes
an "Access violation in Module PCH.DLL" error in Windows.
So I think it's a compiler bug. They may not have tested lcd_symbol()
with the 18F85J90 sufficiently. I emailed CCS a bug report on this.
I tested this with PCH vs. 4.093.
Update: CCS says this bug will be fixed in the next release, which
presumably will be vs. 4.094, or maybe 4.100. |
|
|
Fausto
Joined: 26 Mar 2007 Posts: 2
|
|
Posted: Tue Sep 29, 2009 3:33 am |
|
|
Quote: |
Update: CCS says this bug will be fixed in the next release, which
presumably will be vs. 4.094, or maybe 4.100. |
I must develop a project with PIC18F85J90 but I'm a little worried about this topic.
Is the ver. 4.099 ok about this ? I have the ver 4.059 and I must buy the newer 4.099.
Can you send me a copy of PIC18F85j90.h file ?
Tks a lot
Fausto Tagliazucchi
fausto@effeti.biz |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Sep 29, 2009 11:07 am |
|
|
Quote: | Is the ver. 4.099 ok about this |
It doesn't crash. It compiles OK with vs. 4.099. But I don't have a
LCD board to test it with, so I don't know if the code actually works.
There could still be other bugs.
Quote: | Can you send me a copy of PIC18F85j90.h file ? |
We're not allowed to do that. It won't make any difference, anyway.
The problem with the crashing is in the PCH.DLL file for vs. 4.093 and earlier. |
|
|
|
|
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
|