FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    51 single-chip control steering gear design

     

    "Pcf8591 ADDA chip, 51 single chip microcomputer and a potentiometer are used here. By controlling the potentiometer, PWM wave is generated to control the rotation of the steering gear. And display the angle on the nixie tube. Circuit diagram This is a program /*----------------------------------------------- Name: pcf8591adda conversion of IIC protocol Content: This program operates DAAD chip through IIC protocol, reads the voltage of potentiometer, outputs analog quantity, indicates with LED brightness gradient, and selects 12Mhz crystal ------------------------------------------------*/ #include“reg52.h” #Include / / contains NOP null instruction functions_ nop_(); #Define addwr 0x90 / / write data address #Define addrd 0x91 / / read data address sbit Sda=P1^2; // Define bus connection port sbit Scl=P1^1; sbit control_ signal=P1^5; data unsigned int Display[8];// Define the value of temporarily stored nixie tube unsigned char code Datatab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};// Code table of 7 segments with negative code unsigned int ADtemp; // Define global variables unsigned int high,low; static unsigned int count1; /*------------------------------------------------ Delay procedure ------------------------------------------------*/ void mDelay(unsigned char j) { unsigned int i; for(; j》0; j--) { for(i=0; i《125; i++) {;} } } /*------------------------------------------------ Initialize timer 0 ------------------------------------------------*/ void Init_ TImer0(void) { TMOD “=0x01; // Timer setting 0.1ms in 11.0592m crystal TH0=(65536-78)/256; TL0=(65536-78)%256; // Timing 0.1ms ET0=1;// Timer interrupt on EA=1;// Total interrupt TR0=1; // Start timer 0 } /*------------------------------------------------ Start IIC bus ------------------------------------------------*/ void Start(void) { Sda=1; _ nop_(); Scl=1; _ nop_(); Sda=0; _ nop_(); Scl=0; } /*------------------------------------------------ Stop IIC bus ------------------------------------------------*/ void Stop(void) { Sda=0; _ nop_(); Scl=1; _ nop_(); Sda=1; _ nop_(); Scl=0; } /*------------------------------------------------ Reply IIC bus ------------------------------------------------*/ void Ack(void) { Sda=0; _ nop_(); Scl=1; _ nop_(); Scl=0; _ nop_(); } /*------------------------------------------------ Non answering IIC bus ------------------------------------------------*/ void NoAck(void) { Sda=1; _ nop_(); Scl=1; _ nop_(); Scl=0; _ nop_(); } /*------------------------------------------------ Send a byte ------------------------------------------------*/ void Send(unsigned char Data) { unsigned char BitCounter=8; unsigned char temp; do { temp=Data; Scl=0; _ nop_(); if((temp&0x80)==0x80) Sda=1; else Sda=0; Scl=1; temp=Data《《1; Data=temp; BitCounter--; } while(BitCounter); Scl=0; } /*------------------------------------------------ Read in a byte and return ------------------------------------------------*/ unsigned char Read(void) { unsigned char temp=0; unsigned char temp1=0; unsigned char BitCounter=8; Sda=1; do { Scl=0; _ nop_(); Scl=1; _ nop_(); if(Sda) temp=temp|0x01; else temp=temp&0xfe; if(BitCounter-1) { temp1=temp《《1; temp=temp1; } BitCounter--; } while(BitCounter); return(temp); } /*------------------------------------------------ Read the value of ad analog-to-digital conversion, and there is a return value ------------------------------------------------*/ unsigned int ReadADC(unsigned char Chl) { unsigned int Data; Start(); // Start signal Send(AddWr);// 0x90 Ack(); Send(0x40|Chl);// Write the selected channel. This program only uses single ended input, and the differential part needs to be added by itself //The values of Chl are 0, 1, 2 and 3 respectively, representing 1-4 channels respectively Ack(); Start(); Send(AddRd); // Read in address Ack(); Data=Read(); // Read data Scl=0; NoAck(); Stop(); return Data; // Return value } /******************************************************************/ /*Main program*/ /******************************************************************/ void main() { Init_ TImer0(); while(1) { unsigned int angle; ADtemp=ReadADC(0); // The value range of adtemp is 0-255 and the timing time range is 0.5-2.5ms high=65075-7.2*ADtemp; // ( high=65035-7.8*ADtemp; 12MHz)(65535-(460+7.2*ADtemp 11.0592MHz) low=47563+7.2*ADtemp; // ( low=46035+7.8*ADtemp; ) ( 65535-(17972-7.2*ADtemp 11.0592MHz ) angle=ADtemp*0.7; Display[0]=Datatab[angle/100];// Processing channel 0 voltage display Display[1]=Datatab[(angle%100)/10]; Display[2]=Datatab[angle%10]; while(1) { P0=Display[count1];// For dynamic scanning nixie tube P2=count1; mDelay(1); count1++; If (COUNT1 = = 3) / / scan 3 nixie tubes { count1=0; break; } } } } /******************************************************************/ /*Timer interrupt function /******************************************************************/ void TIm(void) interrupt 1 using 1 { staTIc unsigned char count; if (! count) { control_ signal = 1; // Feed high level TH0=high/256; TL0=high%256; } else { control_ signal=0 ; TH0=low/256; TL0=low%256; } count=~count; }, read the full text“

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us