Martha MigliacioAlex Wong
Published © GPL3+

Using the Pmod DA3 with Arduino Uno

Change the output voltage of the Pmod from 0 to 2.5 V to generate a triangular signal.

BeginnerShowcase (no instructions)1 hour2,381
Using the Pmod DA3 with Arduino Uno

Things used in this project

Hardware components

Pmod DA3
Digilent Pmod DA3
×1
Arduino UNO
Arduino UNO
×1
Digilent Analog Discovery 2
Recommended to view the resulting triangular wave.
×1

Story

Read more

Schematics

Pmod DA3 and Arduino Uno Fritzing file

Fritzing file displaying the connection of the Pmod DA3 to the Arduino Uno.

Pmod DA3 and Arduino Uno Fritzing Image

Fritzing image displaying the connection between the Pmod DA3 and Arduino Uno.

Pmod DA3 Signal

Visualization of the outputs of the Pmod DA3 using an Analog Discovery 2.

Code

Pmod DA3 and Arduino Uno Code

Arduino
Using this code will change the output voltage on the Pmod DA3 from 0 to 2.5 V to generate a triangular signal.
/************************************************************************
*
* Test of the Pmod
*
*************************************************************************
* Description: Pmod_DA3
* The output voltage of the Pmod will change from 0 to 2.5 V to generate a
* triangular signal.
*
*
* Material
* 1. Arduino Uno
* 2. Pmod DA3 (do not touch JP1 jumper)
*
************************************************************************/

#define CS 10 // affectation of CS pin
#define LDAC 9 // affectation of LDAC pin
#include <SPI.h> // Include library

int i;
int j;

void setup()
{
 Serial.begin(9600); // initialization of serial communication
 SPI.begin(); // initialization of SPI port
 SPI.setDataMode(SPI_MODE0); // configuration communication SPI in mode 0
 SPI.setClockDivider(SPI_CLOCK_DIV16); // configuration of clock at 1MHz
 pinMode(CS, OUTPUT);
 pinMode(LDAC, OUTPUT);
}

void loop()
{
 for (i=0;i<256;i=i+1)
  {
   for (j=0;j<256;j=j+1)
   {
   digitalWrite(LDAC, HIGH); // deactivation of LDAC line
   digitalWrite(CS, LOW); // activation of CS line
   SPI.transfer(i); // send high bits
   SPI.transfer(j); // send low bits
   digitalWrite(CS, HIGH); // deactivation of CS line
   digitalWrite(LDAC, LOW); // activation of LDAC line
   /* Period of signal is eround 2,4 s.
   * If it is desired to increase it, we can introduce a delay at each passage        in the loop
   * delay(1); or delayMicroseconds(50); 
   */
   }
}

Credits

Martha Migliacio

Martha Migliacio

5 projects • 18 followers
Alex Wong

Alex Wong

14 projects • 53 followers
I work in Digilent and like creating projects
Thanks to Lextronics.

Comments