Is there any example how to implement DTC chain transfer on S1JA microcontrollers?
In reply to Herald:
In reply to WarrenM:
Please find attached an example for the S1JA, written using SSP1.7.8.
The example shows how chain transfer can be used to read multiple, none contiguous, ADC channels.
The ADC is triggered by the AGT timer, triggered every 500ms.
The ADC will scan the specified A/D channels. (in this example, AN000, AN001, AN002, AN003, AN006, AN007, AN016, AN017)
The ADC Scan interrupt will trigger the DTC that will read the A/D results and store the data in the results array:
where ADC_CHANNELS = 8, and the BUFFER_DEPTH = 8.
The process of reading the ADC data via the DTC will either break after a specified number of triggers, or run forever, depending on the on which define is declared
#define DTC_CHAIN_FOREVER 1//#define DTC_CHAIN_ESCAPE 1
If #define DTC_CHAIN_FOREVER 1, then the DTC will use repeat mode and run forever,
If #define DTC_CHAIN_ESCAPE 1, then after #define DTC_WAKE_UP_COUNT 10 /* ADC (DTC transfers) */ transfer, the DTC stops handling the ADC interrupt and it is handled by the CPU, and stops.
Note, that if #define DTC_CHAIN_FOREVER 1 has been set, that pressing the user push button can stop the process.
Hope this is of interest and that the worked example shows how to create DTC chained transfers.
In reply to Richard: