⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.txt

📁 说明:该代码是关于dsPIC33F系列芯片的A/D、DMA、D/A功能的应用范例。开发环境:用MPLAB C30编译
💻 TXT
字号:

		Readme File for Code Example:
              	    CE154 - ADC and DAC.   
             ----------------------------------------

This file contains the following sections:
1. Code Example Description
2. Folder Contents
3. Suggested Development Resources
4. Reconfiguring the project for a different dsPIC33F device
5. Revision History


1. Code Example Description:
----------------------------

In this example, ADC is configured to sample (AN4) at 103.16 KHz rate and the converted data is assembled
in a 256-sample buffer. Timer 3 is setup to time-out every 9.69 microseconds (103.16 KHz rate). On every
Timer3 time-out (every Ts = 9.69 microsecs), the ADC module will stop sampling and trigger a 12-bit A/D conversion.
At that time, the conversion process starts and completes Tc = 14*Tad = 1.4 microsecs later.
When the conversion is complete, the module starts sampling again. However, since Timer3 is already on and counting,
about (Ts-Tc) = 8.29 microsecs later, Timer3 will expire again and trigger the next conversion.
The DMA is configured in continuous, ping pong mode, such that after the DMA channel has read 256 samples
into a buffer (BufferA/BufferB) a DMA interrupt is generated. The captured 256 samples are output using the on-chip DAC.
Mean while the DMA controller starts filling new ADC samples into buffer (BufferB/BufferA). Thus the two buffers are
alternately filled and released in an infinite loop.
The ADC module clock time period is configured as Tad = Tcy*(ADCS+1) = (1/40M)*(3+1) = 100 nanosecs with ADCS = 3.
Hence the conversion time for 12-bit A/D is 14*Tad = 1.4 microsecs.

void initTmr3();
Timer 3 is configured to time-out at 103.16 KHz rate. 

void initAdc(void);
ADC module is set-up to convert AIN4 input using CH0 S/H on Timer 3 event in 12-bit mode.

void initDac(void);
DAC module is set-up to convert samples at a rate of 103.16 KHz.

void initDma0(void);
DMA channel 0 is confiured in ping-pong mode to move the converted data from ADC to DMA RAM on every sample/convert sequence. 
It generates interrupt after every 256 sample transfer. 

void __attribute__((__interrupt__)) _DMA0Interrupt(void);
DMA interrupt service routine sets up flags indicating that the data buffer is full.

void __attribute__((interrupt, no_auto_psv)) _DAC1RInterrupt(void);
DAC interrupt service routine.

2. Folder Contents:
-------------------
This folder contains the following sub-folders:
a. C:\Program Files\Microchip\MPLAB C30\support\gld
        This folder will have the device GLD file, it is used for building the project. 
	This file was provided with the MPLAB

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -