51单片机控制硬盘的C语言源码程序
void main(void)
{
//Initialize
SCON=0x50;
TMOD=0x20;
TCON=0x40;
PCON=0x80;
TH1=0xFf;
TL1=0xFf;
TR1=1;
send_string("IDE Control Demo.
Rst=0; //IDE 复位
delay(50);
Rst=1;
delay(255);
send_string("Reset Driver OK...x0dx0a");
Init();
send_string("Initialize Driver OK,Now Read IDx0dx0a");
send_string("HardDisk ID is ....x0dx0a");
DriverID();
send_string("Now Read The First Sector On this HardDiskx0dx0ax0dx0a");
delay(244);
delay(244);
delay(244);
delay(244);
WriteCHS(0,0,1,16); //写地址
WaitBSY();
WriteReg(_Status_Command,0x20);
SendData();
send_string("x0dx0ax0dx0a Read OK,Now Shut Down The HardDisk..x0dx0a");
SpinDown();
while(1);
}
//////////////////////////////////////////////////////////////////////////////串口子程序
void send_char(unsigned char word)
{
TI=0;
SBUF=word;
while(TI==0);
TI=0;
}
void send_string(unsigned char //word)
{
TI=0;
while(//word!=0)
}
unsigned char get_char(void)
{
RI=0;
REN=1;
while(RI==0);
return(SBUF);
RI=0;
REN=0;
}
51单片机控制硬盘C语言源 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)