AD8008 realizes A/D conversion

Publisher:RoboPilotLatest update time:2016-09-24 Source: eefocusKeywords:AD8008 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
C code:

 #include
 #include
 //#include
 sbit ST=P3^2;
 sbit EOC=P3^1;
 sbit OE=P3^0;
 sbit ADDA=P3 ^4;
 sbit ADDB=P3^5;
 sbit ADDC=P3^6;
 unsigned char a,b,c;
 unsigned char code dispbitcode[]={0x00,0x08,0x04,0x02,0x01};//shared negative bit code
 unsigned char code dispcode[]={ 0X3F,/*0*/
        0X06,/*1*/
        0X5B,/*2*/
        0X4F,/*3*/
        0X66,/*4*/
        0X6D,/*5*/
        0X7D,/*6*/
        0X07,/*7*/
        0X7F,/*8*/
        0X6F,/*9*/
};//Common cathode segment code
/*************Delay subroutine*** ****************************/
 void delay(unsigned int x) //minimum 1 millisecond
{
 unsigned char j;
 while(x- -)
 {
  for(j=0;j<125;j++)
  {;}
 }
}
/***************Display subroutine*********** ***********/
void display(unsigned char bai,unsigned char shi,unsigned char ge)
{
  //P3=dispbitcode[5];
  //P2=dispcode[11]; 
  P2=dispbitcode[ 1];
  P0=dispcode[bai]; //Display hundreds digit
    delay(5);
  //P3=dispbitcode[5];
  //P2=dispcode[11]; 
  P2=dispbitcode[2];
  P0=dispcode[shi]; //display tens digit
    delay(5);
  //P3=dispbitcode[5];
  //P2=dispcode[11]; 
  P2=dispbitcode[3];
  P0=dispcode[ge]; / /Display the unit digit
    delay(5);
}
void main(void)
{
  unsigned char c;
  ADDA=0;
  ADDB=0;
  ADDC=0; //Select channel 0

  while(1)
  { 
   ST=0;
   ST=1; //Start AD conversion_nop_
   (); //The program performs no operation once, that is, delay;
   ST=0;      
   delay(1); // Delay and wait for the conversion to end
   OE =1; // Output the converted data
   
   c=P1; // Write down the obtained data
   OE = 0;
   a=c/100; //Send to display
   b=c%100/10;
   c=c%100%10;
   display(a,b,c);
  }
}

AD8008 realizes A/D conversion - Chu People - Chu People
Keywords:AD8008 Reference address:AD8008 realizes A/D conversion

Previous article:DS18B20 single bus temperature control
Next article:8255 Expansion I/O

Recommended ReadingLatest update time:2024-11-17 00:21

OPPO Find N launches ColorOS 12 A.06 update on the first day of sale
      Today, the OPPO Find N foldable screen phone is officially on sale, with a starting price of 7,699 yuan. This phone received the ColorOS 12 PEUM00_11_A.06 system update today, with a size of 369MB.   This update adds Google's December security patch to improve security. In addition, it adds many new features and
[Mobile phone portable]
OPPO Find N launches ColorOS 12 A.06 update on the first day of sale
Application design of FAN6754A in PWM flyback switching power supply
This paper introduces the working characteristics and principles of the new peak current type PWM control chip FAN6754A, and analyzes the design principle and working process of the flyback switching power supply. According to the secondary circuit structure, a new flyback switching voltage regulator is designed. Th
[Power Management]
Application design of FAN6754A in PWM flyback switching power supply
Application of LabVIEW in the production of wiper motors for Volkswagen Bora A4
In the production of automobile wiper motors, how to test motor performance and motor vibration online, store test data and print barcodes? Engineers used National Instruments' analog acquisition cards and digital acquisition cards, equipped with vibration sensors, magnetic powder brakes, torque sensors, encoders an
[Automotive Electronics]
Application of LabVIEW in the production of wiper motors for Volkswagen Bora A4
Google Pixel 5a Google Fi contract price revealed: starting at $9 per month for 24 months
     Google released the Pixel 5a 5G phone overseas on August 17. This product is positioned at the entry level, equipped with a Qualcomm Snapdragon 765G processor, equipped with a 6.34-inch FHD+ OLED screen, and priced at US$449 (approximately RMB 2,909.52).   According to foreign media GSMArena, Google has also laun
[Mobile phone portable]
Google Pixel 5a Google Fi contract price revealed: starting at $9 per month for 24 months
First look at ARM cotex-A9
1) The role of resistance        The resistor connected between the power supply and the reference point        (1) Function: Set the reference point level to high level by default        The resistor between ground and the reference point        (1) Function: Set the reference point level to low level by defau
[Microcontroller]
Functional characteristics and application analysis of PEL-2000A programmable DC electronic load
Product introduction: PEL-2000A programmable DC electronic load. This electronic load can work in constant current, constant voltage, and constant resistance modes. It can also simulate various dynamic load conditions and increase and decrease the load voltage, current, and load through the sequence function. Slope, c
[Test Measurement]
Renault's Twingo ZE minivan and domestic A00 car battery
The cornerstone of this round of electrification in Europe is the full electrification of micro and small cars, which is the current European automakers' radical transformation of these less profitable models. Renault Twingo ZE and Smart Forfour share the same platform and are manufactured at the Revoz plant in Novo M
[Automotive Electronics]
Renault's Twingo ZE minivan and domestic A00 car battery
Vishay launches new fully integrated ultra-small proximity sensor with standby current as low as 5 μA
The device uses a vertical-cavity surface-emitting laser and intelligent dual I2C slave addresses and is suitable for a variety of battery-powered consumer electronics applications such as true wireless stereo (TWS) headsets, virtual reality/augmented reality (VR/AR) helmets, etc. MALVERN, Pennsylvania, USA, and
[sensor]
Vishay launches new fully integrated ultra-small proximity sensor with standby current as low as 5 μA
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号