Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

accessing the bit from the header file

Status
Not open for further replies.

piyushpandey

Member level 4
Joined
Mar 26, 2012
Messages
70
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
2,051
Hi guys

I have accessed the bits of corresponding registers by the syntax REGISTERbits.bitno and through this syntax I get by default that particular bit to be showed in the MPLABX IDE but when I try to access the VCFG bit of the ADCON0 register I did not get that sort of automatic pop up window showing the list of bits defined in the structure, Instead I get the list of few bits and not all.

I am trying to access the VCFG bit from the ADCON0 register structure defined in the pic16f688 header file in the HiTECH compiler of version 9.83.

The structure code of the particular ADCON0 register is this:

Code:
// Register: ADCON0
volatile unsigned char           ADCON0              @ 0x01F;
// bit and bitfield definitions
volatile bit ADON                @ ((unsigned)&ADCON0*8)+0;
volatile bit GO_nDONE            @ ((unsigned)&ADCON0*8)+1;
volatile bit VCFG                @ ((unsigned)&ADCON0*8)+6;
volatile bit ADFM                @ ((unsigned)&ADCON0*8)+7;
volatile bit GO                  @ ((unsigned)&ADCON0*8)+1;
volatile bit CHS0                @ ((unsigned)&ADCON0*8)+2;
volatile bit CHS1                @ ((unsigned)&ADCON0*8)+3;
volatile bit CHS2                @ ((unsigned)&ADCON0*8)+4;
volatile bit nDONE               @ ((unsigned)&ADCON0*8)+1;
volatile bit GO_DONE             @ ((unsigned)&ADCON0*8)+1;
#ifndef _LIB_BUILD
volatile union {
    struct {
        unsigned	ADON                : 1;
        unsigned	GO_nDONE            : 1;
        unsigned	CHS                 : 3;
        unsigned	                    : 1;
        unsigned	VCFG                : 1;
        unsigned	ADFM                : 1;
    };
    struct {
        unsigned	: 1;
        unsigned	: 1;
        unsigned	: 3;
        unsigned	: 1;
        unsigned	: 1;
        unsigned	: 1;
    };
    struct {
        unsigned	: 1;
        unsigned	GO                  : 1;
        unsigned	CHS0                : 1;
        unsigned	CHS1                : 1;
        unsigned	CHS2                : 1;
    };
    struct {
        unsigned	: 1;
        unsigned	nDONE               : 1;
    };
    struct {
        unsigned	: 1;
        unsigned	GO_DONE             : 1;
    };
} ADCON0bits @ 0x01F;

Please help me that how can I access the VCFG bit from the ADCON0 register. I am using the MPLAB X IDE in which when I access the bit as ADCON0bits.VCFG than it shows the error.

So please tell me that what this structure is all about and how can I access all the bits define inside it.


Thanks
 

piyushpandey

Member level 4
Joined
Mar 26, 2012
Messages
70
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
2,051
sorry for late reply

yeah tahmid I have selected the pic16f688 in the configuration window. actually the problem is that when I am trying to access the individual bits of the ADCON0 defined in the structure than only few of them are accessible and few of them does not show in the auto completion box in the MPLABX IDE and when you try to access them than it throws an error by marking or underlining it with red.

for example here I am pasting a screenshot of what appears in the actual window and what does not come up in the window.

View attachment 76588
auto error.png

now in this auto completion window the structure elements which are available are accessible without an error, but when I try to access the structure variable which do not appear in the auto completion box than I get the error like this in the form of a red mark :

View attachment 76594
auto arror 2.png


Now please tell me that why this is happening thank you , why I am not able to get the access to all the structure elements present.

Also I want to know if someone can explain that how this structure field is defined and if any material or article or book is available for it than please tell me.



Thanks
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top