/****************************************************
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
Previous article:Happy Birthday music player
Next article:Traffic Light Simulation Experiment Procedure
Recommended ReadingLatest update time:2024-11-15 14:55
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Qorvo PAC series highly integrated motor control chips and applications
- How to choose a power supply for automotive camera modules
- Application of machine vision technology in film inspection system
- 2021 Open Source Hardware Summit Calls for Proposals
- If pure fuel vehicles are no longer sold in 2025, is it still necessary to buy high-priced fuel vehicles now?
- Liquid crystal module handling precautions and storage conditions
- Thank you for being here
- Ask a question about the make command
- What is the resistance value of a 0Ω resistor? How much current can a 0Ω resistor pass?
- APWM