Hello Everyone,

I have interfaced AD9913 with STM32F103 board using Arduino IDE and it works perfectly. Actually my task is to take the parameters input through Arduino serial and DAC value is given in floating point format. To transfer it via SPI, I need to make it either in binary or in Hexadecimal. My doubt here is, How do i convert the DAC current (floating point) to hexadecimal?

I am trying to make one user interface to input parameters through application and for testing purpose I will need to enter it many times so in that case i need to take DAC input through application in floating point format.

Thanks

Anurag

I assume you are referring to the formula on page 13 of the data sheet. That is, the full scale DAC current as a function of the Rset resistor and "x" (the 10-bit FSC value in the DAC Control Register -- Address 0x02).

STEP 1:

Determine the value of x based on the desired full scale DAC current and the value of the Rset resistor. Solving the formula in the data sheet for x yields:

x = round(48.54369*Iout*Rset - 1)

Where Iout is in amperes, Rset is in ohms and round() means to round the value in parentheses to the nearest integer. For example, given Rset=4620 and Iout=0.003, then x=619.

STEP 2:

Convert x to binary. In the example above, x = 619 decimal. Converting 619 to binary yields: 10 0110 1011

STEP 3:

Program the FSC register with x. Note the FSC registers splits across the two lower bytes of the DAC Control Register. That is, register Bits[9:8] correspond to the 2 MSBs of the binary value of x and register Bits[7:0] correspond to the 8 LSBs of the binary value of x. The example above yields Bits[9:8]=10 and Bits[7:0]=01101011.