Here’s a current version of the code. I cleaned up my code tonight, added a bunch of comments, and tried to explain and document what I’m doing and the logic behind it.
The current code is so much better than older versions, the time spent in the ISR is tiny in comparison to what it used to be. I think I’m roughly under 600ns — which I’m happy about. I’m too tired to fire up the scope and double check this value, but I’m almost positive its 580ns or something.
The main gain in terms of processing speeds comes from the fact that I’m not messing with any ugly bit-shifters. I simply detect either the pin change or a rollover condition, and immediately write this bit to the FRAM.
I have separate code that xfers the FRAM contents to the PC via USB, which I’ll put up if there’s interest. It’s easy enough and uses the same SENDFRAM and RECVFRAM routines that I wrote that are used in the main program. I want to eventually integrate this separate xfer code into the main program, but this will involve two different modes, ie a “receive from floppy drive” mode and a “transfer to PC” mode. I say two different modes because each uses the ISR for something different. I use the ISR to xfer stuff to the PC to make sure I’m respecting the ASYNC baud rate requirements…..
I’m also using some terminal software ala hyperterminal to store the raw mfm data into a file to be processed by the PC software. I should be able to integrate this read right into the processing software. It just needs to grab bytes and throw them into an array.
comments are welcome.