मुझे एक 3.5 "फ्लॉपी डिस्क ड्राइव को एक Arduino Uno के साथ नियंत्रित करने में समस्या हो रही है।
मेरे पास फ़्लॉपी डिस्क ड्राइव है जो एक कंप्यूटर बिजली की आपूर्ति के साथ संचालित है और मेरे कंप्यूटर के यूएसबी द्वारा संचालित Arduino है। मैंने अपने Arduino में पिन को रूट करने में सक्षम होने के लिए 34-पिन आईडीसी कनेक्टर के रिबन को काट दिया है। मैं फ्लॉपी डिस्क मोटर को चालू करने और रीड / राइट हेड को आगे-पीछे करने में सक्षम हूं, लेकिन मैं ट्रैक -1 या इंडेक्स पिन से किसी भी दालों को पढ़ने में सक्षम नहीं हूं।
मेरे पास मेरे Arduino पर आने वाले फ्लॉपी से 7, 15, 17, 19, और 25 पिन हैं, और मेरे पास 8, 16, 18, 20, और 26 पिन हैं जो कि मेरे arduino से जुड़े फ्लॉपी से आउटपुट पिन के रूप में हैं ताकि मैं नियंत्रित कर सकूं चलाना।
जब डिस्क मोटर एक रोटेशन बनाता है, और ट्रैक 0 के लिए जब मैं डिस्क के बाहर हूं, तब बदलने के लिए मैं इंडेक्स को पल्स करने की उम्मीद कर रहा हूं, लेकिन वे दोनों हमेशा कम हैं। क्या मैं कुछ भूल रहा हूँ?
यहाँ वह युक्ति है जो मुझे फ्लॉपी डिस्क इकाई के पीछे मिली थी
2 /REDWC Input Density Select
4 n/c N/A Reserved
6 n/c N/A Reserved
8 /INDEX Output Index
10 /MOTEA Input Motor Enable A
12 /DRVSB Input Drive Sel B
14 /DRVSA Input Drive Sel A
16 /MOTEB Input Motor Enable B
18 /DIR Input Direction
20 /STEP Input Step
22 /WDATE Input Write Data
24 /WGATE Input Floppy Write Enable
26 /TRK00 Output Track 0
28 /WPT Output Write Protect
30 /RDATA Output Read Data
32 /SIDE1 Input Head Select
34 /DSKCHG Output Disk Change/Ready
यहां मैंने जो कुछ भी लिखा है उसका एक योजनाबद्ध (इस सर्किट आरेख में ब्रेडबोर्ड IDC कनेक्टर का प्रतिनिधित्व करता है जिसे 3.5 "फ्लॉपी ड्राइव में प्लग किया गया है।"
यहां IDC कनेक्टर की एक तस्वीर है और मैंने लेबल किया है कि कौन से तार Arduino से जुड़े हैं।
यह कोड मैं चला रहा हूं।
//constants
static const int IN = LOW;
static const int OUT = HIGH;
static const int pulseDelayTime = 6;
//pins
int indexPin = 2; //8 on the drive INDEX
int track0Pin = 3; //26 on the drive. TRACK 0
int dirPin = 6; //18 on the drive. DIRECTION
int stepPin = 7; //20 on the drive. STEP
int motorEnableBPin = 9; //16 on the drive. MOTOR ENABLE B
unsigned long motorSpinTime = 1000UL; //in ms
void setup() {
//initial delay
delay(3000);
//setup serial monitor
Serial.begin(9600);
//setup pins.
pinMode(dirPin, OUTPUT);
pinMode(stepPin, OUTPUT);
pinMode(motorEnableBPin, OUTPUT);
pinMode(indexPin, INPUT);
pinMode(track0Pin, INPUT);
//turn the motor off initially
digitalWrite(motorEnableBPin, HIGH);
//print state here.
printState("Setup done.");
//spin the disk some.
printState("Begin to spin motor");
spinMotorForThisManyMs(motorSpinTime);
spinMotorForThisManyMs(motorSpinTime);
printState("Done spinning motor");
//step read/write head all the way in.
stepAllTheWayIn();
//spin the disk some more.
printState("Begin to spin motor");
spinMotorForThisManyMs(motorSpinTime);
spinMotorForThisManyMs(motorSpinTime);
printState("Done spinning motor");
//step read/write head all the way out.
stepAllTheWayOut();
//spin the disk even more.
printState("Begin to spin motor");
spinMotorForThisManyMs(motorSpinTime);
spinMotorForThisManyMs(motorSpinTime);
printState("Done spinning motor");
//never completes.
waitForIndex();
}
void loop() {
}
//spins the disk motor for a number of ms and prints the state
void spinMotorForThisManyMs(unsigned long msToSpin) {
//start spinning
digitalWrite(motorEnableBPin,LOW);
//delay.. keep printing the state
unsigned long maxTimeMs = millis() + msToSpin;
while(millis() < maxTimeMs ) {
printState("Spinning");
}
//stop spinning
digitalWrite(motorEnableBPin,HIGH);
}
//step the read/write head all the way to the center
void stepAllTheWayIn() {
for(int i=0;i<100;i++) {
printState("Stepping In");
stepInALittle();
}
}
//step the read/write head all the way to the outside
void stepAllTheWayOut() {
for(int i=0;i<100;i++) {
printState("Stepping Out");
stepOutALittle();
}
}
//print the state of the index and track
void printState(const char* charPrint) {
Serial.print(" Index:");
Serial.print(digitalRead(indexPin));
Serial.print(" Track:");
Serial.print(digitalRead(track0Pin));
Serial.print(" ");
Serial.println(charPrint);
}
//move the head towards the outside a little
void stepOutALittle() {
digitalWrite(dirPin,HIGH);
stepPulse();
}
//move the head towards the center a little
void stepInALittle() {
digitalWrite(dirPin,LOW);
stepPulse();
}
//pulse the step pin
void stepPulse() {
digitalWrite(stepPin,LOW);
delay(pulseDelayTime);
digitalWrite(stepPin,HIGH);
}
//waits for the index to trigger. this never gets completed.
void waitForIndex() {
printState("beginning to wait for index pin to pulse");
//start spinning
digitalWrite(motorEnableBPin,LOW);
//wait for pulse
while(digitalRead(indexPin));
//wait for end of pulse 0
while(!digitalRead(indexPin));
printState("end of waiting for index pin to pulse");
//stop spinning
digitalWrite(motorEnableBPin,HIGH);
}
यहाँ उत्पादन मुझे मिल रहा है।
Index:0 Track:0 Setup done.
Index:0 Track:0 Begin to spin motor
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Done spinning motor
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Stepping In
Index:0 Track:0 Begin to spin motor
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Done spinning motor
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Stepping Out
Index:0 Track:0 Begin to spin motor
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Spinning
Index:0 Track:0 Done spinning motor
Index:0 Track:0 beginning to wait for index pin to pulse
अद्यतन: अब मैं ज्यामितीय उत्तर के कारण अपने अपेक्षित परिणाम प्राप्त कर रहा हूं। इस समस्या पर शोध करते हुए मुझे फ्लॉपी ड्राइव के लिए Arduino के कुछ कोड उदाहरण मिले। मैंने देखा कि वे अपने इनपुट पिन को हाई पर सेट कर रहे थे, लेकिन मुझे कभी भी एहसास नहीं हुआ कि वे ऐसा क्यों कर रहे हैं। मेरी समस्या को हल करने के बाद, मैंने कुछ Arduino प्रलेखन में पाया (जिससे मुझे कोड उदाहरणों का एहसास हुआ जो मैं Arduino IDE के पुराने संस्करण का उपयोग कर रहा था):
"आर्डुइनो 1.0.1 से पहले, निम्नलिखित तरीके से आंतरिक पुल-अप को कॉन्फ़िगर करना संभव था:"
pinMode(pin, INPUT); // set pin to input
digitalWrite(pin, HIGH); // turn on pullup resistors`
Arduino 1.0.1+ में आप इसे इस तरह से कर सकते हैं।
pinMode(pin, INPUT_PULLUP);