📄 adc.lst
字号:
C:\MCC18\src\extended\pmc\ADC\adcopen.c
000110 0efd MOVLW 0xfd if( config2 & 0b10000000 ) // Test the interrupt on/off C:\MCC18\src\extended\pmc\ADC\adcopen.c
000112 aedb BTFSS 0xdb,0x7,0x0
000114 d003 BRA 0x11c
{ C:\MCC18\src\extended\pmc\ADC\adcopen.c
000116 9c9e BCF 0x9e,0x6,0x0 PIR1bits.ADIF = 0; // Clear the A/D interrupt flag C:\MCC18\src\extended\pmc\ADC\adcopen.c
000118 8c9d BSF 0x9d,0x6,0x0 PIE1bits.ADIE = 1; // Enable the A/D interrupt C:\MCC18\src\extended\pmc\ADC\adcopen.c
00011a 8cf2 BSF 0xf2,0x6,0x0 INTCONbits.PEIE = 1; // Enable peripheral interrupts C:\MCC18\src\extended\pmc\ADC\adcopen.c
} C:\MCC18\src\extended\pmc\ADC\adcopen.c
C:\MCC18\src\extended\pmc\ADC\adcopen.c
00011c 80c2 BSF 0xc2,0x0,0x0 ADCON0bits.ADON = 1; // Enable the A/D C:\MCC18\src\extended\pmc\ADC\adcopen.c
00011e 52e5 MOVF 0xe5,0x1,0x0 } C:\MCC18\src\extended\pmc\ADC\adcopen.c
000120 cfe7 MOVFF 0xfe7,0xfd9
000122 ffd9
000124 0012 RETURN 0x0
C:\MCC18\src\extended\pmc\ADC\adcopen.c
#else C:\MCC18\src\extended\pmc\ADC\adcopen.c
C:\MCC18\src\extended\pmc\ADC\adcopen.c
C:\MCC18\src\extended\pmc\ADC\adcopen.c
void OpenADC( unsigned char config, unsigned char config2) C:\MCC18\src\extended\pmc\ADC\adcopen.c
{ C:\MCC18\src\extended\pmc\ADC\adcopen.c
// Reset A/D Registers to POR state C:\MCC18\src\extended\pmc\ADC\adcopen.c
ADCON0 = 0; C:\MCC18\src\extended\pmc\ADC\adcopen.c
ADCON1 = 0; C:\MCC18\src\extended\pmc\ADC\adcopen.c
#ifndef ADC_INTERFACE_OLD C:\MCC18\src\extended\pmc\ADC\adcopen.c
ADCON2 = 0; C:\MCC18\src\extended\pmc\ADC\adcopen.c
#endif C:\MCC18\src\extended\pmc\ADC\adcopen.c
C:\MCC18\src\extended\pmc\ADC\adcopen.c
// Configure ADCON registers as per config selections C:\MCC18\src\extended\pmc\ADC\adcopen.c
#ifdef ADC_INTERFACE_OLD C:\MCC18\src\extended\pmc\ADC\adcopen.c
ADCON1 = config; // Set the A/D clock source C:\MCC18\src\extended\pmc\ADC\adcopen.c
ADCON0 = (config<<2) & 0xC0; // Set the I/O selection C:\MCC18\src\extended\pmc\ADC\adcopen.c
ADCON0 |= config2 & 0b00111000; // Set the channel C:\MCC18\src\extended\pmc\ADC\adcopen.c
#else // New ADC interface C:\MCC18\src\extended\pmc\ADC\adcopen.c
ADCON0 = (config2 >> 1) & 0b00111100; // Analog channel selection C:\MCC18\src\extended\pmc\ADC\adcopen.c
ADCON1 = ((config2 << 4) & 0b00110000) | // Voltage reference configuration C:\MCC18\src\extended\pmc\ADC\adcopen.c
(config & 0b00001111); // Port configuration C:\MCC18\src\extended\pmc\ADC\adcopen.c
ADCON2 = (config & 0b10000000) | // Result format C:\MCC18\src\extended\pmc\ADC\adcopen.c
((config >> 4) & 0b00000111); // Conversion clock select C:\MCC18\src\extended\pmc\ADC\adcopen.c
#endif C:\MCC18\src\extended\pmc\ADC\adcopen.c
C:\MCC18\src\extended\pmc\ADC\adcopen.c
if( config2 & 0b10000000 ) // Test the interrupt on/off C:\MCC18\src\extended\pmc\ADC\adcopen.c
{ C:\MCC18\src\extended\pmc\ADC\adcopen.c
PIR1bits.ADIF = 0; // Clear the A/D interrupt flag C:\MCC18\src\extended\pmc\ADC\adcopen.c
PIE1bits.ADIE = 1; // Enable the A/D interrupt C:\MCC18\src\extended\pmc\ADC\adcopen.c
INTCONbits.PEIE = 1; // Enable peripheral interrupts C:\MCC18\src\extended\pmc\ADC\adcopen.c
} C:\MCC18\src\extended\pmc\ADC\adcopen.c
C:\MCC18\src\extended\pmc\ADC\adcopen.c
ADCON0bits.ADON = 1; // Enable the A/D C:\MCC18\src\extended\pmc\ADC\adcopen.c
} C:\MCC18\src\extended\pmc\ADC\adcopen.c
C:\MCC18\src\extended\pmc\ADC\adcopen.c
#endif C:\MCC18\src\extended\pmc\ADC\adcopen.c
/* $Id: adcread.c,v 1.1 2003/12/09 22:43:28 GrosbaJ Exp $ */ C:\MCC18\src\extended\pmc\ADC\adcread.c
#include <p18cxxx.h> C:\MCC18\src\extended\pmc\ADC\adcread.c
#include <adc.h> C:\MCC18\src\extended\pmc\ADC\adcread.c
C:\MCC18\src\extended\pmc\ADC\adcread.c
/******************************************************************** C:\MCC18\src\extended\pmc\ADC\adcread.c
* Function Name: ReadADC * C:\MCC18\src\extended\pmc\ADC\adcread.c
* Return Value: int, A/D result * C:\MCC18\src\extended\pmc\ADC\adcread.c
* Parameters: void * C:\MCC18\src\extended\pmc\ADC\adcread.c
* Description: This routine reads the ADRESL and ADRESH * C:\MCC18\src\extended\pmc\ADC\adcread.c
* and returns these as a long. * C:\MCC18\src\extended\pmc\ADC\adcread.c
********************************************************************/ C:\MCC18\src\extended\pmc\ADC\adcread.c
000126 cfd9 MOVFF 0xfd9,0xfe6 int ReadADC(void) C:\MCC18\src\extended\pmc\ADC\adcread.c
000128 ffe6
00012a cfe1 MOVFF 0xfe1,0xfd9
00012c ffd9
00012e 0e02 MOVLW 0x2
000130 26e1 ADDWF 0xe1,0x1,0x0
{ C:\MCC18\src\extended\pmc\ADC\adcread.c
union ADCResult i; // A union is used to read the C:\MCC18\src\extended\pmc\ADC\adcread.c
// A/D result due to issues with C:\MCC18\src\extended\pmc\ADC\adcread.c
// handling long variables C:\MCC18\src\extended\pmc\ADC\adcread.c
C:\MCC18\src\extended\pmc\ADC\adcread.c
000132 50c3 MOVF 0xc3,0x0,0x0 i.br[0] = ADRESL; // Read ADRESL into the lower byte C:\MCC18\src\extended\pmc\ADC\adcread.c
000134 6edf MOVWF 0xdf,0x0
000136 0e01 MOVLW 0x1 i.br[1] = ADRESH; // Read ADRESH into the high byte C:\MCC18\src\extended\pmc\ADC\adcread.c
000138 cfc4 MOVFF 0xfc4,0xfdb
00013a ffdb
C:\MCC18\src\extended\pmc\ADC\adcread.c
00013c cfde MOVFF 0xfde,0x2 return (i.lr); // Return the long variable C:\MCC18\src\extended\pmc\ADC\adcread.c
00013e f002
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -