下面程式码我是用TC写的,demo后发生RS232无法传数据,而且键盘跟滑鼠整个当机,请各位大大帮帮忙,谢谢!
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
/* port characteristic definitions for use with rs_initport */
#define base 0x3f8 /* Port Address Goes Here */
#define THR base+0
#define RBR base+0
#define DLL base+0
#define DLM base+1
#define IER base+1
#define IIR base+2
#define FCR base+2
#define LCR base+3
#define MCR base+4
#define LSR base+5
#define MSR base+6
#define IRQ 0x1c
#define base_812 0x220
/*****************************************************************/
/*** global variables ***/
/*****************************************************************/
/* static variables */
int flag = 0, indx = 0;
int cnt = 0, freq;
float read_volt1=0;
double ad812;
unsigned char data;
/* dynamic variables */
float read_AD_volt(unsigned int chan)
{
unsigned char hibyte,lowbyte;
outportb(base_812+10,chan);
outportb(base_812+9,0);
outportb(base_812+12,1);
while(1) {
hibyte=inportb(base_812+5);
if ( (hibyte&0x10) == 0 )
break;
}
hibyte=inportb(base_812+5);
lowbyte=inportb(base_812+4);
return(((hibyte%16)*256+lowbyte)-2048)/4096.0*20;
}
void PC_tickset(int freq)
{
int cn;
if (freq == 18) {
cn = 0;
}
else if (freq > 0){
cn=(int)(((long)2386360L/freq+1) >> 1);
}
else{
cn=0;
}
outp(0x43,0x36);
outp(0x40,cn & 0xFF);
outp(0x40,(cn >> ..
访客只能看到部份内容,免费 加入会员 或由脸书 Google 可以看到全部内容