Update: a practical implementation of this is done in the Tapuino project made by Peter Edwards. Check it out, everything is open sourced: https://github.com/sweetlilmre/tapuino
I'm working on a project where i'm using my Arduino to stream TAP tape data files from my PC to the C64. The software side of the project is going well however i'm still new to electronics and i don't like to fry my Commodore. So i need hardware interfacing help actually.
C64 tapes uses PWM modulation to store program on cassette tape and on reading back the data an opamp + schmitt trigger converts the audio signal into square waves. Every high-low transition triggers an interrupt in the machine and the distance between two interrupts (which is the length of the pulse) represent an atomic part of the stream.
The cassette port's pinout looks like this (the top and the bottom side has the same pins twice):
A-1, GND, Ground
B-2, +5V, 5 Volt DC
C-3, MOTOR, Motor Control, approx. 6 Volt power supply of the motor
D-4, READ, Data Input, read data from datasette
E-5, WRITE, Data Output, write data to datasette
F-6, SENSE, Detection, if one of the keys PLAY, RECORD, F.FWD or REW is pressed
My current idea is the following:
Based on the C64 Interfacing Blue Book (starting from page 29) the machine uses TTL level on READ and WRITE port so i guess i can directly connect a PWM pin from the Arduino to the READ pin.
I also need to interface with the SENSE pin. I think i can directly connect that as well to one of the digital PINs and write digital LOW there when i need to signal pressed button state. Is that correct?
Later i wish to detect the presence of +6V signal on the MOTOR pin. Some loaders stop the dataset in the middle of the loading process so i have to detect that as well to emulate the tape correctly. Should i use some kind of resistor to limit the current there or can i just hook up that directly as well? Maybe i should use a relay there?