標題: 求助~用c52單片機做的電子器件測試儀 為什么仿真不行呢 [打印本頁]

作者: 左鴻健    時間: 2014-5-2 14:56
標題: 求助~用c52單片機做的電子器件測試儀 為什么仿真不行呢
#include<at89c52.h>
#include"RLCTest.h"
union count
{  
struct clockTwo
{
unsigned char clockH;
unsigned char clockL;
}clockTwo;  
unsigned int clock;
}count;   //定義頻率字  
unsigned char code disdata[16]={0xc0,0xf9,0xa4,0xb0,0x99,
0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};  unsigned char data dismem[8];
//定義LED顯示頻段  
-----------------------------------------
系統初始化
void init(void)
{      
     stateR=0;testR=1;  
         stateC=1;testC=0;  
         stateL=1;testL=0;  
         largeR=1;smallR=0;  
         largeC=1;smallC=0;  
}  
void delay4us(unsigned int time)
{  
while(--time);
}  
void delay2us(unsigned char time)  
{
while(--time);  
}  
void inittime(void)  
{   
TMOD=0x15;//C/T 0 為計數器,用于頻率計數。C/T 1 為定時器。用于動態(tài)顯示
TH1=0xF8;//timer1=2ms   
   TL1=0x2f;   
   ET1=1;   
   EA=1;   
   TR1=1;   
   TR0=1;   
   ET0=1;   
   ///timer 2   
   T2CON=0x04;   
   T2MOD=0x00;   
   TH2=0x3C;   
   TL2=0xB0;   
   RCAP2H=0x3C;  
   RCAP2L=0xB0;   
   TR2=1;   
   ET2=1;      

   }
這是程序   


作者: 左鴻健    時間: 2014-5-2 14:57
運行仿真  說是   timestep too  small ;timestep=      .....
作者: liumei    時間: 2014-5-2 15:11
時間步長太小,把timestep設大一點
作者: 左鴻健    時間: 2014-5-2 16:01
liumei 發(fā)表于 2014-5-2 15:11
時間步長太小,把timestep設大一點

能具體說一下怎么調嗎  。。。
作者: plandy    時間: 2014-5-2 19:00
應該是你調用延時函數沒有給參數,你檢查一下main()函數吧,這部分好像沒有問題。
作者: sz1001    時間: 2014-7-18 14:20
學習了~~




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1