|
|
View previous topic :: View next topic |
Author |
Message |
Eddy71ua
Joined: 23 Sep 2009 Posts: 55 Location: Ukraine
|
PIC18F4410 & PCWHD V4.119 WDT and LCD not work? [SOLVED] |
Posted: Wed Apr 06, 2011 6:18 am |
|
|
Today I tried the wizard to create a project file for the PIC18F4410. As a result, the file will not compile.
Code: |
#include <18F4410.h>
#include <lcd.c>
#device adc=10
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOFCMEN //Fail-safe clock monitor disabled
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES NOBROWNOUT //No brownout reset
#FUSES BORV27 //Brownout reset at 2.7V
#FUSES NOPBADEN //PORTB pins are configured as digital I/O on RESET
#FUSES NOLPT1OSC //Timer1 configured for higher power operation
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOSTVREN //Stack full/underflow will not cause reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES PROTECT //Code protected from reads
#FUSES CPB //Boot Block Code Protected
#FUSES WRTC //configuration registers write protected
#FUSES WRTB //Boot block write protected
#FUSES EBTR //Memory protected from table reads
#FUSES EBTRB //Boot block protected from table reads
#use delay(clock=26000000,RESTART_WDT)
#define ENABLE_PIN B0
#define RS_PIN B1
#define Data4 C4
#define Data5 C5
#define Data6 C6
#define Data7 C7
#int_RB
void RB_isr(void)
{
}
#int_CCP1
void CCP1_isr(void)
{
}
#int_COMP
void COMP_isr(void)
{
}
void main()
{
char k;
setup_adc_ports(AN0_TO_AN3);
setup_wdt(WDT_ON);
setup_wdt(WDT_2304MS); //~2.3 s reset
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); //10.0 ms overflow
setup_timer_1(T1_INTERNAL|T1_DIV_BY_1); //10.0 ms overflow
setup_timer_2(T2_DIV_BY_16,202,1); //499 us overflow, 499 us interrupt
setup_timer_3(T3_INTERNAL|T3_DIV_BY_1);
setup_ccp1(CCP_CAPTURE_RE);
setup_ccp2();
set_pwm2_duty(404);
setup_comparator(A0_VR_A1_VR);
setup_vref(VREF_LOW|5|VREF_COMP);
enable_interrupts(INT_RB);
enable_interrupts(INT_CCP1);
enable_interrupts(INT_COMP);
disable_interrupts(GLOBAL);
lcd_init()
lcd_putc("\fReady...\n");
while(TRUE){
k = kbd_getc();
if(k!=0)
if(k=='*')
lcd_putc('\f');
else
lcd_putc(k);
}
}
|
Here is a compilation error messages
Quote: |
Executing: "C:\Program files\Picc\CCSC.exe" +FH "FMetr.c" +DF +LN +T +A +M +Z +Y=9 +EA
*** Error 12 "C:\Program Files\PICC\drivers\lcd.c" Line 213(12,13): Undefined identifier -- delay_us
*** Error 12 "C:\Program Files\PICC\drivers\lcd.c" Line 265(12,13): Undefined identifier -- delay_us
*** Error 12 "C:\Program Files\PICC\drivers\lcd.c" Line 318(12,13): Undefined identifier -- delay_ms
*** Error 12 "C:\Program Files\PICC\drivers\lcd.c" Line 323(16,17): Undefined identifier -- delay_ms
*** Error 12 "C:\Program Files\PICC\drivers\lcd.c" Line 328(12,13): Undefined identifier -- delay_ms
*** Error 12 "C:\Program Files\PICC\drivers\lcd.c" Line 363(30,31): Undefined identifier -- delay_ms
*** Error 23 "FMetr.c" Line 4(8,9): Can not change device type this far into the code
*** Error 48 "FMetr.c" Line 4(9,12): Expecting a (
*** Error 43 "FMetr.c" Line 4(13,15): Expecting a declaration
*** Error 48 "FMetr.c" Line 33(0,6): Expecting a (
*** Error 12 "FMetr.c" Line 60(11,21): Undefined identifier WDT_2304MS
*** Error 51 "FMetr.c" Line 66(12,13): A numeric expression must appear here
*** Error 76 "FMetr.c" Line 76(1,9): Expect ;
*** Error 12 "FMetr.c" Line 79(19,20): Undefined identifier -- kbd_getc
14 Errors, 0 Warnings.
Halting build on first failure as requested.
BUILD FAILED: Wed Apr 06 15:17:01 2011
|
What am I doing wrong?
Help please.
Last edited by Eddy71ua on Wed Apr 06, 2011 3:05 pm; edited 3 times in total |
|
|
Eddy71ua
Joined: 23 Sep 2009 Posts: 55 Location: Ukraine
|
|
Posted: Wed Apr 06, 2011 7:00 am |
|
|
I remove from project library of LCD, the project compiles if I not use setting WDT.
Quote: |
Executing: "C:\Program files\Picc\CCSC.exe" +FH "FMetr.c" +DF +LN +T +A +M +Z +Y=9 +EA
*** Error 12 "FMetr.c" Line 62(11,21): Undefined identifier WDT_2304MS
1 Errors, 0 Warnings.
Halting build on first failure as requested.
BUILD FAILED: Wed Apr 06 15:55:43 2011
|
Why setting WDT is not accepted by the compiler? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Apr 06, 2011 1:00 pm |
|
|
Look in the 18F4410.h file. You won't see any settings for the WDT in
the WDT section. They are all in the #fuses section at the top of the file.
You set the WDT period with #fuses in this PIC.
Which means, don't trust the "Wizard" to be correct. You still need to
read the PIC data sheet and the .h file for the PIC.
Regarding the #include line for lcd.c, it must be placed below the
line for #use delay(). The compiler reads the source file from top to
bottom. It must "see" the #use delay() library line before it sees any
delay_us() or delay_ms() lines. The lcd.c file has those delay lines in it.
You need to read the forum every day, if you're new to the compiler.
Look at how we put together a program. Notice where we put the lines
for #include files, etc. |
|
|
Eddy71ua
Joined: 23 Sep 2009 Posts: 55 Location: Ukraine
|
|
Posted: Wed Apr 06, 2011 3:04 pm |
|
|
Thank you, PCM programmer. I'll remember your advice for the future. |
|
|
|
|
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
|