Hardware Reference
In-Depth Information
count 22 ;
if(count 55 0){
// is time for the current sequence expired?
seq 11 ;
// change to a new sequence of digits
count 5 400;
// reset repetition count
}
if(seq 55 10)
// is this the last sequence?
seq 5 0;
// reset start index of a sequence
}
This programming project also contains the vectors.c file.
extern void near rtiISR(void);
#pragma CODE_SEG __NEAR_SEG NON_BANKED
#pragma CODE_SEG DEFAULT // Change code section to DEFAULT.
typedef void (*near tIsrFunc)(void);
const tIsrFunc _vect[] @0xFFF0 5 {
rtiISR
};
Example 6.6
Modify the C program in Example 6.5 so that it can be compiled using the ICC12 C com-
piler and run in a demo board programmed with the D-Bug12 monitor.
Solution: Since the ICC12 IDE does not support flash memory programming, it can only support
program execution in SRAM. We will use inline assembly instructions to set up an interrupt
vector for RTI. The C program for ICC2 to implement seven-segment display shifting described
in Example 6.5 is
#include
“c:\cwHCS12\include\hcs12.h”
#include
“c:\cwHCS12\include\SetClk.h”
void rtiISR(void);
int seq,ix,count;
char segPat[13] 5 {0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x67, 0x3F, 0x06, 0x5B, 0x4F};
char digit[4] 5 {0xFE, 0xFD, 0xFB, 0xF7};
void main (void) {
asm( “ldd #_rtiISR” );
// set up RTI vector by calling SetUserVector
asm( “pshd” );
// function using inline assembly instructions
asm( “ldd #56” );
//
asm( “ldx $EEA4” );
//
asm( “jsr 0,x” );
// “
seq
5 0;
ix
5 0;
count
5 400;
SetClk8();
RTICTL
5 0x40;
// RTI interval set to 2**10 OSCCLK cycles
DDRB 5 0xFF;
// configure Port B for output
 
Search WWH ::




Custom Search