30.10.2014 Views

o_195h4n6al16jb186b1b2qs7fgssa.pdf

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.6 ADC10 FUNCTIONS<br />

This section contains a list of individual functions for the 10 bit ADC and an<br />

example of<br />

use of the functions. Functions may be implemented as macros.<br />

3.6.1 Individual Functions<br />

BusyADC10<br />

Description: This function returns the ADC conversion status.<br />

Include: adc10.h<br />

Prototype: char BusyADC10(void);<br />

Arguments: None<br />

Return Value: If the value of DONE is ‘0’, then ‘1’ is returned, indicating that<br />

the ADC<br />

is busy in conversion.<br />

If the value of DONE is ‘1’, then ‘0’ is returned, indicating that the ADC<br />

has completed conversion.<br />

Remarks: This function returns the complement of the ADCON1 bit<br />

status which indicates whether the ADC is busy in conversion.<br />

Source File: BusyADC10.c<br />

Code Example: while(BusyADC10());<br />

CloseADC10<br />

Description: This function turns off the ADC module and disables the ADC<br />

interrupts.<br />

Include: adc10.h<br />

Prototype: void CloseADC10(void);<br />

Arguments: None<br />

Return Value: None<br />

Remarks: This function first disables the ADC interrupt and then turns off the<br />

ADC<br />

module.The Interrupt Flag bit (ADIF) is also cleared.<br />

Source File: CloseADC10.c<br />

Code Example: CloseADC10();<br />

ConfigIntADC10<br />

Description: This function configures the ADC interrupt.<br />

Include: adc10.h<br />

Prototype: void ConfigIntADC10(unsigned int config);<br />

Arguments: config ADC interrupt priority and enable/disable information as<br />

defined below:<br />

ADC Interrupt enable/disable<br />

ADC_INT_ENABLE<br />

ADC_INT_DISABLE<br />

ADC Interrupt priority<br />

int configscan)<br />

Đối số: config1 này chứa các thông số phải được cấu hình trong<br />

ADCON1 đăng ký theo quy định dưới đây:<br />

Mô-đun On / Off<br />

ADC_MODULE_ON<br />

ADC_MODULE_OFF<br />

Hoạt động chế độ nhàn rỗi<br />

ADC_IDLE_CONTINUE<br />

ADC_IDLE_STOP<br />

Định dạng đầu ra kết quả<br />

ADC_FORMAT_SIGN_FRACT<br />

ADC_FORMAT_FRACT<br />

ADC_FORMAT_SIGN_INT<br />

ADC_FORMAT_INTG<br />

Chuyển đổi nguồn kích hoạt<br />

ADC_CLK_AUTO<br />

ADC_CLK_MPWM<br />

ADC_CLK_TMR<br />

ADC_CLK_INT0<br />

ADC_CLK_MANUAL<br />

ConfigIntADC10 (Tiếp theo)<br />

dsPIC<br />

®<br />

Thư viện Công cụ Ngôn ngữ<br />

DS51456B trang 104 2004 Microchip Technology Inc<br />

Tự động lấy mẫu chọn<br />

ADC_AUTO_SAMPLING_ON<br />

ADC_AUTO_SAMPLING_OFF<br />

Đồng thời lấy mẫu<br />

ADC_SAMPLE_SIMULTANEOUS<br />

ADC_SAMPLE_INDIVIDUAL<br />

Mẫu cho phép<br />

ADC_SAMP_ON<br />

ADC_SAMP_OFF<br />

config2 này chứa các thông số phải được cấu hình trong<br />

ADCON2 đăng ký theo quy định dưới đây:<br />

Điện áp tham khảo<br />

ADC_VREF_AVDD_AVSS<br />

ADC_VREF_EXT_AVSS

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!