Little Stumped on a Stepper motor signal

I am working with a MEGA and my Apple //C to build a little SD card interface for the floppy drive port, the disk drive on most of these machines are pretty dumb, with only bare minimum logic inside the drive. In order to change tracks 4, 5 volt signals are used signaling phases going to the stepper motor thus moving the drives head in and out across the medium.

What I need to do is read these signals with the arduino so it knows what track the head is on. Its going to be very similar to a quadrature rotary encoder, just with twice as many signals, but I wanted to get advice from the peanut gallery of how to best do this before banging my head on the desk.

Let me show you whats going on... if the disk drive head is at track zero, and I advance it to track one, phase 1 fires, then phase 2 fires

To go from track one to track two, phase 3 fires, then phase 0 fires

Going backwards is as expected, going from track two to track one, its phase 3 then phase 2

and from track one to track zero its, phase 1, phase 0

Seems simple right? I think so, but I am just having a mental block about how to keep track of what track I am on in a quick and efficient manner, especially when you see something like jumping from track 0 to track 34

so any advice would be appreciated, and Thank you.

I must admit my mind blanked out a bit looking at that.

You are receiving these signals, or sending them? If receiving, does the disk drive do its own thing?

Apple //C huh? Is this some sort of project for a museum?

All I can suggest at this time of day is: state machine.

I've solve this in three steps:

Detect when a phase fires. Poll the state of each phase and compare with the previous state to detect changes. When it changes from LOW to HIGH the phase has fired. Since you have a different input for each phase, you also know the phase number (0 .. 3) of the phase which is firing. Time will tell whether you need to do any sort of conditioning or debounce processing.

When a phase fires, compare the number of the firing phase with the number of the previous firing phase to determine the direction of movement. Be careful to code this so that it handles the wraparound cases (3+1=0, 0-1=3).

Increment or decrement the motor position.

I am receiving them, and yea the disk drive does its thing, these signals are hooked up to basically transistors to jump them up to 12v needed by the motor

and sort of a museum, I like me old computers and getting too many of them

@ PeterH

Yea thats about all I could think of at the moment, didnt know if there was maybe a better way, though its better knowing I wasnt completely off

Osgeld:
my Apple //C

Didn't know they still made electricity for those 8)