伊莉討論區
標題:
關於Keil uVision 4 程式合併
[打印本頁]
作者:
rof142742
時間:
2014-2-3 02:07 PM
標題:
關於Keil uVision 4 程式合併
#include <reg51.h>
#define row P2
#define col P1
#define repeat 20
unsigned char code table [][8] =
{ {0x00,0x00,0x00,0x00,0x10,0x38,0x7c,0xfe},//1
{0x00,0x00,0x00,0x10,0x10,0x38,0x7c,0xfc},//2
{0x00,0x00,0x10,0x10,0x10,0x38,0x7c,0x7c},//3
{0x00,0x10,0x10,0x10,0x10,0x38,0x7c,0x78},//4
{0x10,0x10,0x10,0x10,0x10,0x38,0x7c,0x38},//5
{0x18,0x10,0x10,0x10,0x10,0x38,0x7c,0x30},//6
{0x38,0x10,0x10,0x10,0x10,0x38,0x7c,0x10},//7
{0x3c,0x10,0x10,0x10,0x10,0x38,0x7c,0x00},//8
{0x7c,0x10,0x10,0x10,0x10,0x38,0x78,0x00},//9
{0x7e,0x10,0x10,0x10,0x10,0x38,0x38,0x00},//10
{0xfe,0x10,0x10,0x10,0x10,0x38,0x30,0x00},//11
{0xfe,0x18,0x10,0x10,0x10,0x38,0x10,0x00},//12
{0xfe,0x38,0x10,0x10,0x10,0x38,0x00,0x00},//13
{0xfe,0x3c,0x10,0x10,0x10,0x30,0x00,0x00},//14
{0xfe,0x7c,0x10,0x10,0x10,0x10,0x00,0x00},//15
{0xfe,0x7c,0x18,0x10,0x10,0x00,0x00,0x00},//16
{0xfe,0x7c,0x38,0x10,0x00,0x00,0x00,0x00} //17
};
void delay1ms (int) ;
main()
{ unsigned char i,j,k,scan ;
while (1)
for (i=0;i<17;i++)
for (k=0;k<repeat;k++)
{ scan=1;
for (j=0;j<8;j++)
{ row=0x00;
col=scan;
row=table [i][j];
delay1ms(2);
scan<<=1;
}
}
}
void delay1ms (int x )
{ int i,j;
for (i=0;i<x;i++)
for ( j=0;j<120;j++) ;
}
以下是第二個程式
#include <reg51.h>
#define seg P0
#define scanp P3
#define count_M1 50000
#define TH_M1 (65636-count_M1)/256
#define TL_M1 (65636-count_M1)%256
int count_T0=0;
#define count_M2 250
#define TH_M2 (256-count_M2)
#define TL_M2 (256-count_M2)
char count_T1=0;
char code tab [10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x83,0xf8,0x80,0x98};
char disp [2]={0xc0,0xc0};
char seconds=0;
char scan=0;
main()
{ IE=0x8a;
TMOD=0x21;
TH0=TH_M1;TL0=TL_M1;
TR0=1;
TH1=TH_M2;TL1=TL_M2;
TR1=1;
while(1);
}
void T0_1s(void)interrupt 1
{ TH0=TH_M1;TL0=TL_M1;
if(++count_T0==20)
{ count_T0=0;
seconds++;
if(seconds==60)
{ seconds=0;
}
}
disp[1]=tab[seconds/10];
disp[0]=tab[seconds%10];
}
void T1_8ms(void)interrupt 3
{ if(++count_T1==32)
{ count_T1=0;
if(++scan==3)scan=1;
seg=0xff;
scanp=scan;
seg=disp[scan-1];
}
}
請問要如何合併這兩個程式呢 ? @@
跪求各位大大解釋
作者:
if8051
時間:
2014-2-3 02:59 PM
提示:
作者被禁止或刪除 內容自動屏蔽
作者:
mdlin
時間:
2014-2-6 10:43 PM
c語言中只有一個main,也就是running開始的地方! 合併起來並不困難,版主可能初學沒多久........
歡迎光臨 伊莉討論區 (http://www67.eyny.com/)
Powered by Discuz!