Mega Code Archive

 
Categories / C / Hardware Interaction
 

Program to implement Specify command

#include<conio.h> #include<stdio.h> #include<dos.h> void main() { int x; int result; clrscr(); // Step 1Put on the motor outp(0x3f2,28);//Address of digital control port 0x3f2 //Step 2 Check whether the FDC is ready result=inp(0x3f4); //Read the status of MSR result=(result&128); if(result==128)//Check whether FDC is ready { //Beginning of command phase //Step 3 Input the command parameters outp(0x3f5,3);//Enter command parameters delay(200); outp(0x3f5,204); //Enter SRT(2-32 step of 2) HUT(4-512 in step of4) delay(300); outp(0x3f5,25);//Enter the HUT and NDM delay(300); } delay(1000); result=inp(0x3f5); printf("The value od data register is %d",result); getch(); //Put off the motor outp(0x3f2,0); }