I could program the 8750, but the same program does not work. I have worked with EVM and another prototype board.
#include "mbed.h"
#include "SWSPI.h"
//Address Byte
#define ADDR_NOP 0x00 //No operation (NOP)
#define ADDR_DATA 0x01 //Write DAC data register
#define ADDR_READ 0x02 //Register read
#define ADDR_CTRL 0x55 //Write control register
#define ADDR_RESET 0x56 //Write reset register
#define ADDR_CONFIG 0x57 //Write configuration register
#define ADDR_GAIN 0x58 //Write DAC gain calibration register
#define ADDR_ZERO 0x59 //Write DAC zero calibration register
#define ADDR_WDT 0x95 //Watchdog timer reset
#define CTRL_SET 7 // Control register setup 0-24ma
DigitalOut gpo(D0);
DigitalOut led(LED_RED);
SWSPI dac(D11,D12,D13); // mosi, miso, sclk, ssel
DigitalOut latch(D10);
void sendtodac (int,int);
void sendtodac (int address,int cmd0){
dac.frequency(50000);
int cmd[2];
dac.write(address); // address byte
cmd[0] = cmd0 & 0xFF;
cmd[1] = (cmd0 >> 8);
dac.write(cmd[1]); //MSB
dac.write(cmd[0]); //LSB
latch = 1;
latch = 0;
}
void initdac (void);
void initdac (void){
sendtodac(ADDR_RESET,0x01);
sendtodac(ADDR_CTRL,0x1007);
}
int dacin = 0;
int main()
{
dac.format(8, 3);
dac.frequency(50000);
initdac();
int dacin = 0;
//sendtodac(ADDR_DATA,54613);
while (true) {
gpo = !gpo; // toggle pin
led = !led; // toggle led
wait(1.0f);
sendtodac(ADDR_DATA,dacin);
// sendtodac(ADDR_DATA,54613);
dacin += 5000;
if(dacin > 65000) dacin = 0;
}
}