Presentation is loading. Please wait.

Presentation is loading. Please wait.

Example 11 Analog-to-Digital Converter Lecture L5.1.

Similar presentations


Presentation on theme: "Example 11 Analog-to-Digital Converter Lecture L5.1."— Presentation transcript:

1 Example 11 Analog-to-Digital Converter Lecture L5.1

2 miniDragon+ Serial cable Reset button Power plug2 pushbutton switches A/D Pot Run/Load switch 7-segment display I/O headers Keypad header LCD Header

3

4 Method of Successive Approximation

5

6

7 // Example 11: A/D Converter -- Pot #include /* common defines and macros */ #include /* derivative information */ #include "main_asm.h" /* interface to the assembly module */ #pragma LINK_INFO DERIVATIVE "mc9s12dp256b" int val; void main(void) { PLL_init();// set system clock frequency to 24 MHz ad0_enable(); // enable a/d converter 0 lcd_init(); // enable lcd while(1) { val = ad0conv(7); // read pot on channel 7 val = val >> 1;// shift 1 bit right (divide by 2) set_lcd_addr(0x40); // display on 2nd row of LCD write_int_lcd(val);// write value in field of 5 ms_delay(100);// delay 0.1 seconds } Example 11


Download ppt "Example 11 Analog-to-Digital Converter Lecture L5.1."

Similar presentations


Ads by Google