ADC – 1 channel demo

  1. What this example do?
  2. How I must configure my ORbit16™ to work with this example?
  3. Where I can learn more about this?
  4. Download this example!

What this example do?

In this example we’ll learn how to use ADC (Analog/Digital Converter) module. Here we’ll read only one analog input from a potentiometer. Code will execute 16 readings from the input, will make the average and then will show the result on UART or on USB in serial emulation mode (there are 2 demos: one for UART e one for USB).

When you press SW2 on ORbit16™,firmware will start to execute readings and you can see results on a terminal software (such as Hyperterminal or similar).

How I must configure my ORbit16™ to work with this example?

First you’ll need a potentiometer or a trimpot to be connected on AN0 input (please see schematic below).

For the UART demo you need a serial adapter that works with a TTL level of 3.3V and set the serial port at 57600,8,N,1. For the USB demo you don’t need the serial adapter since the USB module on ORbit16™ is used in CDC mode and then any baud rate selected in terminal software will works fine.

You can use any terminal software on your pc to see the messages sent by ORbit16™ :

Where I can learn more about this?

My advice is to read the following free documents:

  • dsPIC33_PIC24H_ADC_Library_Help.htm (english language)
    This is an HTML file you’ve got with MPLAB C30 installation. Usually this document is located in the following folder:

    C:\Program files\Microchip\MPLAB C30\docs\periph_lib

    Reading document this will give you extra skills in the usage of ADC. Please notice this document is for dsPIC33 and PIC24H series so some settings are different for PIC24F mounted on ORbit16™. At this date, Microchip still not have furnished the updated document for PIC24F

  • PIC24F Family reference manual (english language)
    This is a set of PDFs about PIC24F features. Read:
    Sect.17 – 10bit A/D converter
  • Impostazione e funzionamento modulo ADC su PIC24F – Ebook (italian language)
    This document talks about the ADC libraries for PIC24FJ64GB002. Here you can download it.

Download this example!

ADC Demo - 1 channel on UART (187 downloads) ADC Demo - 1 channel on USB (206 downloads)