Low-power sensor networks are increasingly used to monitor machinery on assembly lines, stresses in buildings and bridges, inventory movement, patient vital signs, environmental changes, and myriad other applications. The ultra-low-power RL78/G14 was designed with these applications in mind. By taking advantage of the RL78’s Data Transfer Controller (DTC) to transfer the ADC converted results to RAM the CPU can spend more time in Halt and Snooze modes, further reducing overall energy consumption.
In the case of a simple data transfer—for example, transferring the results of an ADC conversion to memory—processing data using the DTC shortens the amount of processing time by eliminating time normally spend pushing an interrupt request onto the stack; processing it (usually waking and utilizing the CPU); popping it off the stack; and executing an RTE instruction to resume execution of the suspended program. The following graphic shows how using the DTC can shorten the time needed for this one transfer by 10 clock cycles:
The DTC has three transfer modes: Normal Mode, Repeat Mode, and Chain Mode. In Normal Mode each DTC activation results in the transfer of 1-256 bytes of 8-bit data or 2-512 bytes of 16-bit data; for each successive transfer the source address is incremented and the data stores to the next block. This transfer can be repeated up to 256 times. Repeat Mode works the same as Normal Mode except that either the transfer source address or the destination address can be specified as the repeat area.
The diagram below assumes that the ADC is operating in Scan Mode and the DTC in Repeat Mode. The ADC converts the analog input voltages on AN10-13 (pins 20-23), performing conversion on each pin successively. Every time A/D conversion for a pin is complete, the result is stored in the 10-bit A/D conversion register (ADCR); the DTC is then activated, which transfers the converted result from the ADCR to RAM. When A/D conversion and DTC transfer is completed for all pins, an A/D conversion end interrupt is generated, waking the CPU to process the data.
While the RL78/G14 DTC is faster than interrupt processing for data transfers, it’s not as fast as the DMA controller. The DTC needs to read control data before transferring data and write back a confirmation after completing the transfer, the DTC takes longer to perform the transfer than the DMA controller, which works exclusively with registers. As a result the DMA controller can only transfer data between SFRs and internal RAM, whereas the DTC can perform transfers between different memories. Also by using Repeat and Chain modes the DTC can in practice make up for much of the speed difference that the DMA controller enjoys.
For more information check out the application notes How to use the DTC for the RL78/G14 and Transferring A/D Conversion Results Using the DTC. For particulars on the ADC and DTC see the RL78/G14 User’s Manual: Hardware.