Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Error with Struct Building

Status
Not open for further replies.

cmancuso

New Member
After reading over several forums and many posts, I created a custom union type struct for bitwise operations. I followed the p18f452.h header style for the format of the structure. If I just compile the files without invoking the actual variable in code, the code compiles fine. If I go to use the variable I get the error of
MPLINK 4.22, Linker
Copyright (c) 2008 Microchip Technology Inc.
Error - could not find definition of symbol 'CMXCONTROL' in file './cmx.o'.
Errors : 1

A copy of my code snippet is provided below.

Code:
//Bit Control of the CMX's Control Register
extern volatile near unsigned char       CMXCONTROL;
extern volatile near union {
  struct {
    unsigned PLLBW:2;
    unsigned LEVRES:2;
    unsigned DARA:1;
    unsigned HILON:1;
    unsigned CKDIV:2;
  };
  struct {
    unsigned PLLBWLOW:1;
    unsigned PLLBWHIGH:1;
    unsigned LEVRESLOW:1;
    unsigned LEVRESHIGH:1;
    unsigned DARA:1;
    unsigned HILON:1;
    unsigned CKDIVLOW:1;
    unsigned CKDIVHIGH:1;
  };  
  struct {
    unsigned PLLBW1:1;
    unsigned PLLBW2:1;
    unsigned LEVRES1:1;
    unsigned LEVRES2:1;
    unsigned DARA:1;
    unsigned HILON:1;
    unsigned CKDIV1:1;
    unsigned CKDIV2:1;
  };  
} CMXCONTROLbits;

Code:
void TransmitTQB(unsigned char * pointer)
{
    CMXCONTROL = 0x00;
    CMXCONTROLbits.PLLBW1 = 0;
    
	while(1);
}

Anyone know how to fix this error so I can invoke this way of accessing a variable?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top