Re: Commodore joystick ports

From: Jim Brain (
Date: 2007-04-10 20:05:57

Daniel O'Shea wrote:
> Yes, I'm starting to think that a microcontroller might be the best 
> solution after all... what I'm trying to come up with is a 
> multi-purpose 9-pin controller that I can use to interface with an 
> XScale PXA270 processor, but also maintain C64 compatibility as an 
> alternate function. What's complicating things is that the C64 
> joystick port has all its switches on the GND (0V) line, but the 
> PXA270 direct-keypad interface wants its switches on a 3.3V line... 
> Which at first doesn't seem like such a problem, until you want to 
> start adding in variable voltage sources that want a connection to 
> ground and power, if the ground and power lines are moving around! So 
> now what I'm thinking is if I input seven switches and two variable 
> voltages to a microcontroller, and then have seven outputs from the 
> microcontroller, with a jumper or toggle switch connected to select 
> between 0V and 3.3V mode, so then in 3.3V mode the seven outputs would 
> be:
> Up, Down, Left, Right, 3 buttons @ 3.3V (and X/Y variable voltage 
> sources which can bypass the microcontroller and be separately fed 
> directly to the PXA270, as it has its own ADC)
> ...and in 0V mode, the seven outputs would be:
> Up, Down, Left, Right, 1 button @ 0V and X/Y PWM outputs (here the 
> variable voltage sources are translated through the microcontroller's 
> ADC into PWM outputs for the C64)
> After a quick search I'm thinking a PIC16F87xA variant as it has 
> 10-bit ADC inputs, and two 10-bit PWM outputs - does this seem 
> achievable? (is the microcontroller's TTL I/O 3.3V?) thanks!
I'll vote for the AVR.  My PWM code is in C, which is easy to maintain, 
and you're free to it.  The L (low power) AVRs can do 3.3v, and the 
outputs will track Vcc.  3.3v operation will yield 3.3v outputs.

For the PWM code to work, you need 2 outputs for the POT lines, plus 1 
IRQ (can;t be on of the outputs)  3 pins
5 JOY buttons = 5 pins
1 select jumper = 1 pin

9 I/O.  Assuming one off DIP parts only, the ATTiny has 14 pin DIPs that 
offer what you need for $1.80-$2.50.

If space isn't a premium, I vote for the ATMEGA8, a 28 pin IC that has 
plenty of program space and IO for what you plan to do.  It's $3.66 in 
singles.  You can add some more goodies to the code later, if you wish.

PICs are a bit cheaper, though the programmers seem a bit pricier (I 
bought the PICkit 2 from Microchip for $35.00 or so, but my AVR 
programmer was free). Unless someone can spot you a HiTech PIC C 
compiler, you're into ASM for the PIC.  If ML is a preferred language 
for you, then your original uC choice would be fine.  I suggest C and 
the AVRs because I personally have moved beyond ML (I can do it, but I 
never could code it well, and free time grows shorter with each child's 
birthday).  You may be in the same position (or a similar one).  I 
suspect most of us are in that boat, as work and family encroach on the 
free time.


Jim Brain, Brain Innovations                                      (X) 
Dabbling in WWW, Embedded Systems, Old CBM computers, and Good Times! 

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.