C Codes
Beginners
C on Unix
Code Snippets
Data Structures
File Operations
Games Graphics
Gnu-Linux
Hardware
Mathematics
Miscellaneous
Small Programs
Sorting
C > Hardware Interaction Through C sample source codes
Program To Implement Sense Drive Command
Program To Implement Sense Drive Command #include<conio.h> #include<stdio.h> #include<dos.h> void main() { int x; int show; clrscr(); // Put on the motor outp(0x3f2,28);//Address of digital control port 0x3f2 // Check whether the FDC is ready show=inp(0x3f4); //Read the status of MSR show=(show&128); if(show==128)//Check whether FDC is ready { //Beginning of command phase // Input the command parameters outp(0x3f5,4);//Enter command parameters delay(200); outp(0x3f5,0); //Enter Head no and Drive no. delay(300); } delay(1000); show=inp(0x3f4); show=show&192;//Check whether it is in show phase if(show==192) { show=inp(0x3f5);//Read the status of printf("The registers are %d",show); } getch(); //Put off the motor outp(0x3f2,0); }
Privacy Policy
|
Link to Us
|
Links