View Single Post
  #12   Spotlight this post!  
Unread 07-12-2003, 21:55
Jay Lundy Jay Lundy is offline
Programmer/Driver 2001-2004
FRC #0254 (The Cheesy Poofs)
Team Role: Alumni
 
Join Date: Jun 2001
Rookie Year: 2001
Location: Berkeley, CA
Posts: 320
Jay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to all
Re: EduBot and USART ports

Quote:
Originally Posted by Dave...
We're trying to use a digital compass (available from Digikey) Honeywell model HMR3100. See the datasheet at: http://www.magneticsensors.com/products.html

The ini_aliases.h header file has the following line:
#define usart2_RX PORTGbits.PORTG2
However, whenever I try to build the project with "usart2_RX" in my user code, I receive the following error:
Executing: "c:\mcc18\bin\mcc18.exe" -p=18F8520 "user_routines.c" -fo="user_routines.o" /i"C:\mcc18\h" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
C:\EduCode\user_routines.c:328:Error [1205] unknown member 'PORTG2' in '__tag_43'
Does anyone know what "unknown member" or "__tag_43" means and how I can resolve this issue?
That seems to be an error in their default code. Here is the PORTGbits struct from ifi_picdefs.h:

Code:
extern volatile near union {
  struct {
	unsigned RG0:1;
	unsigned RG1:1;
	unsigned RG2:1;
	unsigned RG3:1;
	unsigned RG4:1;
  };
  struct {
	unsigned CCP3:1;
	unsigned TX2:1;
	unsigned RX2:1;
	unsigned CCP4:1;
	unsigned CCP5:1;
  };
  struct {
	unsigned :1;
	unsigned CK2:1;
	unsigned DT2:1;
  };
} PORTGbits;
It looks like they wanted
Code:
#define usart2_RX       PORTGbits.RG2
or
Code:
#define usart2_RX       PORTGbits.RX2
etc...

which is the receive port for USART 2.

The error just doesn't show up if you don't use usart2_RX because the preprocessor doesn't insert PORTGbits.PORTG2 anywhere in the code and the compiler never sees it.