DAC7611 control digital/analog converter program

Publisher:一条属马的龙Latest update time:2018-01-10 Source: eefocusKeywords:DAC7611 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

/**************************************************** 
Subroutine name: DAC7611Program 
function: Control the working program of digital/analog converter DAC7611Export 
: Pin P1.0 (output chip select signal) 
          Pin P1.1 (output clock) 

          Pin P1.2 (output data)  
        Pin P1.3 (output digital/analog conversion process start signal) 
       12M crystal oscillator 
******************************************************/ 

#include 
#include 
#define uint unsigned int  

sbit CS =P1^0; //Output chip select signal 
sbit CLK=P1^1; //Output clock 
sbit   SDI =P1^2; //Output data 
sbit LD=P1^3; //Output digital/analog conversion process start signal  

/******Initialize DAC7611******************/ 
void init_da(void) 

  LD=0; //Load pin low 
  CS=1; //Chip select high 
  CLK=1; //Clock high 
  SDI=0; 


/*****Clock pulse sub-function***********/ 
void c LOC k(void) 

  CLK=0;  
  _nop_(); 
  CLK=1; //Generate a clock 
  pulse_nop_();   

/******DAC7611 conversion******************/ 

void DAC_7611(uint vol) 

  uint i,j;   
  vol<<=4; 
  LD=1; //Load pin high_nop_ 
  (); 
  CS=0; //Chip select low, ready for conversionfor          
  (i=0;i<12;i++) 
   {   
     j=vol; 
     SDI=j&0x8000;    
     clock(); 
     vol<<=1; 
   } 
  CLK=1; // Output clock high_nop_ 
  (); 
  CS=1; //DAC7611 chip select pin CS high_nop_   
  ();   
  LD=0; //Load pin LD low to start digital-to-analog conversion_nop_ 
  ();  
  _nop_();  
  _nop_(); 
  _nop_  
  (); _nop_();  
  _nop_();  
  _nop_(); 
  _nop_(); 
  _nop_(); 
  _nop_(); 
  _nop_(); 
  _nop_() 
  ; 
  _nop_(); 
  _nop_(); //Delay for a while to make the output analog voltage stable 
  LD=1; //LD set high    


/**********Main program********************/ 
void main() 
{    
  init_da();    
  DAC_7611();   

DAC7611 control digital/analog converter program


Keywords:DAC7611 Reference address:DAC7611 control digital/analog converter program

Previous article:Happy Birthday music player
Next article:Traffic Light Simulation Experiment Procedure

Recommended ReadingLatest update time:2024-11-15 14:55

CEVA Expands RivieraWaves UWB IP to Support CCC Digital Key 3.0 Standard for Keyless Entry
CEVA Expands RivieraWaves UWB IP to Support CCC Digital Key 3.0 Standard for Keyless Vehicle Entry The CEVA-RivieraWaves™ UWB Platform IP supporting IEEE 802.15.4z supports the Car Connectivity Consortium® Digital Key 3.0 standard using an optimized software MAC layer. We have already started designing with Tier 1 a
[Internet of Things]
CEVA Expands RivieraWaves UWB IP to Support CCC Digital Key 3.0 Standard for Keyless Entry
Dyson's new Digital Slim lightweight cordless vacuum cleaner is launched globally in the Chinese market
Dyson Digital Slim lightweight cordless vacuum cleaner was launched globally in the Chinese market for the first time. It is the lightest of Dyson's cordless vacuum cleaners, weighing only 1.5 kg with the suction head, 30% lighter and 20% smaller, but still with strong performance. As a product designed specifically f
[Embedded]
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号