Design of D/A triangle wave generator based on single chip microcomputer

Publisher:chinapxfLatest update time:2022-04-28 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

D/A Converter

  • When CS=0 and ILE=1, the signal on the data bus is written into the 8-bit input latch when the WR1 signal is valid.

  • When XFER=0, the data of the input register is transferred to the 8-bit DAC register when the WR2 signal is valid, and the output value changes accordingly

Way of working:

  • Direct working mode (as shown in the following experiment)

    • When a ground line or the output line of the address decoder makes CS valid (low level), ILE high level, and WR1/XFER/WR2 is low level, the data byte on the microcontroller data line passes directly through the D/A converter, is converted and output

    • CS and WR1 are connected to the pins and set to low level by software

    • VCC, VREF, ILE connect to POWER

    • WR2, XFER, RFB, GND*2 to GND

  • Single buffer mode

    • Only applicable to systems with only one analog output or several analog outputs but no synchronization is required

    • ILE, VCC to POWER

    • CS and XFER are connected to the microcontroller pins, and the input register and DAC register addresses are both 7FFFH

    • WR1 and WR2 are connected to the MCU WR pin, and the MCU write signal

    • When the microcontroller performs a write operation on DAC0832, a byte of data is directly written into the DAC register, and the output analog value changes accordingly.

  • Double buffering

    • When multiple D/A conversion interfaces require synchronous D/A conversion output, double buffering must be used. The input latching and D/A conversion output of DAC0832 digital quantity are completed in two steps. That is, the CPU data bus outputs digital quantity in time-sharing and latches it in the input register of each D/A converter; then the CPU sends a control signal to all D/A converters, and each input register → DAC register realizes synchronous conversion output.

    • Each analog output requires a DAC0832

    • The output latch address of DAC0832 (1) is 0DFFFH

      DAC0832 (2) output latch address 0BFFFH

      The DAC register address of the two DAC0832s is the same as 7FFFH

————————————————————————————————————————————

Triangle wave generator experiment based on DAC0832

Experimental description:

  • Use the DAC0832 chip to make a signal generator and output a triangle wave signal

  • Direct working mode

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Wiring Instructions:

image.png

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Implementation code:

include

typedef unsigned char uchar;

typedef unsigned int uint;

sbit cs = P3 ^ 7;

sbit wr = P3^6;

void Delay(uchar m)

{

    while(m--);

}

void main()

{

    uchar k = 0; //Set the initial value of k to 0

    cs = 0; //When CS and WR1 are set to low level, be ready to write data. As long as there is data output from P0 port, DAC0832 will convert it into analog signal

    wr = 0;

    while(1) //The output value changes between 0-255 and 255-0, and the analog signal can be seen through the oscilloscope

    {

        while(1) //The output value changes between 0-255

        {

            P0 = k++; //output k and k+1

            Delay(1);

            if (k == 0xff) //End the loop when it reaches 255

                break;

        }

        while(1) //The output value changes between 255-0

        {

            P0 = k--; //Output k and k-1

            Delay(1);

            if (k == 0x00) //End the loop when it reaches 0

                break;

        }

    }

}



Keywords:MCU Reference address:Design of D/A triangle wave generator based on single chip microcomputer

Previous article:Design of A/D Digital Voltage Meter Based on Single Chip Microcomputer
Next article:Design of frequency measurement control system based on single chip microcomputer

Recommended ReadingLatest update time:2024-11-24 21:21

39-Thermistor temperature measurement design based on 51 single chip microcomputer
Specific implementation functions The system consists of STC89C52 microcontroller + thermistor + TLC2543AD module + LCD1602 display module + alarm module + power supply. Specific functions: 1. LCD1602 displays the measured temperature value and the set temperature range 2. The temperature range can be set by pre
[Microcontroller]
39-Thermistor temperature measurement design based on 51 single chip microcomputer
MCU Programming Music Programming Program
#include  #define uchar unsigned char #define uint unsigned int #define ulong unsigned long sbit BEEP=P2^0; //speaker output pin uchar th0_f; //The upper 8 bits of the value of T0 loaded in the interrupt uchar tl0_f; //The lower 8 bits of the value of T0 loaded in the interrupt uchar key; /*---------------
[Microcontroller]
4. MCU reads ID card (hardware debugging and code reading)
1. Power amplifier circuit and 125Khz carrier measurement Point A is the measurement point of the oscilloscope, and the signal carrier is the 125KHz waveform generated by the microcontroller. Actual waveform 2. LC resonant circuit and sine wave measurement Point B is the oscilloscope measurement point 3. Envelo
[Microcontroller]
4. MCU reads ID card (hardware debugging and code reading)
How to read the measured resistance value from the LCD display using a single chip microcomputer
    1 Introduction     In the process of circuit testing, it is often encountered that due to the neglect of the influence of certain small resistances , there is a large error between the experimental data and the theoretical value, thus affecting the test effect. For example, there is often copper resistance in indu
