📄 zf1fan01.c
字号:
//---------------------------------------------------------------------------
// define program revision ( Compiler: Borland C++ V3.1 )
// 1. set F360 bit3 = 1 , for disable EC control
// 2. set FF48 to 0xFF = FAN on , 0x00 = FAN off
// 3. set F360 bit3 = 0 , for Enable EC control
//
// 04-29-2004 change EC RAM address .
//---------------------------------------------------------------------------
#define PROGRAM_VER "1.1" // 04292004
#include "DECLARE.H"
#include "MISC.C"
#include "KBC.C"
#include "EC.C"
#define ThermoAddr 0xeb58
#define PollTime 0xeb57
#define FanOnAddr 0xf360
#define FanGpio 0xff48
#define SecFanGpio 0xfd08
#define LidAddr 0xeb4C
#include<stdio.h>
#include<dos.h>
#include<mem.h>
#include<string.h>
void icon_display(int);
union REGS mr;
int far *wp;
//---------------------------------------------------------------------------
// MAIN routine
//---------------------------------------------------------------------------
void main(int argc , char * argv[])
{
int x,y,x1,y1,i,f,k;
char ch,item;
BYTE wRegDataw , RegAdr, wRegData ;
unsigned char d1,d2,key;
unsigned int temp_word;
f=atoi(argv[1]);
printf("\n[ZF1FAN01.EXE] Program Version : %s",PROGRAM_VER); // show program version
printf("\n 1: Fan On 2:Fan Off 3:Exit\n");
x=wherex(); // get x axies
y=wherey(); // get y axies
if (argc < 2 )
{
while(1)
{
temp_word=read_MCU_register(FanOnAddr);
temp_word = (temp_word | 0x0008) ; // bit3=1
write_MCU_register(FanOnAddr, temp_word);
// printf(" key temp_word = %Xh \n",temp_word);
key=getch();
if(key=='1')
{
write_MCU_register(FanGpio,0xff);
gotoxy(x,y);
printf("Fan Status On ");
icon_display(0x20);
bioskey(1);
delay(200);
icon_display(0x40);
bioskey(1);
delay(200);
icon_display(0x20);
bioskey(1);
delay(200);
icon_display(0x40);
}
if(key=='2')
{
write_MCU_register(FanGpio,0x00);
gotoxy(x,y);
printf("Fan Status Off ");
}
if(key=='3') break;
} // end of while(1)
printf("\n");
}
else
{
temp_word=read_MCU_register(FanOnAddr);
temp_word = (temp_word | 0x0008) ;
write_MCU_register(FanOnAddr, temp_word);
// printf(" sel temp_word = %Xh \n",temp_word);
if(f==1)
{
write_MCU_register(FanGpio,0xff);
gotoxy(x,y);
printf("Fan Status On ");
}
if(f==2)
{
write_MCU_register(FanGpio,0x00);
gotoxy(x,y);
printf("Fan Status Off ");
}
}
temp_word=read_MCU_register(FanOnAddr);
temp_word = (temp_word & 0xFFF7) ;
write_MCU_register(FanOnAddr, temp_word);
// printf(" temp_word = %Xh \n",temp_word);
exit(0);
}
/**************************************************
* The Display Icon *
**************************************************/
void icon_display(int show_byte)
{
unsigned char *endptr;
unsigned char *old_value_c;
unsigned int old_value_h,new_value_h;
poke(0x0040,0x0017,0);
old_value_c=peek(0x0040,0x0017);
delay(100);
old_value_h=strtoul(old_value_c,&endptr,16);
new_value_h=((old_value_h&0x8f)|show_byte);
poke(0x0040,0x0017,new_value_h);
return ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -