浓毛老太交欧美老妇热爱乱,蜜臀性色av免费,妺妺窝人体色www看美女,久久久久久久久久久大尺度免费视频,麻豆人妻无码性色av专区

位置:51電子網(wǎng) » 技術(shù)資料 » 單 片 機(jī)

單片機(jī)AT89S51與ADC0809設(shè)計(jì)一個(gè)數(shù)字電壓表

發(fā)布時(shí)間:2008/8/14 0:00:00 訪(fǎng)問(wèn)次數(shù):612

  1. 實(shí)驗(yàn)任務(wù)

  利用單片機(jī)at89s51與adc0809設(shè)計(jì)一個(gè)數(shù)字電壓表,能夠測(cè)量0-5v之間的直流電壓值,四位數(shù)碼顯示,但要求使用的元器件數(shù)目最少。

  2. 電路原理圖

   

  3. 系統(tǒng)板上硬件連線(xiàn)

  a) 把“單片機(jī)系統(tǒng)”區(qū)域中的p1.0-p1.7與“動(dòng)態(tài)數(shù)碼顯示”區(qū)域中的abcdefgh端口用8芯排線(xiàn)連接。

  b) 把“單片機(jī)系統(tǒng)”區(qū)域中的p2.0-p2.7與“動(dòng)態(tài)數(shù)碼顯示”區(qū)域中的s1s2s3s4s5s6s7s8端口用8芯排線(xiàn)連接。

  c) 把“單片機(jī)系統(tǒng)”區(qū)域中的p3.0與“模數(shù)轉(zhuǎn)換模塊”區(qū)域中的st端子用導(dǎo)線(xiàn)相連接。

  d) 把“單片機(jī)系統(tǒng)”區(qū)域中的p3.1與“模數(shù)轉(zhuǎn)換模塊”區(qū)域中的oe端子用導(dǎo)線(xiàn)相連接。

  e) 把“單片機(jī)系統(tǒng)”區(qū)域中的p3.2與“模數(shù)轉(zhuǎn)換模塊”區(qū)域中的eoc端子用導(dǎo)線(xiàn)相連接。

  f) 把“單片機(jī)系統(tǒng)”區(qū)域中的p3.3與“模數(shù)轉(zhuǎn)換模塊”區(qū)域中的clk端子用導(dǎo)線(xiàn)相連接。

  g) 把“模數(shù)轉(zhuǎn)換模塊”區(qū)域中的a2a1a0端子用導(dǎo)線(xiàn)連接到“電源模塊”區(qū)域中的gnd端子上。

  h) 把“模數(shù)轉(zhuǎn)換模塊”區(qū)域中的in0端子用導(dǎo)線(xiàn)連接到“三路可調(diào)電壓模塊”區(qū)域中的vr1端子上。

  i) 把“單片機(jī)系統(tǒng)”區(qū)域中的p0.0-p0.7用8芯排線(xiàn)連接到“模數(shù)轉(zhuǎn)換模塊”區(qū)域中的d0d1d2d3d4d5d6d7端子上。

  4. 程序設(shè)計(jì)內(nèi)容

  由于adc0809在進(jìn)行a/d轉(zhuǎn)換時(shí)需要有clk信號(hào),而此時(shí)的adc0809的clk是接在at89s51單片機(jī)的p3.3端口上,也就是要求從p3.3輸出clk信號(hào)供adc0809使用。因此產(chǎn)生clk信號(hào)的方法就得用軟件來(lái)產(chǎn)生了;由于adc0809的參考電壓vref=vcc,所以轉(zhuǎn)換之后的數(shù)據(jù)要經(jīng)過(guò)數(shù)據(jù)處理,在數(shù)碼管上顯示出電壓值。實(shí)際顯示的電壓值 (d/256*vref)

  5. 匯編源程序

  6. c語(yǔ)言源程序

  #include <at89x52.h>

  unsigned char code dispbitcode[]={0xfe,0xfd,0xfb,0xf7,

  0xef,0xdf,0xbf,0x7f};

  unsigned char code dispcode[]={0x3f,0x06,0x5b,0x4f,0x66,

  unsigned char dispbuf[8]={10,10,10,10,0,0,0,0};

  unsigned char dispcount;

  unsigned char getdata;

  unsigned int temp;

  unsigned char i;

sbit st=p3^0;

sbit oe=p3^1;

sbit eoc=p3^2;

sbit clk=p3^3;

void main(void)

{

st=0;

oe=0;

et0=1;

et1=1;

ea=1;

tmod=0x12;

th0=216;

tl0=216;

th1=(65536-4000)/256;

tl1=(65536-4000)%256;

tr1=1;

tr0=1;

st=1;

st=0;

while(1)

{

if(eoc==1)

{

oe=1;

getdata=p0;

oe=0;

temp=getdata*235;

temp=temp/128;

i=5;

dispbuf[0]=10;

dispbuf[1]=10;

dispbuf[2]=10;

dispbuf[3]=10;

dispbuf[4]=10;

dispbuf[5]=0;

dispbuf[6]=0;

dispbuf[7]=0;

while(temp/10)


  {


  dispbuf[i]=temp%10;


  temp=temp/10;


  i++;


  }


  dispbuf[i]=temp;


  st=1;


  st=0;


  }


  }


  }


  void t0(void) interrupt 1 using 0


  {


  clk=~clk;


  }


  void t1(void) interrupt 3 using 0


  {


  th1=(65536-4000)/256;


  tl1=(65536-4000)%256;


  p1=dispcode[dispbuf[dispcount]];


  p2=dispbitcode[dispcount];


  if(dispcount==7)


  {


  p1=p1 | 0x80;


  }


  dispcount++;


  if(dispcount==8)


  {


  dispcount=0;


  }


  }



  1. 實(shí)驗(yàn)任務(wù)

  利用單片機(jī)at89s51與adc0809設(shè)計(jì)一個(gè)數(shù)字電壓表,能夠測(cè)量0-5v之間的直流電壓值,四位數(shù)碼顯示,但要求使用的元器件數(shù)目最少。

  2. 電路原理圖

   

  3. 系統(tǒng)板上硬件連線(xiàn)

  a) 把“單片機(jī)系統(tǒng)”區(qū)域中的p1.0-p1.7與“動(dòng)態(tài)數(shù)碼顯示”區(qū)域中的abcdefgh端口用8芯排線(xiàn)連接。

  b) 把“單片機(jī)系統(tǒng)”區(qū)域中的p2.0-p2.7與“動(dòng)態(tài)數(shù)碼顯示”區(qū)域中的s1s2s3s4s5s6s7s8端口用8芯排線(xiàn)連接。

  c) 把“單片機(jī)系統(tǒng)”區(qū)域中的p3.0與“模數(shù)轉(zhuǎn)換模塊”區(qū)域中的st端子用導(dǎo)線(xiàn)相連接。

  d) 把“單片機(jī)系統(tǒng)”區(qū)域中的p3.1與“模數(shù)轉(zhuǎn)換模塊”區(qū)域中的oe端子用導(dǎo)線(xiàn)相連接。

  e) 把“單片機(jī)系統(tǒng)”區(qū)域中的p3.2與“模數(shù)轉(zhuǎn)換模塊”區(qū)域中的eoc端子用導(dǎo)線(xiàn)相連接。

  f) 把“單片機(jī)系統(tǒng)”區(qū)域中的p3.3與“模數(shù)轉(zhuǎn)換模塊”區(qū)域中的clk端子用導(dǎo)線(xiàn)相連接。

  g) 把“模數(shù)轉(zhuǎn)換模塊”區(qū)域中的a2a1a0端子用導(dǎo)線(xiàn)連接到“電源模塊”區(qū)域中的gnd端子上。

  h) 把“模數(shù)轉(zhuǎn)換模塊”區(qū)域中的in0端子用導(dǎo)線(xiàn)連接到“三路可調(diào)電壓模塊”區(qū)域中的vr1端子上。

  i) 把“單片機(jī)系統(tǒng)”區(qū)域中的p0.0-p0.7用8芯排線(xiàn)連接到“模數(shù)轉(zhuǎn)換模塊”區(qū)域中的d0d1d2d3d4d5d6d7端子上。

  4. 程序設(shè)計(jì)內(nèi)容

  由于adc0809在進(jìn)行a/d轉(zhuǎn)換時(shí)需要有clk信號(hào),而此時(shí)的adc0809的clk是接在at89s51單片機(jī)的p3.3端口上,也就是要求從p3.3輸出clk信號(hào)供adc0809使用。因此產(chǎn)生clk信號(hào)的方法就得用軟件來(lái)產(chǎn)生了;由于adc0809的參考電壓vref=vcc,所以轉(zhuǎn)換之后的數(shù)據(jù)要經(jīng)過(guò)數(shù)據(jù)處理,在數(shù)碼管上顯示出電壓值。實(shí)際顯示的電壓值 (d/256*vref)

  5. 匯編源程序

  6. c語(yǔ)言源程序

  #include <at89x52.h>

  unsigned char code dispbitcode[]={0xfe,0xfd,0xfb,0xf7,

  0xef,0xdf,0xbf,0x7f};

  unsigned char code dispcode[]={0x3f,0x06,0x5b,0x4f,0x66,

  unsigned char dispbuf[8]={10,10,10,10,0,0,0,0};

  unsigned char dispcount;

  unsigned char getdata;

  unsigned int temp;

  unsigned char i;

sbit st=p3^0;

sbit oe=p3^1;

sbit eoc=p3^2;

sbit clk=p3^3;

void main(void)

{

st=0;

oe=0;

et0=1;

et1=1;

ea=1;

tmod=0x12;

th0=216;

tl0=216;

th1=(65536-4000)/256;

tl1=(65536-4000)%256;

tr1=1;

tr0=1;

st=1;

st=0;

while(1)

{

if(eoc==1)

{

oe=1;

getdata=p0;

oe=0;

temp=getdata*235;

temp=temp/128;

i=5;

dispbuf[0]=10;

dispbuf[1]=10;

dispbuf[2]=10;

dispbuf[3]=10;

dispbuf[4]=10;

dispbuf[5]=0;

dispbuf[6]=0;

dispbuf[7]=0;

while(temp/10)


  {


  dispbuf[i]=temp%10;


  temp=temp/10;


  i++;


  }


  dispbuf[i]=temp;


  st=1;


  st=0;


  }


  }


  }


  void t0(void) interrupt 1 using 0


  {


  clk=~clk;


  }


  void t1(void) interrupt 3 using 0


  {


  th1=(65536-4000)/256;


  tl1=(65536-4000)%256;


  p1=dispcode[dispbuf[dispcount]];


  p2=dispbitcode[dispcount];


  if(dispcount==7)


  {


  p1=p1 | 0x80;


  }


  dispcount++;


  if(dispcount==8)


  {


  dispcount=0;


  }


  }



相關(guān)IC型號(hào)

熱門(mén)點(diǎn)擊

 

推薦技術(shù)資料

硬盤(pán)式MP3播放器終級(jí)改
    一次偶然的機(jī)會(huì)我結(jié)識(shí)了NE0 2511,那是一個(gè)遠(yuǎn)方的... [詳細(xì)]
版權(quán)所有:51dzw.COM
深圳服務(wù)熱線(xiàn):13751165337  13692101218
粵ICP備09112631號(hào)-6(miitbeian.gov.cn)
公網(wǎng)安備44030402000607
深圳市碧威特網(wǎng)絡(luò)技術(shù)有限公司
付款方式


 復(fù)制成功!