<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>DAC 7562 With NRF51822</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/5718/dac-7562-with-nrf51822</link><description>Hi,
Basically, I have a DAC 7562 chip with inputs connected to pin 0.17(SYNC pin), 0.18(SCLK pin), 0.19(TX/Din pin), 0.13(CLR pin), 0.14(LDAC pin) with outputs connected to an op-amp connected to P0.01. Please can anyone show me some example code of</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 28 Feb 2015 15:43:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/5718/dac-7562-with-nrf51822" /><item><title>RE: DAC 7562 With NRF51822</title><link>https://devzone.nordicsemi.com/thread/20006?ContentTypeID=1</link><pubDate>Sat, 28 Feb 2015 15:43:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:961344c9-7a5d-4f1e-8931-0f5c160a41b7</guid><dc:creator>Kosidinma</dc:creator><description>&lt;p&gt;thanks I will look into this and give feedback...but what about the CLR pin and the LDAC pin? Also, seeing as its a DAC and not a proper communication channel, how do I know the bits to write for the Din pin?? Also, do I just ignore the MISO pin declaration?? Sorry i&amp;#39;m really new to all this&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DAC 7562 With NRF51822</title><link>https://devzone.nordicsemi.com/thread/20005?ContentTypeID=1</link><pubDate>Tue, 24 Feb 2015 12:49:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:852f4a83-5af5-482e-9a99-7eede5731615</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;If you look at the timing diagram on page 7 of the DAC7562 datasheet, in order to make it work you would need a clock signal to shift data in to the input register on the DAC (SCLK pin), a signal to enable the input shift register (SYNC pin) and the serial data itself (DIN pin).&lt;/p&gt;
&lt;p&gt;To me this looks very similar to the SPI protocol. SPI has a clock (SCK), a slave select (SS) and a data wire from master to slave (MOSI).&lt;/p&gt;
&lt;p&gt;You can start by looking at the spi_master example in the SDK (v7.2.0).&lt;/p&gt;
&lt;p&gt;In the DAC7562 datasheet it is specified on page 6 that the DIN register takes 24 bits. This corresponds to 3 bytes over the SPI bus.&lt;/p&gt;
&lt;p&gt;If you start with the spi_master example code, you could achieve this by simply replacing the &lt;code&gt;main()&lt;/code&gt; function with this code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int main(void){
    bsp_configuration();
	uint8_t tx_data[3] = {0xAA, 0xAB, 0xAC}; // Fill in the 24 bits you want to write here.
	uint8_t rx_data[3];
    spi_master_init(SPI_MASTER_0, spi_master_0_event_handler, true);
    spi_master_send_recv(SPI_MASTER_0, tx_data, 3, rx_data, 3);
    for (;; ){}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Of course you need to change the pin configuration of the SPI interface. In the &lt;code&gt;spi_master_init()&lt;/code&gt; function in &lt;strong&gt;main.c&lt;/strong&gt; the SCK, SS and MOSI pins are defined. You can simply change this to the pins you prefer. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;spi_config.SPI_Pin_SCK  = 18;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Hope this will get you started.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIT 04.03.15:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To answer the questions in your comment:&lt;/p&gt;
&lt;p&gt;The CLR and LDAC operation is specified in table 2 in the datasheet. CLR pin is driven low to clear the output. If you do not want to clear the output you must set this pin high. LDAC is used when the DAC is operating in asynchronous mode (which is also described in the same table), if you are fine with synchronous mode you can connect this to GND.&lt;/p&gt;
&lt;p&gt;If you want to connect all the pins to the nRF51 you can control the output voltages of the different pins with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;quot;nrf_gpio.h&amp;quot;
nrf_gpio_cfg_output(PIN_NUMBER) //Set as output
nrf_gpio_pin_set(PIN_NUMBER) //Set high
nrf_gpio_pin_clear(PIN_NUMBER) //Set low (GND)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The bits to write on the DIN pin i don&amp;#39;t know, but I&amp;#39;m pretty sure that is specified in the datasheet of the DAC.&lt;/p&gt;
&lt;p&gt;You have to declare the MISO pin. Just assign it to an unused pin if you are not going to use it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>