However, each entity can be manually placed at any address, using the @
extension.
For example:
int x@0x12 ; // manually located definition extern unsigned char STATUS@0xFD8 ; // manually located declaration
This feature is very handy to access Special Function Registers. cpik provides a set of header files containing the declaration of each SFR register, for each processor. These headers are automatically generated by a program that gets the information from Microchip's «.inc» files. For example, here is the beginning of the p18f2525.h header file:
#ifndef DEVICE
#define DEVICE p18f2525
#define p18f2525
// ======================================
// PROCESSOR : p18f2525
// ======================================
// This file has been automatically generated from Microchip's "p18f2525.inc" file.
// with the inc2h-v2 utility. Please do not edit by hand.
// Do not use with cpik versions prior V0.7, report problems to author.
// (C) Alain Gibaud 2012 (alain.gibaud@free.fr)
#pragma firstsfr 0xf80
// ------------------------------
// PORTA
// ------------------------------
unsigned int PORTA@0xf80 ;
union
{
struct
{
unsigned int
RA0 : 1 ,
RA1 : 1 ,
RA2 : 1 ,
RA3 : 1 ,
RA4 : 1 ,
RA5 : 1 ,
RA6 : 1 ,
RA7 : 1 ;
} ;
struct
{
unsigned int
: 4,
T0CKI : 1 ,
AN4 : 1 ;
} ;
struct
{
unsigned int
: 5,
SS : 1 ;
} ;
struct
{
unsigned int
: 5,
NOT_SS : 1 ;
} ;
struct
{
unsigned int
: 5,
LVDIN : 1 ;
} ;
struct
{
unsigned int
: 5,
HLVDIN : 1 ;
} ;
} PORTAbits@0xf80 ;
...
| Please note that cpik does not perform any verification on the specified addresses. It is the programmer's responsibility to insure that the specified location really corresponds to usable memory. |