增加写功能:

#include <AT89X51.H>
#include <stdio.h>
#ifdef MONITOR51       /* Debugging with Monitor-51 needs   */
char code reserve [3] _at_ 0×23;   /* space for serial interrupt if   */
#endif          /* Stop Exection with Serial Intr.   */
sbit L1=P1^0;
void delay02s(void)      //延时0.2秒子程序
&leftsign;
  unsigned char i,j,k,l;
  for(l=100;l>0;l–)
   for(i=20;i>0;i–)
   for(j=20;j>0;j–) [hide]
     for(k=248;k>0;k–);
&rightsign; [/hide]
void main(void)
&leftsign;
 int u;
#ifndef MONITOR51
 SCON  = 0×50;    /* SCON: mode 1, 8-bit UART, enable rcvr   */
 TMOD &line;= 0×20;    /* TMOD: timer 1, mode 2, 8-bit reload    */
 TH1   = 221;    /* TH1:  reload value for 1200 baud @ 16MHz   */
 TR1   = 1;     /* TR1:  timer 1 run        */
 TI   = 1;     /* TI:  set TI to send first char of UART   */
#endif PRINTF必须
 printf ("Hello World\\n");
  while(1)
 &leftsign;
   L1=0;
   printf("0xff p2 %02x\\n",P2);
 delay02s();
   L1=1; www.yippeesoft.com
 printf("0xff p2 %02x\\n",P2);
    delay02s();
 &rightsign;
&rightsign;

void Watchp10()
&leftsign;
 DWORD   cSBUF, pSBUF;

 Agsi.ReadSFR(0×90, &cSBUF,  &pSBUF,  0xFF);
 dd=~dd;www.yippeesoft.com
 Agsi.WriteSFR(0xA0,dd,0xff);www.yippeesoft.com
 CString str;
 DWORD d=GetTickCount();
 str.Format("%d,%x\\r\\n",d,pSBUF);
 TRACE(str);
&rightsign;

很简单的代码,往P2写0X00或者0XFF,然后uVision C51打印结果。

21740411,ff
21745027,fe
21748793,ff
21752748,fewww.yippeesoft.com
21756233,ff

HELLO WORLD

0XFF P2 FF00

0XFF P2 00

历史博文

标签:, , , , ,
七月 20, 2005 at 1:53 下午 by yippee 1,054 次
Category: Dev
Tags: , , , , ,