Example host software for the Maxim Integrated MAX5715 12-bit 4-channel voltage-output DAC. Hosted on the MAX32625MBED.

Dependencies:   MAX5715

Committer:
whismanoid
Date:
Mon Apr 29 07:36:19 2019 +0000
Revision:
1:f82c4c7fe134
Parent:
0:cb3754747a08
Child:
2:015f0dc1ff16
MAX5715BOB MAX5715 update LDAC,CLR pin declaration order

Who changed what in which revision?

UserRevisionLine numberNew contents of line
whismanoid 0:cb3754747a08 1 /*******************************************************************************
whismanoid 0:cb3754747a08 2 * Copyright (C) 2019 Maxim Integrated Products, Inc., All Rights Reserved.
whismanoid 0:cb3754747a08 3 *
whismanoid 0:cb3754747a08 4 * Permission is hereby granted, free of charge, to any person obtaining a
whismanoid 0:cb3754747a08 5 * copy of this software and associated documentation files (the "Software"),
whismanoid 0:cb3754747a08 6 * to deal in the Software without restriction, including without limitation
whismanoid 0:cb3754747a08 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
whismanoid 0:cb3754747a08 8 * and/or sell copies of the Software, and to permit persons to whom the
whismanoid 0:cb3754747a08 9 * Software is furnished to do so, subject to the following conditions:
whismanoid 0:cb3754747a08 10 *
whismanoid 0:cb3754747a08 11 * The above copyright notice and this permission notice shall be included
whismanoid 0:cb3754747a08 12 * in all copies or substantial portions of the Software.
whismanoid 0:cb3754747a08 13 *
whismanoid 0:cb3754747a08 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
whismanoid 0:cb3754747a08 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
whismanoid 0:cb3754747a08 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
whismanoid 0:cb3754747a08 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
whismanoid 0:cb3754747a08 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
whismanoid 0:cb3754747a08 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
whismanoid 0:cb3754747a08 20 * OTHER DEALINGS IN THE SOFTWARE.
whismanoid 0:cb3754747a08 21 *
whismanoid 0:cb3754747a08 22 * Except as contained in this notice, the name of Maxim Integrated
whismanoid 0:cb3754747a08 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
whismanoid 0:cb3754747a08 24 * Products, Inc. Branding Policy.
whismanoid 0:cb3754747a08 25 *
whismanoid 0:cb3754747a08 26 * The mere transfer of this software does not imply any licenses
whismanoid 0:cb3754747a08 27 * of trade secrets, proprietary technology, copyrights, patents,
whismanoid 0:cb3754747a08 28 * trademarks, maskwork rights, or any other form of intellectual
whismanoid 0:cb3754747a08 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
whismanoid 0:cb3754747a08 30 * ownership rights.
whismanoid 0:cb3754747a08 31 *******************************************************************************
whismanoid 0:cb3754747a08 32 */
whismanoid 0:cb3754747a08 33
whismanoid 0:cb3754747a08 34 #include "mbed.h"
whismanoid 0:cb3754747a08 35 //#include "max32625.h"
whismanoid 0:cb3754747a08 36 #include "MAX5715.h"
whismanoid 0:cb3754747a08 37 #include "USBSerial.h"
whismanoid 0:cb3754747a08 38
whismanoid 0:cb3754747a08 39 //MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
whismanoid 0:cb3754747a08 40 //DigitalOut rLED(LED1);
whismanoid 0:cb3754747a08 41 //DigitalOut gLED(LED2);
whismanoid 0:cb3754747a08 42 //DigitalOut bLED(LED3);
whismanoid 0:cb3754747a08 43 SPI spi(SPI1_MOSI, SPI1_MISO, SPI1_SCK); // mosi, miso, sclk spi1 TARGET_MAX32635MBED: P1_1 P1_2 P1_0 Arduino 10-pin header D11 D12 D13
whismanoid 0:cb3754747a08 44 DigitalOut spi_cs(SPI1_SS); // TARGET_MAX32635MBED: P1_3 Arduino 10-pin header D10
whismanoid 1:f82c4c7fe134 45 DigitalOut LDACb_pin(P1_5); // TARGET_MAX32635MBED: Arduino 10-pin header D9
whismanoid 1:f82c4c7fe134 46 DigitalOut CLRb_pin(P1_4); // TARGET_MAX32635MBED: Arduino 10-pin header D8
whismanoid 1:f82c4c7fe134 47 MAX5715 g_MAX5715_device(spi, spi_cs, LDACb_pin, CLRb_pin, MAX5715::MAX5715_IC);
whismanoid 0:cb3754747a08 48
whismanoid 0:cb3754747a08 49 int main()
whismanoid 0:cb3754747a08 50 {
whismanoid 0:cb3754747a08 51 //MAX5715 dac(spi, spi_cs, MAX5715::MAX5715_IC);
whismanoid 0:cb3754747a08 52 //dac.Init();
whismanoid 0:cb3754747a08 53
whismanoid 0:cb3754747a08 54 g_MAX5715_device.Init();
whismanoid 0:cb3754747a08 55 g_MAX5715_device.REF(MAX5715::REF_AlwaysOn_2V500);
whismanoid 0:cb3754747a08 56
whismanoid 0:cb3754747a08 57 //uint16_t code = 4095;
whismanoid 0:cb3754747a08 58 //g_MAX5715_device.CODEallLOADall(code);
whismanoid 0:cb3754747a08 59
whismanoid 0:cb3754747a08 60 //
whismanoid 0:cb3754747a08 61 uint16_t ch = 0;
whismanoid 0:cb3754747a08 62 uint16_t code = 0xccc;
whismanoid 0:cb3754747a08 63 g_MAX5715_device.CODEnLOADn(ch, code);
whismanoid 0:cb3754747a08 64 //
whismanoid 0:cb3754747a08 65 ch = 1;
whismanoid 0:cb3754747a08 66 code = 0x800;
whismanoid 0:cb3754747a08 67 g_MAX5715_device.CODEnLOADn(ch, code);
whismanoid 0:cb3754747a08 68 //
whismanoid 0:cb3754747a08 69 ch = 2;
whismanoid 0:cb3754747a08 70 code = 0x666;
whismanoid 0:cb3754747a08 71 g_MAX5715_device.CODEnLOADn(ch, code);
whismanoid 0:cb3754747a08 72 //
whismanoid 0:cb3754747a08 73 ch = 3;
whismanoid 0:cb3754747a08 74 code = 0xFFF;
whismanoid 0:cb3754747a08 75 g_MAX5715_device.CODEnLOADn(ch, code);
whismanoid 0:cb3754747a08 76
whismanoid 0:cb3754747a08 77 //wait(1.0);
whismanoid 0:cb3754747a08 78 //wait(1.0);
whismanoid 0:cb3754747a08 79 }