AnsweredAssumed Answered

structure @0xXXXX

Question asked by Gene Letchford on Aug 9, 2017
Latest reply on Feb 10, 2018 by dhenry

I am trying to create a bit structure at a specified location (in this case at 0x500A the portc odr)

below is in common.h

struct iobits
unsigned char b0:1;
unsigned char b1:1;
unsigned char b2:1;
unsigned char b3:1;
unsigned char b4:1;
unsigned char b5:1;
unsigned char b6:1;
unsigned char b7:1;
extern struct iobits oportc;


and this is in the main.c file


 at 0x500A struct iobits oportc;


This works with Raisonance compiler, but not the Cosmic.

I then read that the Cosmic needed the following format

struct iobits oprotc @0x500A;


However an error occurs as follows:-

#error clnk Debug\lcc.lkf:1 bad address (0x500a) for zero page symbol _oportc


If I declare it without absolute address or another variable with the same format it works.

In common.h

extern struct iobits oportc;
extern oportd;


and in main.c


 struct iobits oportc;
 oportd @0x500A;
void main(void){

 oportd = 0x55;   // this is located at 0x500A
 op_str = 1;         // this is located in page zero.


Any help would be most appreciated.