⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.lst

📁 此程序可以显示输入波形
💻 LST
📖 第 1 页 / 共 5 页
字号:
1347          extern void d0(void);
1348          
1349          extern void lcd_init(void);
1350          
1351          extern void dis_one_char(uchar x,uchar y,uchar asc_num,bit b_flag);
1352          
1353          extern void dis_one_zi(uchar x_add,uchar y_add,uchar code *po,bit back_flag,bit char_moudle);
1354          
1355          extern void delay(uint time);
1356          
1357          extern uchar bdata gate;
1358          
1359          extern void beep(uint time);
1360          
1361          void sel_x(uchar x);      //74HC390 分频系数选择1,10,100
1362          
1363          void delay_1(uchar time);
1364          
1365          extern uchar temp_l,temp_h;
1366          
1367          extern uchar i;
1368          
1369          extern unsigned char code x43[];// 量
1370          
1371          extern unsigned char code x44[];// 程
1372          
1373          extern unsigned char code x45[];// 切
1374          
1375          extern unsigned char code x46[];// 换
1376          
1377          extern unsigned char code x47[];// 请
1378          
1379          extern unsigned char code x48[];// 稍
1380          
1381          extern unsigned char code x49[];// 候
1382          
C51 COMPILER V7.50   MAIN                                                                  08/24/2007 11:21:58 PAGE 26  

