View previous topic :: View next topic |
Author |
Message |
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
Problem with PCM Programmers 20x4 flex driver |
Posted: Wed Apr 09, 2008 1:30 pm |
|
|
I cant seem to get a succesfull build of the program. It gives the following message:
Quote: | *** Error 128 "C:\Documents and Settings\Gertjie\My Documents\Puk files\Finale Jaar\Finale jaars projek\Flex_LCD420.c" Line 62(1,43): A #DEVICE required before this line
1 Errors, 0 Warnings.
Halting build on first failure as requested.
BUILD FAILED: Wed Apr 09 21:19:27 2008 |
I basically copied and pasted the program just as is and changed the pin configuration.
I am using a PIC16F886. Has anyone found the same proplem
The line 62(1,43) as in the error is indicated above the int8 lcd_line of the source file.
Code: | #define LCD_LINE_1_ADDRESS 0x00
#define LCD_LINE_2_ADDRESS 0x20
#define LCD_LINE_3_ADDRESS 0x40
#define LCD_LINE_4_ADDRESS 0x60
*/
//========================================
#define lcd_type 2 // 0=5x7, 1=5x10, 2=2 lines(or more)
int8 lcd_line;
int8 const LCD_INIT_STRING[4] =
{
0x20 | (lcd_type << 2), // Set mode: 4-bit, 2+ lines, 5x8 dots
0xc, // Display on
1, // Clear display
6 // Increment cursor
}; |
|
|
|
meereck
Joined: 09 Nov 2006 Posts: 173
|
|
Posted: Wed Apr 09, 2008 1:55 pm |
|
|
put #include "Flex_LCD.c"
after #device and #use delay
example:
Code: |
#include <18F2420.h>
#fuses //some unimportant fuses
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=RS232,errors)
#include "Flex_LCD.c"
void main()...etc
|
|
|
|
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
|
Posted: Wed Apr 09, 2008 2:00 pm |
|
|
I have done that already. The problem doesnt lie in the test program but in the driver program itself. I dont get an error from the test prog. The error lies in the driver prog
Code: | #include <16F886.h>
#fuses intrc, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
//int speed=0;
#include <Flex_LCD420.c> |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Apr 09, 2008 2:34 pm |
|
|
Post your compiler version. |
|
|
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
|
Posted: Wed Apr 09, 2008 2:38 pm |
|
|
ccs 4.33 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
|
Posted: Wed Apr 09, 2008 2:52 pm |
|
|
It is ccs 4.033. |
|
|
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
|
Posted: Wed Apr 09, 2008 4:06 pm |
|
|
I have reinstalled both the compiler and the mplab 8. Is the compiler i am using to old or what else could be the problem? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Apr 09, 2008 4:07 pm |
|
|
I installed that version of the compiler, and copied and pasted the code
into an MPLAB project, and it worked.
My advice is to re-install the compiler. |
|
|
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
|
Posted: Thu Apr 10, 2008 7:03 am |
|
|
I reinstalled the compiler and mplab but i have a strange problem.
If i keep the driver and the test program in the same .c file and i do not add the driver to the source files but directly above the main in the test program the setup works and i dont get an #device error anymore. Why would the compiler only allow one source file in my workspace? If someone has encountered this before please let me know. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Apr 10, 2008 8:26 am |
|
|
Are you adding both .c files to the list of source files in the MPLAB project ?
That's the problem. You can't do that with CCS. Only the main
file should be in the "Source Files" section in the MPLAB project window.
If you to put the other .c files in the Project Window, then add them
to the "Other Files" section. That's optional. It's only so you can
conveniently access them in the editor. |
|
|
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
|
Posted: Thu Apr 10, 2008 8:30 am |
|
|
Thanks. Silly schoolboy error but i guess thats how we learn. |
|
|
|