Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
00001 /*************************** 00002 * Controller for 10bit DAC * 00003 * MAX5741 Ramp Signal * 00004 * 08/07/2016 * 00005 * Dan Argust * 00006 ***************************/ 00007 00008 #include "mbed.h" 00009 00010 //SPI(MOSI,MISO,SCLK) 00011 SPI device(P0_9,P0_8,P1_29); 00012 DigitalOut cs(P0_2); 00013 00014 int response = 0; 00015 unsigned int control = 0x0; 00016 unsigned int data = 0x000; 00017 00018 int main() { 00019 device.format(16,1); 00020 control = 0xf; 00021 data = 0xf010; 00022 cs = 0; 00023 response = device.write((control<<12)|(data)); 00024 cs = 1; 00025 control = 0xc; 00026 data = 0x000; 00027 while(true){ 00028 cs = 0; 00029 response = device.write((control<<12)|(data)); 00030 cs = 1; 00031 (data>=0xffc) ? (data=0) : (data += 0x04); 00032 wait_us(1); 00033 } 00034 }
Generated on Fri Jul 15 2022 21:20:56 by
1.7.2