1383          extern unsigned char code x50[];// …
1384          
1385          extern unsigned char code x51[];// 周
1386          
1387          extern unsigned char code x52[];// 期
1388          
1389          extern unsigned char code x7[]; // 频
1390          
1391          extern unsigned char code x8[]; // 率
1392          
1393          extern uint temp0,temp1,temp2,temp3,temp4;
1394          
1395          uchar a1,a2;
1396          
1397          sbit sel_1=P1^6;
1398          
1399          sbit sel_10=P1^4;
1400          
1401          sbit sel_100=P3^4;
1402          
1403          sbit p3_5=P3^5;
1404          
1405          bit clr_flag0=0;
1406          
1407          bit clr_flag1=0;
1408          
1409          bit clr_flag2=0;
1410          
1411          bit clr_flag3=0;
1412          
1413          bit clr_flag4=0;
1414          
1415          sbit key0=P3^0;
1416          
1417          sbit key1=P3^1;
1418          
1419          //--------------------------------------------------------------------
1420          
1421          void timer_init()
1422          
1423          {
1424   1      
1425   1            TMOD=0xd1; //T1 做门控计数
1426   1      
1427   1            TH1=0;
1428   1      
1429   1            TL1=0;
1430   1      
1431   1            TH0=0x3c;
1432   1      
1433   1            TL0=0xb0;
1434   1      
1435   1            ET0=1;
1436   1      
1437   1            EA=1;
1438   1      
1439   1            TR0=1;
1440   1      
1441   1            TR1=1;
1442   1      
1443   1            p3_5=1;
1444   1      
C51 COMPILER V7.50   MAIN                                                                  08/24/2007 11:21:58 PAGE 27  

1445   1      }
1446          
1447          //--------------------------------------------------------------------
1448          
1449          void time_up() interrupt 1 using 3
1450          
1451          {
1452   1      
1453   1            TH0=0x3c;
1454   1      
1455   1            TL0=0xb0;
1456   1      
1457   1            if(++i==gate)
1458   1      
1459   1            {
1460   2      
1461   2                    TR1=0;
1462   2      
1463   2                    temp_l=TL1;
1464   2      
1465   2                    temp_h=TH1;
1466   2      
1467   2                    TH1=0;
1468   2      
1469   2                    TL1=0;
1470   2      
1471   2                    i=0;
1472   2      
1473   2                    TR1=1;
1474   2      
1475   2            }
1476   1      
1477   1      }
1478          
1479          //--------------------------------------------------------------------
1480          
1481          void sel_x(uchar x) //74HC390 分频系数选择1,10,100
1482          
1483          {
1484   1      
1485   1            switch(x)
1486   1      
1487   1            {
1488   2      
1489   2                    case 1:
1490   2      
1491   2                    {
1492   3      
1493   3                          sel_1=1;
1494   3      
1495   3                          sel_10=0;
1496   3      
1497   3                          sel_100=0;
1498   3      
1499   3                          break;
1500   3      
1501   3                    }
1502   2      
1503   2      
1504   2      
1505   2                    case 10:
1506   2      
C51 COMPILER V7.50   MAIN                                                                  08/24/2007 11:21:58 PAGE 28  

1507   2                    {
1508   3      
1509   3                          sel_1=0;
1510   3      
1511   3                          sel_10=1;
1512   3      
1513   3                          sel_100=0;
1514   3      
1515   3                          break;
1516   3      
1517   3                    }
1518   2      
1519   2      
1520   2      
1521   2                    case 100:
1522   2      
1523   2                    {
1524   3      
1525   3                          sel_1=0;
1526   3      
1527   3                          sel_10=0;
1528   3      
1529   3                          sel_100=1;
1530   3      
1531   3                          break;
1532   3      
1533   3                    }
1534   2      
1535   2                    default:
1536   2      
1537   2                    break;
1538   2      
1539   2            }
1540   1      
1541   1      }
1542          
1543          //--------------------------------------------------------------------
1544          
1545          void temp_to_tempx(uint temp)
1546          
1547          {
1548   1      
1549   1            temp0=temp/10000;
1550   1      
1551   1            temp1=(temp-(temp0*10000))/1000;
1552   1      
1553   1            temp2=(temp-(temp0*10000)-(temp1*1000))/100;
1554   1      
1555   1            temp3=(temp-(temp0*10000)-(temp1*1000)-(temp2*100))/10;
1556   1      
1557   1            temp4=temp%10;
1558   1      
1559   1      }            
1560          
1561          //--------------------------------------------------------------------
1562          
1563          void dis_mod(unsigned long temp,uchar point,uchar danwei)
1564          
1565          {
1566   1      
1567   1            
1568   1      
C51 COMPILER V7.50   MAIN                                                                  08/24/2007 11:21:58 PAGE 29  

1569   1            uchar danwei_t;
1570   1      
1571   1            
1572   1      
1573   1            temp_to_tempx(temp);
1574   1      
1575   1      
1576   1      
1577   1            dis_one_zi(0,0,x7,1,1);//频
1578   1      
1579   1            dis_one_zi(0,1,x8,1,1);//率
1580   1      
1581   1      
1582   1      
1583   1            dis_one_char(0,11,0x7f,0);
1584   1      
1585   1            dis_one_char(0,12,danwei,1);
1586   1      
1587   1            dis_one_char(0,13,'H',1);
1588   1      
1589   1            dis_one_char(0,14,'z',1);
1590   1      
1591   1            dis_one_char(0,15,0x7f,0);
1592   1      
1593   1            dis_one_char(0,4,0x7f,0);
1594   1      
1595   1            if(temp0!=0)
1596   1      
1597   1            {
1598   2      
1599   2                    dis_one_char(0,5,temp0+0x30,1);
1600   2      
1601   2                    clr_flag0=0;
1602   2      
1603   2            }
1604   1      
1605   1            else
1606   1      
1607   1            dis_one_char(0,5,0x7f,0);
1608   1      
1609   1            clr_flag0=1;
1610   1      
1611   1      
1612   1      
1613   1            dis_one_char(0,10,temp4+0x30,1);
1614   1      
1615   1            dis_one_char(0,9,temp3+0x30,1);
1616   1      
1617   1            switch (point)
1618   1      
1619   1            {
1620   2      
1621   2                    
1622   2      
1623   2                    case 0:
1624   2      
1625   2                    {
1626   3      
1627   3                          dis_one_char(0,5,temp0+0x30,1);
1628   3      
1629   3                          dis_one_char(0,6,'.',1);
1630   3      
C51 COMPILER V7.50   MAIN                                                                  08/24/2007 11:21:58 PAGE 30  

1631   3                          dis_one_char(0,7,temp1+0x30,1);
1632   3      
1633   3                          dis_one_char(0,8,temp2+0x30,1);
1634   3      
1635   3                          break;
1636   3      
1637   3                    }
1638   2      
1639   2      
1640   2      
1641   2                    case 1:
1642   2      
1643   2                    {
1644   3      
1645   3                          if(temp1==0 && temp0==0)
1646   3      
1647   3                          dis_one_char(0,5,0x7f,0);
1648   3      
1649   3                          dis_one_char(0,6,temp1+0x30,1);
1650   3      
1651   3                          dis_one_char(0,7,'.',1);
1652   3      
1653   3                          dis_one_char(0,8,temp2+0x30,1);
1654   3      
1655   3                          break;
1656   3      
1657   3                    }
1658   2      
1659   2                    
1660   2      
1661   2                    case 2:
1662   2      
1663   2                    {
1664   3      
1665   3                          dis_one_char(0,6,temp1+0x30,1);
1666   3      
1667   3                          if(temp1==0 && temp0==0)
1668   3      
1669   3                          dis_one_char(0,6,0x7f,0);
1670   3      
1671   3                          dis_one_char(0,7,temp2+0x30,1);
1672   3      
1673   3                          dis_one_char(0,8,'.',1);
1674   3      
1675   3                          break;
1676   3      
1677   3                    }    
1678   2      
1679   2                    default:
1680   2      
1681   2                    break;
1682   2      
1683   2            }
1684   1      
1685   1      //--------------------------------------------------------------------
1686   1      
1687   1            if(danwei=='K' && point==1)
1688   1      
1689   1            {    
1690   2      
1691   2                    temp=1000000/temp;
1692   2      
C51 COMPILER V7.50   MAIN                                                                  08/24/2007 11:21:58 PAGE 31  

1693   2                    temp&=0x0000ffff;
1694   2      
1695   2                    temp_to_tempx(temp);
1696   2      
1697   2                    danwei_t='u';
1698   2      
1699   2            }
1700   1      
1701   1            if(danwei=='K' && point==2)
1702   1      
1703   1            {
1704   2      
1705   2                    temp=100000000/temp;
1706   2      
1707   2                    temp&=0x0000ffff;
1708   2      
1709   2                    temp_to_tempx(temp);
1710   2      
1711   2                    danwei_t='n';
1712   2      
1713   2            }
1714   1      
1715   1            if(danwei=='M' && point==0)
1716   1      
1717   1            {
1718   2      
1719   2                    temp=10000000/temp;
1720   2      
1721   2                    temp&=0x0000ffff;
1722   2      
1723   2    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -