Joystick
Created by: Administrator, Last modification: Mon 26 of Oct, 2009 (14:21 UTC) by phil
The V6Z80P's joystick interface simply uses a PIC microcontroller to read 2 x 6 pin digital inputs from Atari/Amiga standard 9 pin D-Sub connectors and sends data serially to the FPGA using two pins: Clock and Data. The FPGA provides the clock, Data is always PIC -> FPGA.
Data bits are output by the PIC following detection of a rising edge on READ_CLOCK_IN. The FPGA therefore latches each bit on the following clock high edge. (OSCA arranges the bits back into parallel order, to be accessed by Z80 Port reads.)
ACTION...... Latch 0 Latch 1
____ V_____ V_____
CLOCK __! !_____! !_____! !____
DATA------<===BIT 0==><==BIT 1===><==BIT2==>
When the clock stays low for more than ~300 microseconds, the data packet send is aborted, new joystick values are read from the ports and the data transmission begins on the next clock high.
Transmission is a 16 bit word in the following order:
(Joy A) Up, Down, Left, Right, Fire1, Fire2, 0, 0, (Joy B) Up, Down, Left, Right, Fire1, Fire2, 0, 0
Notes:
- Sega megadrive pads can be connected by making a small hardware modification to the PCB.
- The joystick PIC uses its internal ~4MHz Oscillator - it is not connected to the main system's 16MHz clock.