tailieunhanh - Học PIC từ cơ bản-6

Tham khảo sách 'học pic từ cơ bản-6', kỹ thuật - công nghệ, cơ khí - chế tạo máy phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Gooligum Electronics 2010 Introduction to PIC Programming Programming Baseline PICs in C by DavidMeiklejohn Gooligum Electronics Lesson 6 Analog-to-Digital Conversion and Simple Filtering Baseline lesson 10 explained how to use the analog-to-digital converter ADC available on baseline PICs such as the PIC16F506 using assembly language. This lesson demonstrates how to use C to control and access the ADC re-implementing the examples using the free HI-TECH C1 in Lite mode PICC-Lite and CCS PCB compilers introduced in lesson 1 . It then shows how a simple moving-average filter as described in baseline lesson 11 can be implemented in C. The final example implements a simple light meter with the light level smoothed scaled and shown as two decimal digits using 7-segment LED displays. In summary this lesson covers Configuring the ADC peripheral Reading analog inputs Hexadecimal output on 7-segment displays Working with arrays Accessing more than one bank of data memory Calculating a moving average to implement a simple filter with examples for HI-TECH C PICC-Lite and CCS PCB. Analog-to-Digital Converter As explained in more detail in baseline lesson 10 the analog-to-digital converter ADC peripheral on baseline PICs allows analog input voltages to be measured with a resolution of eight bits 0 corresponds to VSS and 255 corresponds to VDD. The ADC module on the 16F506 has three external inputs or channels AN0 AN1 and AN2. Since there is only one ADC module only one channel can be selected at one time meaning that only one input can be read or converted at once. A simple example in baseline lesson 10 demonstrated basic ADC operation using the circuit on the next page - similar to that used in lesson 5 on comparators but using four LEDs connected to RC0 - RC3 labelled DS1 - DS4 if you are using the Low Pin Count Demo Board . 1 PICC-Lite was bundled with versions of MPLAB up to . HI-TECH C earlier known as HI-TECH C PRO was bundled with MPLAB and

TỪ KHÓA LIÊN QUAN