10 years, 7 months ago.

main program to test dac57xx library

Hi Daniel:

I have imported your library for AD5754R and it is very nicely organised into a class. Great work. You have said in your comments in the code that you have tested the library with AD5754R. I have a lot of difficulty past few days to get it going. Could you please provide me with a code example (main program) that worked for you? Any documentation or any help or diagram is appreciated.

Looking forward to hear your help

Ras

Question relating to:

Oh by the way, here is my sample code:

  1. include "mbed.h"
  2. include "dac57xx.h"

Create and instance of the SPI class SPI AD5754R(p5, p6, p7); MOSI, MISO, SCLK

Pin Configuration to DAC Serial pc(USBTX, USBRX); DigitalOut BIN2COMP(p21); DigitalOut CLEARPIN(p22); DigitalOut LDAC(p23); DigitalOut SYNCH(p24);

DacAD57XX AD5754R(p5, p6, p7, p24);

uint32_t answerIN; unsigned int answerOUT;

int main() {

LDAC = 0; CLEARPIN = 1; pc.printf("Started!\n\r"); while(1){ AD5754R.setOutputRange(AD5754R.ADDRESS_A, AD5754R.BIPOLAR_10V); AD5754R.setPowerControl(31); answerIN = AD5754R.getOutputRange(AD5754R.ADDRESS_A);

pc.printf(" %u \n\r", answerIN); wait_us(1000000); } }

and what i get is 0x480000 ALL THE TIME!

posted by rasam aliazizi 10 Mar 2015
Be the first to answer this question.