Use this:
H-File:
Code:
typedef struct
{
unsigned char bit0 : 1;
unsigned char bit1 : 1;
unsigned char bit2 : 1;
unsigned char bit3 : 1;
unsigned char bit4 : 1;
unsigned char bit5 : 1;
unsigned char bit6 : 1;
unsigned char bit7 : 1;
} bit_field;
#define GET_BITFIELD( addr ) ( *(( volatile bit_field * ) (addr)) )
// make your define for the Port-Pin:
#define Your_Port_PIN GET_BITFIELD ( &PORTF ).bit4
// example: PORTF Bit 4 (output)
Than access your Bit with:
Code:
Your_Port_PIN = 1;
OR
Your_Port_PIN = 0;
The same with Inputs:
#define clock_input GET_BITFIELD ( &PINB ).bit6 |