Для примера привожу содержимое своего заголовочного файла: #include <ina90.h>
#include <io4433.h>
/* MCU related constant definitions */
#define FOSC 4000000L // MCU clock frequency
/* I/O port definitions */
#define SGMNT_L_PORT PORTB // Low segment LED port (A-F segments)
#define SGMNT_H_PORT PORTC // High segment LED port (G-H)
#define G_BIT (1<<0) // G - segment
#define H_BIT (1<<1) // H - segment (dot)
#define DIGIT_PORT PORTC // Digit selection port
#define DIGIT0_BIT (1<<2) // -- digit 0 (LS)
#define DIGIT1_BIT (1<<3) // -- digit 1
#define DIGIT2_BIT (1<<4) // -- digit 2
#define DIGIT3_BIT (1<<5) // -- digit 3 (MS)
#define DIGIT_MASK (DIGIT0_BIT | DIGIT1_BIT | DIGIT2_BIT | DIGIT3_BIT)
#define RELAY_PORT PORTD // Relay control port
#define RELAY1_BIT (1<<5) // -- relay 1
#define RELAY2_BIT (1<<6) // -- relay 2
#define RELAY3_BIT (1<<7) // -- relay 3
#define INPUT_PORT PIND // Input conhrol port
#define INPUT_PULLUP PORTD //
#define INPUT_DDR DDRD //
#define START_BIT (1<<2) // -- "Start" signal
#define SETUP_BIT (1<<3) // -- "Setup" button
#define MODE_BIT (1<<4) // -- "Mode" button
/* Interrupt flag definitions */
#define TIMER0_BIT (1<<0) // Timer0 interrupt flag
#define TICK_BIT (1<<1) // 1 tick (50 mS) flag
#define QUART_SEC_BIT (1<<2) // 0.25 S time interval flag
#define HALF_SEC_BIT (1<<3) // 0.5 S time interval flag
#define ONE_SEC_BIT (1<<4) // 1.0 S time interval flag
#define COUNT_BIT (1<<5) // Timer count down flag
#define BUTTON_BIT (1<<6) // To check buttons flag
#define BLINKED_BIT (1<<7) // Blinked display flag
#define TWO_SEC_BIT (1<<8) // 2.0 S time interval flag
/* Timer flag definitions */
#define MINUTES_BIT (1<<0) // Minute interval flag
#define STOP_BIT (1<<1) // Stop time count flag
#define ONE_DELAY_BIT (1<<2) // One (1st) delay is valid
/* Timer state definitions */
#define NSTATES 7 // The number of states
#define RELAY_MASK (RELAY1_BIT | RELAY2_BIT | RELAY3_BIT)
#define STANDBY_ST 0
#define T1_ST 1 // Delay 1 counting
#define T2_ST 2 // Delay 2 counting
#define PAUSE_ST 3
#define T3_ST 4 // Delay 3 counting
#define T4_ST 5 // Delay 4 counting
#define T200_ST 6 //
#define OFF_ST 7 // All done state
#define T50_ST 8 // 50 mS delay
#define TWO_DELAYS (1<<5) // Two delay values
#define DTGLE_FLG (1<<6) // Disable relay toggle flag
#define RPT_FLG (1<<7) // Repeat from the previous state
/* Common constant definitions */
#define ERROR 0xFF // Bad function return
#define OK 0x01 // Good function return
#define DONE 0x02 // The work is done completely
/* Data type definitions */
typedef struct {
char seconds; // Seconds (minutes) value
char minutes; // Minutes (hours) value
}
Time;
typedef struct {
char flags; // Various flags
char states[NSTATES]; // State sequence
}
Mode;
/* Global variable references */
//
// Global register variables
//
__no_init __regvar volatile unsigned IntFlags @ 14; // Various interrupt flags
__no_init __regvar volatile char TickCounter @ 13; // Tick counter (1 tick = 50mS)
__no_init __regvar volatile char QuartCounter @ 12; // Second quarter counter (250mS)
__no_init __regvar volatile char DigitCounter @ 11; // Digit counter
__no_init __regvar volatile char DigitMask @ 10; // Digit mask
__no_init __regvar volatile char *BCDptr @ 9; // BCD digits pointer
//
// EEPROM data
//
__no_init __eeprom char eMinutes @ 9; // Minute interval flag
__no_init __eeprom char eIndex @ 10; // Selected timer mode
__no_init __eeprom Time eValue1 @ 11; // Delay values
__no_init __eeprom Time eValue2 @ (11+2); //
__no_init __eeprom Time eValue3 @ (11+4); //
__no_init __eeprom Time eValue4 @ (11+6); //
//
// SRAM data
//
extern Time Delay1, Delay2, // Delay counters
Delay3, Delay4; //
extern char Digits1[2], // Timer counter BCD digits
Digits2[2]; //
extern char BlinkedDigit; // Blinked digit number
extern char TimerFlags; // Various timer flags
//
// Program memory data
//
extern __flash Mode ModeTable[]; // Timer mode table
/* Function prototypes */
void InitButtons(void);
char GetButtons(void);
char ReadBtns(void);
void InitTimers(void);
void RunTimer(void);
void StopTimer(void);
void DelayN50(char _dly);
void Setup(void);
char BinToBCD(char _byte);
void BCDdigits(Time *tp, char *dp);
void DisplayDigit(void);