View previous topic :: View next topic |
Author |
Message |
Andreas
Joined: 25 Oct 2004 Posts: 136
|
CCS Compiler with Microchip IDE Help required !! |
Posted: Thu Mar 08, 2007 7:45 am |
|
|
Hello friends
I got a very confusing problem:
I made a project with the CCS 4.024 and it will compile okay
Now I am using the same source files within the Microchip IDE
and I get this strange Error:
[/code]
Executing: "C:\PCW4024\Ccsc.exe" "flightrecorder.c" +FH +DF +LN +T -A +M +Z +Y=9 +EA
Memory usage: ROM=0% RAM=0% - 0%
0 Errors, 0 Warnings.
Executing: "C:\PCW4024\Ccsc.exe" "LCD2x8.c" +FH +DF +LN +T -A +M +Z +Y=9 +EA
*** Error 128 "C:\flightrecorder\LCD2x8.c" Line 1(0,0): A #DEVICE required before this line
1 Errors, 0 Warnings.
Code: |
Here are my source files:
|
#include "C:\flightrecorder\flightrecorder.h"
#include <stdio.h>
#include <string.h>
#define LCD_EN Pin_E5
#define RS Pin_E7
#define RW Pin_E6
#include "LCD2x8.c"
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_psp(PSP_DISABLED);
setup_spi(SPI_MASTER|SPI_L_TO_H|SPI_CLK_DIV_4);
setup_spi2(FALSE);
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_timer_4(T4_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_oscillator(False);
// TODO: USER CODE!!
}
Code: |
BYTE const LCD_INIT_STRING[4] = {0x38,0xc, 1, 2};
BYTE lcdline;
BYTE lcd_read_byte()
{
BYTE LCData;
set_tris_D(0xff);
Output_High(RW);
delay_cycles(1);
Output_High(LCD_EN);
delay_cycles(1);
LCData = Input_D();
Output_Low(LCD_EN);
delay_cycles(1);
set_tris_D(0x00);
return(LCData);
}
void lcd_send_byte( BYTE address, BYTE n )
{
Output_Low(RS);
while ( bit_test(lcd_read_byte(),7) ) ;
Output_Bit(RS,address);
delay_cycles(1);
Output_Low(RW);
set_tris_D(0x00);
delay_cycles(1);
Output_High(LCD_EN);
delay_cycles(1);
Output_D(n);
delay_cycles(1);
Output_Low(LCD_EN);
}
void lcd_init()
{
BYTE i;
set_tris_D(0x00);
Output_Low(RS);
Output_Low(RW);
Output_Low(LCD_EN);
delay_ms(15);
for(i=1;i<=3;++i)
{
Output_D(0x30);
delay_cycles(1);
Output_High(LCD_EN);
delay_us(2);
Output_low(LCD_EN);
delay_ms(5);
}
Output_D(0x02);
delay_cycles(1);
Output_High(LCD_EN);
delay_us(2);
Output_low(LCD_EN);
for(i=0;i<=3;++i)
lcd_send_byte(0, LCD_INIT_STRING[i]);
}
void lcd_gotoxy( BYTE x, BYTE y) {
BYTE address;
switch(y) {
case 1 : address=0x80;break;
case 2 : address=0xC0;break;
case 3 : address=0x94;break;
case 4 : address=0xd4;break;
}
address+=x-1;
lcd_send_byte(0,address);
}
void lcd_putc( char c) {
switch (c) {
case '\f' : lcd_send_byte(0,1);
lcdline=1;
delay_ms(2);
break;
case '\n' : lcd_gotoxy(1,2); break;
case '\b' : lcd_send_byte(0,0x10); break;
default : lcd_send_byte(1,c); break;
}
}
|
I tried almost everything to get rid of this error, when I insert a device Statement the compiler tells me that at this point its not allowed !
Somebody out there has an idea ????
best regards
Andrea |
|
|
mindstorm88
Joined: 06 Dec 2006 Posts: 102 Location: Montreal , Canada
|
|
Posted: Thu Mar 08, 2007 8:01 am |
|
|
where is located "LCD2x8.c" on your computer ??? |
|
|
Andreas
Joined: 25 Oct 2004 Posts: 136
|
|
Posted: Thu Mar 08, 2007 8:03 am |
|
|
Hi mindstorm,
All files in the same directory located !
I just tried it with a complete Directory spec, same result
best regards
Andreas |
|
|
kevcon
Joined: 21 Feb 2007 Posts: 142 Location: Michigan, USA
|
|
Posted: Thu Mar 08, 2007 8:32 am |
|
|
You need to have an include statment for the specific processor you are using.
Like
#include "18F65J10.h" |
|
|
Andreas
Joined: 25 Oct 2004 Posts: 136
|
|
Posted: Thu Mar 08, 2007 8:39 am |
|
|
The include statement for the processor is in the flightrecorder.h file , first statement,
Keep in mind, the same files and setup is compiling in CCS IDE without a problem !!!!
thanks and best regards
ANdreas |
|
|
kevcon
Joined: 21 Feb 2007 Posts: 142 Location: Michigan, USA
|
|
Posted: Thu Mar 08, 2007 9:21 am |
|
|
Hi Andreas,
I just built a project from the code you provided and it built with no problem.
Though I did have to comment out the delay_ms and delay_us because there is no #use delay statment that I could see.
Also it didn't like the blank #include statments.
Kevin |
|
|
Andreas
Joined: 25 Oct 2004 Posts: 136
|
|
Posted: Thu Mar 08, 2007 9:33 am |
|
|
Hi kevcon ,
its strange, i included now the whole file into the main source and this will compile correct !
Can You pls send me your compiler setup, like
"LCD.c" +FH +DF +LN +T -A +M +Z +Y=9 +EA
maybe something is wrong with this settings ?!?!?
My workaround is now to work with the CCS IDE and then load the .hex with the Mplab, My major problem is that the ICD-U40 is not recognizing the 18F87J10 processor, I tried allready 2 different units and also a firmware update, no success by now.
Thanks for Your help
best regards
Andreas |
|
|
kevcon
Joined: 21 Feb 2007 Posts: 142 Location: Michigan, USA
|
|
Posted: Thu Mar 08, 2007 9:39 am |
|
|
Try removing the LCD2x8.c from the the source file list.
If I add it I get the same error that you do. |
|
|
Andreas
Joined: 25 Oct 2004 Posts: 136
|
|
Posted: Thu Mar 08, 2007 9:52 am |
|
|
Hello kevcon !
Thats it !!!
I am suprised, maybe I missunderstood the term "source file" ????
Thanks a lot for this quick help.
Have a nice day and best regards
Andreas out of Vienna(Austria) |
|
|
noname Guest
|
|
Posted: Thu Mar 08, 2007 3:26 pm |
|
|
Your interpretation of the term "source file" is correct. This issue is one of the first thing you learn when using CCS compiler within MPLAB (I don't know how it's from CCS IDE). Since CCS don't us a conventional linker you can only have one source file (main file with #device etc.) in the "Source Files" folder. Add the other .c files in the "Other Files" folder.
Not intuitive? You can always write to CCS and complain. If you are used to normal linking you will soon discover that you'll get a lot of errors. You cannot use source and headers in a normal fashion. CCS compiler reads all files from top of the file included in the "Source Files" folder, line by line down, as if you written all source code within a single (large) file. |
|
|
noizy
Joined: 17 Sep 2003 Posts: 7 Location: Vienna, Austria
|
|
Posted: Fri Jun 08, 2007 8:46 am |
|
|
Hello kevcon,
you solved the same problem for me! Thank you.
I was not aware of this because I just recently switched back from the crappy CCS IDE 4.x to MPLAB (with the CCS compiler plugin).
Cheers! |
|
|
|