In this article I show you a simple example of how to use the 10-bit ADC of the RL78. The ADC found in the RL78 is a SAR (successive approximation register) one, with a resolution of 10 bits. The configuration and operation is very similar to the ADC found on other microcontrollers. The main features are:

  1. Auto scan mode, where the ADC converts four channels in sequence;
  2. Analog comparator: which can set minimum and maximum limits for each conversion, triggering an interrupt when the result is inside or outside that window;
  3. Operation while the CPU is in snooze mode: the converter can operate even while the CPU is in a low-power mode.

A following example demonstrates the basic operation of this module. It was taken from the “Microcontroladores RL78: Guia Básico” book and shows how to read the result of a continuous conversion of a single channel. This code was written for the R5F100LE found on the YRPBRL78G13 board. It monitors the voltage set by the R15 trimpot, turning the LED when the result is higher than 511 (the equivalent of 2.5V approximately).

A simple RL78 ADC usage example
Tagged on:                 

Leave a Reply