Before programming your EPROM HC11 you will first have to modify your code so it will work properly in EPROM. After the necessary changes have been made to your code, you will put your EPROM HC11 into your EVBU and program it using PCBUG11. Do the following:
ic1_isr()
,
remove the two lines
TIC1_JMP = JMP_OP_CODE; TIC1_VEC = ic1_isr;
e:\icc11\examples\vectors.c
into your directory.
Edit the file vectors.c
, adding the names of your interrupt service
routines at the appropriate locations. For example, for your ic1_isr()
,
find the line
0, /* TIC1 */and change it to
ic1_isr, /* TIC1 */
Also, near the top of the file vectors.c, just below the line
extern void _start(); /* entry point in crt11.s */add lines for your interrupt service routines. For example, for your
ic1_isr()
, add the line
extern void ic1_isr();
BAUD = 0x30; /* 9600 Baud */ SCCR1 = 0x00; SCCR2 = 0x0c; /* Enable SCI transmitter and receiver */
const unsigned char tbird[] = {0x00,0x08,0x0c,0x0e,0x0f,0x00,0x10,0x30,0x70,0xf0};The const tells the compiler to put these numbers in the code section, which will be in EPROM, so they will be there permanently, but you will not be able to change them.
int i=0; main() { ...change it to:
int i; main() { i = 0; ...
void foo (void) { static int i=0; if (i < 0) ...change the static variable to a global variable and initialize it in main(). You may have to invent a unique name for the variable so it does not conflict with another variable name. For example:
int foo_i; main() { foo_i = 0; ... } void foo(void) { if (foo_i < 0) ...
vectors.c
, to put your code in EPROM at 0xd000, and to put your
interrupt vectors at 0xffd6. For example, if the
name of your program is prog.c, use the following line to compile it.
icc11 -l -o prog.s19 prog.c vectors.c -btext:0xd000 -bdata:0x0100 -binterrupt_vectors:0xffd6 -d_stack:0x0fff