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.

Defining a Bit with in an array

Status
Not open for further replies.
I'm using a PIC with the CCS compiler I want to do the following

Set up an array such like:

int big[7];

Then I want to go to Byte 0 in the array and define a bit. Such like

#bit Little = Big[0].0

This statment does not work, I wand little to represent bit 0 in Byte Big[0]

Does any one know how to do this?
 
I don't know PICs but I know the 8051 which also has bit addressable memory.

8051 C compilers have compiler directives that let you specify the memory space. So for the Keil 8051 compiler:

bdata unsigned char Big[7];
bit Little = big[0].0;

should give you an array of 7 bytes in the bit addressable memory segment. That #bit looks like its specifying Bit addressable memory - You just need to find the compiler directive that specifies a byte of bit addressable memory.
 
I think you'd use a union to define a bitfield. Haven't done it myself so I can't do an example right away.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top