3.6 Data Transfer from ADC to DAC (Passthrough)
The left-aligned 8-bit ADC result in ADRESH register can be transferred directly to the DAC using DMA, creating an audio passthrough channel(1). The DMA setup configurations are listed in Table 3-6.
DMA1 Setup | ||
---|---|---|
SSA | Source Address | &ADRESH |
SSZ | Source Size | 1 |
SMR | Source Memory Region | SFR |
SMODE | Source Address Mode | SPTR remains unchanged |
DSA | Destination Address | &DAC1DATL |
DSZ | Destination Size | 1 |
DMODE | Destination Address Mode | DPTR remains unchanged |
SIRQEN | Start Trigger Enable | Yes |
SIRQ | Start Trigger | AD (ADC conversion) |
SSTP | Source Counter Reload Stop | No - SIRQEN not cleared |
DSTP | Destination Counter Reload Stop | No - SIRQEN not cleared |
AIRQEN | Abort Trigger Enable | No (stops when SCNT/DCNT reloads) |
AIRQ | Abort Trigger | N/A |
How It Works:
- The DMA is triggered as soon as
an ADC conversion is complete (ADIF trigger) and the content of ADRESH register
is transferred to the DAC1DATL register directly. Because SSZ =
1
, the DMA stops after the first transfer and waits for the next trigger. - This process continues as long as the ADC and the DMA are in operation.
Important:
- While most of the newer PIC18 devices have a 10-bit or 12-bit ADC, only 8-bit ADC values are used to keep the application simple. This is because the DAC used to playback the audio signal has a resolution of 8 bits.