Design of Interface between DS2450 Converter and 51 Single Chip Microcomputer

Publisher:灵感狂舞Latest update time:2011-10-21 Keywords:DS2450 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In normal mode, the serial communication rate is 16.3kbps, while the rate in overspeed mode can reach 142kbps. The on-chip 16-bit cyclic redundancy check code generator can be used to detect the correctness of communication. DS2450 is a single-bus four-channel successive approximation A/D converter chip produced by DALLAS. Its input voltage range, conversion precision bit and alarm threshold voltage are all programmable; each channel can use its own memory to store parameters such as voltage range settings, conversion results and threshold voltage. DS2450 uses an 8-pin SOIC small package. It can be powered by a single 5V power supply or a parasitic power supply. The power consumption of the chip is only 2.5mW when it is working normally and 25μW when it is idle. Multiple DS2450 or other single-bus chips with MicroLAN interface can be connected in parallel. The CPU only needs one port line to communicate with many single-bus chips, and it occupies fewer ports of the microprocessor, so a large number of pins and logic circuits can be saved.

1 DS2450 pinout and internal structure DS2450 PDF download

1.1 Pin Function

DS2450 uses 8-pin SOIC package, and its pin functions are described as follows:

  • Pin 1 (VDD): working power supply access terminal;
  • Pin 2 (N.C): floating pin;
  • Pin 3 (DATA): serial data input/output terminal;
  • Pin 4 (GND): ground terminal;
  • Pin 5 (AIN-A): A-channel analog voltage input terminal;
  • Pin 6 (AIN-B): B-channel analog voltage input terminal;
  • Pin 7 (AIN-C): C-channel analog voltage input terminal;
  • Pin 8 (AIN-D): D-way analog voltage input terminal.

1.2 Internal structure

The internal structure of DS2450 is shown in Figure 1. The 64-bit serial number in the photolithography ROM is photolithography-prepared before leaving the factory, and it can be regarded as the address serial code of the DS2450. The arrangement of the 64-bit photolithography ROM is: the first 8 bits (20H) are the product type number, the next 48 bits are the serial number of the DS2450 itself, and the last 8 bits are the cyclic redundancy check code of the previous 56 bits (CRC = X8 + X5 + X4 + 1); the role of the photolithography ROM is to make the address of each single bus device different, so that multiple single bus chips can be connected on one bus.

Internal structure of DS2450

For a 1-wire port, other functions cannot be realized before the ROM function is established. The bus controller must first provide a ROM function control command (8 bits) to the DS2450 through the DATA pin. Its 7 function control commands are:

(1) Read ROM, command word [33H];

(2) Matching ROM [55H];

(3) Search ROM [F0H];

(4) Skip ROM [CCH];

(5) Conditional search ROM [ECH];

(6) Overspeed skip ROM [3CH];

(7) Overspeed matching ROM [69H].

The execution of the Overspeed Skip ROM or Overspeed Match ROM commands can make the serial communication rate as high as 142kbps. If multiple devices are connected on one line, these commands can operate on the 64-bit ROM part of each device and select a specific device. Then the next step of A/D conversion control commands and read/write memory commands are executed on the selected DS2450. All commands or data read/writes start from the lowest bit.

1.3 Memory

The DS2450 has 24 connected 8-bit memories inside, which can be divided into 3 pages, 8 bytes per page. Page 0 is the A/D conversion result memory, each channel occupies 2 bytes, a total of 16 bits. When the chip is powered on and reset, this page is cleared to 0; Page 1 is the A/D conversion control and status memory; Page 2 is the input high/low limit alarm value memory for each channel.

2 Conversion and read/write control

2.1 Conversion Control

The conversion control of DS2450 first sends the conversion command word [3CH] serially through its DATA terminal, then sends the channel selection word and preset control word, and finally starts the A/D converter for conversion. The meaning of each bit of the channel selection word and preset control word of DS2450 is listed in Table 1.

The meaning of each bit of the channel selection word and preset control word of DS2450

In the channel selection word, the corresponding bit is 1, indicating that the channel participates in the conversion. When multiple channels are selected at the same time, the conversion order is A→B→C→D, and the unselected channels will be skipped. The A/D conversion time can be approximated as:

Conversion time = number of channels × number of conversion accuracy bits × 80μs + 160μs.

When all channels have been converted, the system will issue a read memory command to obtain the conversion results and corresponding status.

The preset control word can be used to preset the conversion result memory of the corresponding channel. When SET, CLR = 00, it is not preset, that is, the last conversion value is kept; when SET, CLR = 01, it is preset to all 0 before conversion; when SET, CLR = 10, it is preset to all 1; and SET, CLR = 11 is an invalid combination.

2.2 Memory read/write control

The read memory command can be used to read conversion results, working status, threshold setting values, etc. The bus manager first sends out the read memory command word [AAH], and then sends out two bytes of 16-bit "starting data" memory address, and after reading a byte of data on the bus, the address automatically increases by 1, and then reads the next data; when a page is read, the next two bytes read are the 16-bit cyclic redundancy check code automatically generated internally, which is generated by the command word, address and memory data sent previously and according to the following expression:

CRC16=X 16 +X 15 +X 2 +1

The write memory command is mainly for the 1st and 2nd page memories, and its purpose is to write the working mode control word of each channel and the high and low threshold setting values ​​of the corresponding channel. The bus manager first sends the write memory command word [55H], then sends the two-byte 16-bit memory start address, and then sends the data to be written one by one, and its address is also automatically increased by 1. If a read operation is performed just after writing a data, the read data should be exactly the data written last time. This feature can be used to compare the written and read data to determine the correctness of the transmission.

If a transmission error is found during the software check, the DS2450 chip must be initialized and the read/write operation must be repeated.