[Microcontroller]
How to read the measured resistance value from the LCD display using a single chip microcomputer
MCS-51 microcontroller command system (1)
Command system overview Instructions are instructions and commands used by the computer to control a specific action performed by various functional components. The set of instructions that a computer can recognize and execute is its instruction system. An instruction set is a set of codes that controls a computer t
[Microcontroller]
Brief Introduction of Time Controller System Based on P87LPC761 Single Chip Microcomputer
1. System Introduction This time controller is a small system composed of a P87LPC761 microcontroller and an extended 74HCl64. It controls a relay and can set the time of the day, the on and off time of the relay. A total of 6 timing groups can be set, which can eliminate unnecessary timings and enable emergency star
[Microcontroller]
Design of C8051 microcontroller to realize multi-target ultrasonic ranging
Ultrasonic ranging sensors are widely used in industrial field ranging, mobile robot navigation and positioning due to their high measurement accuracy, fast response and low price. The commonly used method for ultrasonic ranging sensors is that one transmitter corresponds to one receiving head, and there are also mult
[Microcontroller]
Design of C8051 microcontroller to realize multi-target ultrasonic ranging
Design of USB download line for AT89S52 single chip microcomputer
1 Introduction Different microcontrollers have different download cables, and generally speaking, they have different download software and hardware drivers. These software and programs have different versions as the functions are improved and the operation is improved. This causes the users of the download cab
[Analog Electronics]
Design of USB download line for AT89S52 single chip microcomputer

Recommended posts

Tank-1 test stand description (for burning and testing ESP8266 series)
Tank-1teststanddescriptiondatacanbeburnedandtestedinsmallbatches
普拉世科技 Download Centre
[ST NUCLEO-U575ZI-Q Review] GPIOG port lighting problem
SomenetizensareaskingwhyPG2doesn'tlightup.Hereisanexplanation.BecausePG2usesVDDIO2,itsVDDIO2powersupplyneedstobeconfiguredseparately. VDDIO2needstobeenabledfirst.NotethatthePWRclockneedstobeenabled
qinyunti stm32/stm8
What is the difference between the bypass and filtering functions of capacitors?
Whatisthedifferencebetweenthebypassandfilteringfunctionsofcapacitors? Bypassingisaimedatthesignalpath,providingalooptothegroundforcertainspectralcomponentsinthesignal,suchashigh-frequencybypass.Bypassingisa
深圳小花 MCU
[Digi-Key Follow me Issue 2] When purchasing Adafruit ESP32-S3 TFT Feather, be careful of the onboard BME280! !
Shareamessage: AfterseeingtheFollowme2ndevent,Iimmediatelyplacedanorderfortheboard,but...TodayItookacloserlookandfoundthattheonboardsensorwasmissingaBME280.Soifyouaregrouporderingmaterials,youcanconsider
alanlan86 DigiKey Technology Zone
Introduction and working principle of humidity sensitive capacitor (humicap)
Humiditysensitivecapacitors(Englishname:humicap)aregenerallymadeofpolymerfilmcapacitors.Commonlyusedpolymermaterialsincludepolystyrene,polyimide,celluloseacetate,etc.Whentheambienthumiditychanges,thedielectricconstant
Jacktang Analogue and Mixed Signal
Reading finalists: "Fun micro-projects, easy to learn Python" + basic knowledge data types
Pythonisadynamicallytypedlanguage,meaningyoudonotneedtospecifythetypeofavariablewhenyoudeclareit. ThereareindeedmultipledatatypesinPython,whichdeterminewhattypeofdataavariablecanstoreandwhatoperationscanb
meiyao ARM Technology
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号