Example mcp4922 test
This is a guide to the mcp4922_test
C example project included in the EMAC OE SDK.
This is an example application for accessing the EMAC interface for the on-board D/A of the SoM-150ES. This interface uses the EMAC ioex class to provide a GPIO-like interface (see also the egpc project). This application outputs a sine wave on channel 0 and a cosine wave on channel 1.
The mcp4922_test
project builds one executable: mcp4922_test
.
Contents
Opening, Building and Uploading the Project Files
For information on opening the project from within Eclipse, please see Importing the EMAC OE SDK Projects with Eclipse. Then, follow Using the EMAC OE SDK Projects with Eclipse for information on how to build, upload and execute the example.
Alternatively, the Makefile
can be used with the make
command from the commandline to build and upload the example. For more information on this method, please see Using EMAC OE SDK Example Projects.
Usage and Behavior
mcp4922_test
outputs a sine wave on channel 0 and a cosine wave on channel 1.
Hardware Requirements
The mcp4922_test
C example project requires an EMAC SoM-150ES carrier board.
Using mcp4922_test
Run it from the console...
./mcp4922_test
Regard the EMAC SoM-150ES carrier board. Locate the HDR8 ANALOG I/O HEADER (circled).
Pin 15 is analog out 0 and pin 16 is analog out 1. Pins 1, 2, 17 and 18 are all ground.
When we execute mcp4922_test
we get a 5v sine wave on pin 15 and a cosine on pin 16. We can watch the signals on an oscilloscope or listen to them on a speaker.
Summary
The mcp4922_test
C example project demonstrates how to access the on-board DtoA of an EMAC SoM-150ES carrier board.