CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

struct problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Georg Prinz



Joined: 07 Jan 2004
Posts: 22
Location: Frankfurt, Germany

View user's profile Send private message Send e-mail

struct problem
PostPosted: Sun Jan 30, 2005 1:13 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jan 30, 2005 3:32 pm     Reply with quote

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:
Code:
#locate PORTB=F81h
by
Code:
#locate PORTB=0xF81

Repeat for the other 3 hex values.
Guest








struct
PostPosted: Tue Feb 01, 2005 3:34 am     Reply with quote

Thank you for reply and the helpful hint!javascript:emoticon('Very Happy')
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')
Confused

Do you have an idea about the fuses?
Georg Prinz



Joined: 07 Jan 2004
Posts: 22
Location: Frankfurt, Germany

View user's profile Send private message Send e-mail

Fuses and config word
PostPosted: Wed Feb 02, 2005 1:10 am     Reply with quote

Very Happy 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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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