View previous topic :: View next topic |
Author |
Message |
Georg Prinz
Joined: 07 Jan 2004 Posts: 22 Location: Frankfurt, Germany
|
struct problem |
Posted: Sun Jan 30, 2005 1:13 pm |
|
|
Hi folks,
can anybody help me out with following problem:
I'am working with compiler PCWH version 3.212 trying to compile following code and I get the message at the struct "undifined indentifier ? highlightening the part "stru" :
////////////////////////////////////////////////////////////////////////////////
#include "18F252.h" // Standard header file
#device *=16 // switch to lager pointers ?necessary???
#device ICD=TRUE // Set debugger mode
#use delay(clock=4000000)
#FUSES XT,NOPROTECT,NOBROWNOUT,NOWDT,NOSTVREN,DEBUG,NOLVP,NOWRT,NOWRTB,NOWRTC
#FUSES NOCPD,NOCPB,NOEBTR,NOEBTRB
////////////////////////////////////////////////////////////////////////////////
//
// Definition of hardware related variables
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////// PORT A ////////////////////////////////////
// Byte location at F80h = 3968
#define BMENU PIN_A6 // Input MENU-button
#define BSEL PIN_A7 // Input Select-button
////////////////////////////////// PORT B ////////////////////////////////////
// Byte location at F81h = 3969
// Bit definition for LCD
unsigned char PORTB;
#locate PORTB=F81h
struct Port_b_layout
{
unsigned char BB:1; // bit 0 Encoder B - Interrupt
unsigned char LCD4:1; // bit 1 LCD-bit 4
unsigned char LCD3:1; // bit 2 LCD-bit 3
unsigned char LCD2:1; // bit 3 LCD-bit 2
unsigned char LCD1:1; // bit 4 LCD-bit 1
unsigned char BA:1; // bit 5 LCD-bit 4 Encoder A
unsigned char PINB6:1; // bit 6
unsigned char PINB7:1; // bit 7
};
struct port_b_layout PORTBbits;
#locate PORTBbits=F81h
//////////////////////////////////// PORT C //////////////////////////////////
// Byte location at F82h /////////////////////////////////
// Bit definition for LCD continued
unsigned char PORTC;
#locate PORTC=F82h
struct
{
unsigned char RS:1; // Bit 0 Encoder B - Interrupt
unsigned char LCD0:1; // Bit 1 LCD actual bit in Port C
unsigned char RW:1; // Bit 2 LCD control bit in Port C
unsigned char ENA:1; // Bit 3 LCD control bit in Port C
unsigned char LCD5:1; // Bit 4 LCD actual bit in Port C
unsigned char LCD6:1; // Bit 5 LCD actual bit in Port C
unsigned char Pinc6:1;
unsigned char LCD7:1; // Bit 7 LCD actual bit in Port C
} PORTCbits;
#locate PORTCbits=F82h
Does anyone have an idea what I'am massing up?
Saludos and thanks
George _________________ dl 2 kp |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Sun Jan 30, 2005 3:32 pm |
|
|
The CCS compiler is terrible with it's error messages, often the error is in the line before the line indicated.
In C you write hex digits by starting with a '0x' and you don't write the trailing 'h' character, so replace:by Code: | #locate PORTB=0xF81 |
Repeat for the other 3 hex values. |
|
|
Guest
|
struct |
Posted: Tue Feb 01, 2005 3:34 am |
|
|
Thank you for reply and the helpful hint!javascript:emoticon('')
Very Happy
This happens when taking parts of program from others. The program was compiled correctly but loading to the 18f252 generated an fuse error on "NOCPD". It said that actual value does not match the intended.
I'am using the U-40 kit with software version 1.35.
javascript:emoticon('')
Confused
Do you have an idea about the fuses? |
|
|
Georg Prinz
Joined: 07 Jan 2004 Posts: 22 Location: Frankfurt, Germany
|
Fuses and config word |
Posted: Wed Feb 02, 2005 1:10 am |
|
|
Hi Folks,
sometimes it's faster to change the chip instead of searching errors where no software errors are. So I tried a new one and everything is working fine!
Saludos and thanks for help. _________________ dl 2 kp |
|
|
|