Programming 版 (精华区)
发信人: Mice (鼠儿), 信区: Programming
标 题: DOS下的串口通信编程----(4)
发信站: 紫丁香 (Mon Sep 15 16:00:59 1997)
//plc.h
#if !defined _PLC_H
#define _PLC_H
#include "serial.h"
#define ENQ 5
#define STX 2
#define EOT 4
#define ACK 6
#define NAK 21
#define READOK 1
#define READERR 0
#define MAXBUF (0xff*2+5)
#define READOK 1
#define READERR 0
#define MAXBUF (0xff*2+5)
class PLC:private ComPort {
private:
void NumHex(unsigned char *buf,unsigned char num);
public:
PLC(int port):ComPort(port){
frame(DATABIT8|NONEPAR|STOPBIT1);
baudReg(BAUD9600);
}
unsigned char* read(char *str);
void write(char *format,char *data);
unsigned error(){return errcode;};
};
#endif
--
我是一只好老鼠
※ 来源:.紫丁香 pclinux.hit.edu.cn.[FROM: 202.118.226.74]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.374毫秒