2.3 DS2450 working sequence

The first-line working protocol flow of DS2450 is: initialization → ROM function command → memory read/write/convert control function command → data transmission. Its working sequence includes initialization sequence, write sequence and read sequence. Figure 2 shows the working sequence in normal working mode.

Working sequence in normal working mode

3 Typical interface design between DS2450 and MCU

Figure 3 is a typical connection circuit between MCS-51 series microcontroller and DS2450. The DATA terminal of DS2450 is connected to P1.0 of AT89C51. The circuit adopts external power supply mode, and the VCC terminal of DS2450 is powered by 5V power supply. In this example, only D channel is converted into A/D, AIN-D is connected to analog signal input; AIN-A and AIN-B are connected to pull-up resistors to power supply, and their output can be used as high and low limit alarm signals of D channel.

MCS

If the crystal frequency used in the microcontroller system is 12MHz, then three subroutines can be written according to the initialization timing, write timing, and read timing of the DS2450: INIT is the initialization subroutine, which can be used to send a reset pulse and receive a presence pulse; WRITE is the write (command or data byte) subroutine; READ is the read data subroutine. All commands or data bytes to be read or written are placed in the A register.

To complete A/D conversion by controlling DS2450 through the host, the following steps are generally required: initialization, sending ROM function commands and corresponding 64-bit photolithography ROM data, selecting a specific chip, writing working mode control words and high/low limit thresholds, sending conversion control commands, reading conversion values ​​and status, etc.

If the D channel is set to 5.1V input range, the conversion accuracy is 12 bits, the high alarm threshold is 3.0V (96H), the low alarm threshold is 2.0V (64H), and channel A and channel B are used as alarm outputs, and finally the conversion results are placed at 30H and 31H, then the specific program list of its subroutine CTLAD is as follows:

program

program

program

program

program

CTLAD: LCALLINIT; sends a reset pulse and receives a presence pulse

If there are multiple DS2450s and other single-bus interface chips connected on one line, the writing of the subroutine CTLAD that uses parasitic power supply and overspeed mode and requires verification during communication may be more complicated.

Keywords:DS2450 Reference address:Design of Interface between DS2450 Converter and 51 Single Chip Microcomputer

Previous article:Design of Interface between DS2450 Converter and 51 Single Chip Microcomputer
Next article:Design of serial communication based on 51 single chip microcomputer application system

Recommended ReadingLatest update time:2024-11-16 21:02

Simulation Design of Eight-way Answering Machine Based on 51 Single-chip Microcomputer
First, the referee presses the start button on the right, the buzzer sounds, and the quiz begins. The initial time is 20 seconds. If contestants 1-8 press the button, their quiz is successful and the contestant number is displayed on the screen. If no one takes the quiz after the time (20 seconds), the time is reset t
[Microcontroller]
Simulation Design of Eight-way Answering Machine Based on 51 Single-chip Microcomputer
51 MCU Introduction - Basic Knowledge Summary
Part 1 Introduction to MCU MSC-51 microcontroller refers to a microcontroller with 8051 as the core, which was launched by Intel Corporation of the United States in 1980. 80C51 is a typical variety in the MCS-51 series; CMOS process microcontroller products developed by other manufacturers with 8051 as the base core a
[Microcontroller]
51 MCU Introduction - Basic Knowledge Summary
51 MCU serial communication digital tube display
/***************************************************************************************** * : 11.0592MHZ * 【Main control chip】: STC89C52 * : Serial port working mode 1, 8-bit UART, bit rate 9600, receiving serial port data, the digital tube displays in decimal format, and adds 1 to the received data and sends it
[Microcontroller]
Introduction to the differences and features of the 51 series microcontrollers
1. Characteristics of 8031 The 8031 ​​chip does not have a program memory ROM. When using it, the user needs an external program memory and a logic circuit 373. The external program memory is mostly EPROM 2764 series. If the user wants to modify the program written in the EPROM, it must be erased with a special ultr
[Microcontroller]
How to develop stc51 microcontroller under Linux
The first time I came into contact with a single-chip microcomputer , I naturally chose the simple 51 single-chip microcomputer. However, my operating system is Linux. It seems easy to get started with 51 under Windows. But it is not very smooth to build a 51 development environment on Linux. So let's talk about how
[Microcontroller]
[51 MCU Quick Start Guide] 6.3.1: Use the 1-WIRE search algorithm to search for the IDs of all DS18B20s on the single bus
Puzhong 51-Single-core-A2 STC89C52 Keil uVision V5.29.0.0 PK51 Prof. Developers Kit Version:9.60.0.0        Transplanted from 1-WIRE search algorithm        For the serial port part, see 3.3: USART Serial Port Communication        For the DS18B20 driver, see 6.3: Multi-channel reading of DS18B20 single-bus digit
[Microcontroller]
[51 MCU Quick Start Guide] 6.3.1: Use the 1-WIRE search algorithm to search for the IDs of all DS18B20s on the single bus
8051 MCU UART0 serial port initialization
1. UART0 of C8051f is an asynchronous, full-duplex serial port. Its baud rate generator is provided by Timer 1. It can be configured as an 8-bit UART or a 9-bit UART (the ninth bit is used for chip selection in multi-machine communication). SYSCLK=24.5MHZ (my board uses the internal crystal frequency as the system clo
[Microcontroller]
8051 MCU UART0 serial port initialization
51 single chip microcomputer keyboard interface circuit (including source code)
The keyboard is a switch matrix composed of several buttons. It is the most commonly used input device in the single-chip microcomputer system. Users can input instructions, addresses and data to the computer through the keyboard. Generally, a non-encoded keyboard is used in the single-chip microcomputer system. The
[Microcontroller]
51 single chip microcomputer keyboard interface circuit (including source code)
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号