?? 共 8 個源碼文件 點擊文件名可在線查看源代碼
?? 資源詳細信息
?? 溫馨提示:本資源由用戶 hufei108 上傳分享,僅供學習交流使用。如有侵權,請聯系我們刪除。
資源簡介
微型打印機的C語言源程序:
微型打印機的C51源程序
#define uchar unsigned char
#define uint unsigned int
#include <reg52.h>
#include <stdio.h>
#include <absacc.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#define PIN XBYTE[0x8000]
#define POUT XBYTE[0x9000]
sbit PRINTSTB =P1^6;
sbit DOG=P1^7;
bdata char pin&#118alue;
sbit PRINTBUSY=pin&#118alue^7;
sbit PRINTSEL =pin&#118alue^6;
sbit PRINTERR =pin&#118alue^5;
sbit PRINTACK =pin&#118alue^4;
void PrintString(uchar *String1,uchar *String2);
void initprint(void);
void print(uchar a);
void initprint(void) //打印機初始化子程序
{
pin&#118alue=PIN;
if((PRINTSEL==1)&&(PRINTERR==1))
{
print(0x1b); print(0x40); print(0x1b); print(0x38); print(0x4);
}
}
void print(uchar a) //打印字符a
{
pin&#118alue=PIN;
if((PRINTSEL==0)||(PRINTERR==0)) return;
for(;;) {
DOG=~DOG;
pin&#118alue=PIN;
if(PRINTBUSY==0) break;
}
DOG=~DOG;
POUT=a;
PRINTSTB=1; PRINTSTB=1; PRINTSTB=1; PRINTSTB=1;
PRINTSTB=0; PRINTSTB=0; PRINTSTB=0; PRINTSTB=0;
PRINTSTB=1;
}
void PrintString(uchar *String) //打印字符串后回車
{
uchar CH;
for (;;) {
DOG=~DOG;
CH=*String;
if (CH==0) { print(0x0d); break; }
print(CH);
String++;
}
initprint();
}
源碼文件列表
立即下載此資源
資源說明
下載說明
- 下載需消耗 2積分
- 24小時內重復下載不扣分
- 支持斷點續傳
- 資源永久有效
使用說明
- 下載后用解壓軟件解壓
- 推薦 WinRAR 或 7-Zip
- 如有密碼請查看說明
- 解壓后即可使用
積分獲取
- 上傳資源獲得積分
- 每日簽到免費領取
- 邀請好友注冊獎勵
- 查看詳情 →