原创 keilC51汉字0xfd出错测试程序

2006-12-30 01:50 6702 9 9 分类: MCU/ 嵌入式


汉字0xfd出错测试程序
mood25.gif hotpower 发表于 2004-11-14 21:59 侃单片机 ←返回版面 按此察看该网友的资料 按此把文章加入收藏夹 按此编辑本帖举报该贴


/*-----------------------------------------------------
    汉字0xfd出错测试程序(keil C51 V7.50测试)

HotPower@126.com         2004。11。14
------------------------------------------------------*/

#include
#include

code unsigned char strs[] = "汉字0xfd出错测试程序";
code unsigned char *str[16] = {
   {"\x00\xfd\x01\xfd\x02\xfd\x03\xfd\x04\xfd\x05\xfd\x06\xfd\x07\xfd\x08\xfd\x09\xfd\x0a\xfd\x0b\xfd\x0c\xfd\x0d\xfd\x0e\xfd\x0f\xfd"},
   {"\x10\xfd\x11\xfd\x12\xfd\x13\xfd\x14\xfd\x15\xfd\x16\xfd\x17\xfd\x18\xfd\x19\xfd\x1a\xfd\x1b\xfd\x1c\xfd\x1d\xfd\x1e\xfd\x1f\xfd"},
   {"\x20\xfd\x21\xfd\x22\xfd\x23\xfd\x24\xfd\x25\xfd\x26\xfd\x27\xfd\x28\xfd\x29\xfd\x2a\xfd\x2b\xfd\x2c\xfd\x2d\xfd\x2e\xfd\x2f\xfd"},
   {"\x30\xfd\x31\xfd\x32\xfd\x33\xfd\x34\xfd\x35\xfd\x36\xfd\x37\xfd\x38\xfd\x39\xfd\x3a\xfd\x3b\xfd\x3c\xfd\x3d\xfd\x3e\xfd\x3f\xfd"},
   {"\x40\xfd\x41\xfd\x42\xfd\x43\xfd\x44\xfd\x45\xfd\x46\xfd\x47\xfd\x48\xfd\x49\xfd\x4a\xfd\x4b\xfd\x4c\xfd\x4d\xfd\x4e\xfd\x4f\xfd"},
   {"\x50\xfd\x51\xfd\x52\xfd\x53\xfd\x54\xfd\x55\xfd\x56\xfd\x57\xfd\x58\xfd\x59\xfd\x5a\xfd\x5b\xfd\x5c\xfd\x5d\xfd\x5e\xfd\x5f\xfd"},
   {"\x60\xfd\x61\xfd\x62\xfd\x63\xfd\x64\xfd\x65\xfd\x66\xfd\x67\xfd\x68\xfd\x69\xfd\x6a\xfd\x6b\xfd\x6c\xfd\x6d\xfd\x6e\xfd\x6f\xfd"},
   {"\x70\xfd\x71\xfd\x72\xfd\x73\xfd\x74\xfd\x75\xfd\x76\xfd\x77\xfd\x78\xfd\x79\xfd\x7a\xfd\x7b\xfd\x7c\xfd\x7d\xfd\x7e\xfd\x7f\xfd"},
   {"\x80\xfd\x81\xfd\x82\xfd\x83\xfd\x84\xfd\x85\xfd\x86\xfd\x87\xfd\x88\xfd\x89\xfd\x8a\xfd\x8b\xfd\x8c\xfd\x8d\xfd\x8e\xfd\x8f\xfd"},
   {"\x90\xfd\x91\xfd\x92\xfd\x93\xfd\x94\xfd\x95\xfd\x96\xfd\x97\xfd\x98\xfd\x99\xfd\x9a\xfd\x9b\xfd\x9c\xfd\x9d\xfd\x9e\xfd\x9f\xfd"},
   {"\xa0\xfd\xa1\xfd\xa2\xfd\xa3\xfd\xa4\xfd\xa5\xfd\xa6\xfd\xa7\xfd\xa8\xfd\xa9\xfd\xaa\xfd\xab\xfd\xac\xfd\xad\xfd\xae\xfd\xaf\xfd"},
   {"褒饼昌除待谍洱俘庚过糊积箭烬君魁"},
   {"例笼慢谬凝琵讫驱三升数她听妄锡淆"},
   {"旋妖引育札正铸\xd7\xfd\xd8\xfd\xd9\xfd\xda\xfd\xdb\xfd\xdc\xfd\xdd\xfd\xde\xfd\xdf\xfd"},
   {"\xe0\xfd\xe1\xfd\xe2\xfd\xe3\xfd\xe4\xfd\xe5\xfd\xe6\xfd\xe7\xfd\xe8\xfd\xe9\xfd\xea\xfd\xeb\xfd\xec\xfd\xed\xfd\xee\xfd\xef\xfd"},
   {"\xf0\xfd\xf1\xfd\xf2\xfd\xf3\xfd\xf4\xfd\xf5\xfd\xf6\xfd\xf7\xfd\xf8\xfd\xf9\xfd\xfa\xfd\xfb\xfd\xfc\xfd\xfd\xfd\xfe\xfd\xff\xfd"}
};
void main(void)
{
unsigned char i, j;
unsigned char *s, err = 0;
  SCON = 0x52;
  TMOD = 0x20;
  TH1  = 0xf3;
  TR1  = 1;
  if ((strs[0] == 0xba) && (strs[1] == 0xba)) {//"汉"
    printf("\n'汉'通过!!!");
  }
  else printf("\n'汉'出错!!!");
  if ((strs[2] == 0xd7) && (strs[3] == 0xd6)) {//"字"
    printf("\n'字'通过!!!");
  }
  else printf("\n'字'出错!!!");
  for (i = 0; i < 16; i ++) {
    s = str;
    for (j = 0; j < 16; j ++) {
      if ((*s != (i * 16 + j)) || (*(s + 1) != 0xfd))
        err ++;//V7.50有48个FD汉字出错!!!
      s += 2;
    }
  }
  if (err) printf("\n0xFD汉字出错!!!");//V7.50有48个FD汉字出错!!!
  else {
    for (i = 0; i < 16; i ++) {
      printf("\n");
      s = str;
      for (j = 0; j < 16; j ++) {
        printf("%c%c", *s, *(s + 1));      
        s += 2;
      }
    }
  }
  while(1);
}
PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
9
关闭 站长推荐上一条 /3 下一条