/* **********tut3.c***************** Simulator tutorial program for the MC68HC11EVB Demonstration of the A/D, external analog signal connected to PE0 This example accompanies the book "Embedded Microcomputer Systems: Real Time Interfacing", Brooks-Cole, copyright (c) 2000, Jonathan W. Valvano 7/6/99 Interface between the TExaS simulator running a MC68HC11 EVB with ICC11 freeware compiler TExaS Copyright 1999 by Jonathan W. Valvano for more information about ICC11 see http://www.imagecraft.com You may use this file without restrictions */ #include "HC11.h" #include "sci11.h" /* global variables */ unsigned int data; /* 8 bit A/D sample 0 to 255 as input varies 0 to +5V */ void main(void){ InitSCI(); OPTION=0x80; /* turn on A/D power */ while(1){ ADCTL=0; /* start A/D channel 0 */ while((ADCTL&0x80)==0){}; /* wait for A/D done */ data=ADR1; OutUDec(data); OutChar(CR); } } #include "SCI11.C" void resetVectors(void){ /* not really a function, but this must be last */ asm(" org $FFFE"); asm(" FDB __start"); asm(" org $FC00"); /* puts rts in a harmless place */ /* string constants also placed here */ /* the value FC00 means you can have up to 1000 characters of strings */ }