Source code files – Motorola USB08 User Manual

Page 98

Advertising
background image

Designer Reference Manual

USB08 Evaluation Board

98

Source Code Files

MOTOROLA

Source Code Files

// Things that should be done immediately after Reset

// (this is called by the C-Startup Module)

//

void _HC08Setup() {

CONFIG = 0x21;

// USB Reset Disable, COP Disable

TSC = 0x00;

// clear TSTOP, Prescaler=0

}

//----------------------------------------------------------------------------

// Dummy Interrupt Handler

// Place a Breakpoint here in case you are looking for spurious Interrupts

//

@interrupt void isrDummy() {

nop();

// just for Debugging

}

//----------------------------------------------------------------------------

void main() {

uchar n, a;

uchar io_buffer[8];

uchar adc[3];

initPipe();

// init RS232 or USB Pipe

initLED();

// init LED Output

initKey();

// init Key Input

initSADC();

// init Soft ADC

cli();

a = 0;

while(1) {

// update ADC results (1 out of 3 at one time)

adc[a] = getSADC(a+1);

if(++a==3) a=0;

// get data from input pipe

n=0;

do {

io_buffer[n++] = getPipe();

} while(n<8);

// process input data

if(io_buffer[0]==0) offLED(1);

else onLED(1);

if(io_buffer[1]==0) offLED(2);

else onLED(2);

if(io_buffer[2]==0) offLED(3);

else onLED(3);

Advertising