In: Electrical Engineering
a) After deleting everything in the main.c,
b) Then you have to copy and paste the program into the
main.c,
c) to make F7 to download F5 and to run F5 and then execute it
#include <hidef.h> //--com. define, macros #include "derivative.h" // --derivative-specific-definitions void MSdelay(unsigned int); void main(void) { DDRB = 0xFF; //--PORTB as o/p DDRJ = 0xFF; //--PTJ as o/p for Dragon12+ LEDs PTJ=0x0; //--Allow these LEDs. to. dsiplay. data. on. PORTB. pins. ATD0CTL2 = 0x80; //--Turn on ADC,..No... ..Intr MSdelay(5); ATD0CTL3 = 0x08; //--one. conversion., there. is. no. FIFO. ATD0CTL4 = 0xEB; //--8-bit resolution, 16-clock. for. 2 phase.,
//--prescaler of 24 for the Conversion of Frequency=1MHz for(;;) { ATD0CTL5 = 0x85; //--Channel-5 (right-justified, unsigned&single-conver,one-chan only) while(!(ATD0STAT0 & 0x80)); PORTB = ATD0DR0L; //--dump it on the LEDs MSdelay(2); //--optional }
}
void MSdelay(unsigned int itime)
{
unsigned int k; unsigned int l;
for(k=0;k<itime;k++)
for(l=0;l<4000;l++);
}