English Amiga Board


Go Back   English Amiga Board > Requests > request.Other

 
 
Thread Tools
Old 25 September 2008, 20:05   #1
CrazyIcecap
 
Posts: n/a
How to read the CD32-Pad with Atmega8?

Hiho,

for a little funproject i am looking for a simple way to read the values of the CD32-Pad with an Atmel Atmega8. If possible, in BASCOM....i tried many different ways, but never succeded...
 
Old 25 September 2008, 21:55   #2
hit
Registered User
 
Join Date: Jun 2008
Location: planet earth
Posts: 1,115
since i've no clue, i only can advice you to the minimig core sourcecode, i guess its not bascom, but it might give you an idea:
http://home.hetnet.nl/~weeren001/
http://home.hetnet.nl/~weeren001/dow...04_08_2008.zip

have a look in "fpga core/Userio.v" and "fpga core/Minimig1.v". both deal with joystick. so it might help you somehow.
hit is offline  
Old 25 September 2008, 22:04   #3
musashi5150
move.w #$4489,$dff07e
 
musashi5150's Avatar
 
Join Date: Sep 2005
Location: Norfolk, UK
Age: 43
Posts: 2,351
Asman and Wepl posted some CD32 pad reading code here at EAB a while ago. It's in 68K of course but might be of some help?

http://eab.abime.net/showpost.php?p=410337&postcount=38
musashi5150 is offline  
Old 26 September 2008, 04:44   #4
CrazyIcecap
 
Posts: n/a
Perhaps....first i need to learn 68k-Assembler and Verilog...;-)
 
Old 26 September 2008, 04:57   #5
OddbOd
Registered User
 
Join Date: Jul 2005
Location: Australia
Age: 47
Posts: 666
Is this close enough?
OddbOd is offline  
Old 26 September 2008, 14:36   #6
CrazyIcecap
 
Posts: n/a
Very interesting device, have to try it for my pc :-)
Unfortunately it has nothing in common with the CD32-Pad. I am going to read the above sources and try to figure it out.
 
Old 26 September 2008, 17:16   #7
Dimlow
Likes to be thought of as
 
Dimlow's Avatar
 
Join Date: May 2008
Location: Kent,UK
Age: 55
Posts: 529
Send a message via MSN to Dimlow Send a message via Yahoo to Dimlow
Quote:
Originally Posted by CrazyIcecap View Post
Hiho,

for a little funproject i am looking for a simple way to read the values of the CD32-Pad with an Atmel Atmega8. If possible, in BASCOM....i tried many different ways, but never succeded...
What exactly are you trying to do ? Maybe i could help, i program a microchip pic chips all the time but have no experience with atmega controllers. The cd32 controller is just a bunch of switches yes ? if so then its easy. if its the same as an Amiga joystick then there is no problem.

How have you tried and failed ? what have you done to fail ? What circuit are you using ?
Dimlow is offline  
Old 26 September 2008, 17:29   #8
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,570
CD32 buttons are read serially, it is not simple switches.

Simple theory of operation: load parallel to serial converter (pulse 3rd firebutton pin 0->1->0), read first button, send "clock" pulse (firebutton pin), read next button (2nd firebutton pin) and so on.. After last button has been read state stays at low (or high, don't remember), some games use this to detect if CD32 pad is installed. (note: some clone pads may not have this logic..)

3rd firebutton = 0 = "normal mode" = red and blue buttons can be read normally.
3rd firebutton = 1 = "cd32 mode" = shift read mode, all buttons readable.

(if I remembered correctly..)
Toni Wilen is offline  
Old 26 September 2008, 17:39   #9
Dimlow
Likes to be thought of as
 
Dimlow's Avatar
 
Join Date: May 2008
Location: Kent,UK
Age: 55
Posts: 529
Send a message via MSN to Dimlow Send a message via Yahoo to Dimlow
Very interesting Toni, i never new that! But still it is possible them to read it using a micro controller. Not too difficult. Got any sources for further info on reading it ? I had a search but did not find anything.

iT Was only a quick search.
Dimlow is offline  
Old 26 September 2008, 17:47   #10
CrazyIcecap
 
Posts: n/a
Yes, thats right. I tried some code in ASM and later in BASCOM, but had no success. But....i don't have the original "Bone", i have a Honeybee CD32 Pad. Basically it is the same as the original pad - except for CMOS-Shift Register instead of TTL and added Autofire (i switched it off!).
Here are some informations and a schematic for the original pad:
http://gerdkautzmann.de/cd32gamepad/cd32gamepad.html

A short video showing what happens, when i press the Buttons: [ Show youtube player ]

This is my BASCOM-AVR-Code (It is Basic for AVR):
(Sorry for my english; as you can see on some words in the code, i am from germany)
Code:
    $regfile = "m8def.dat"
$framesize = 32
$swstack = 10
$hwstack = 40
Dim Speicher As Byte

Config Portb = Output                   'Port B as Output
Config Portd = Input                    'Port D as Input
Config Portd.4 = Output

Led0 Alias Portb.0                      'PB0 bis PB5 as Status-LED
Led1 Alias Portb.1
Led2 Alias Portb.2
Led3 Alias Portb.3
Led4 Alias Portb.4
Led5 Alias Portb.5

Select5 Alias Portb.7                   ' PB6 goes to Pin 5 of the Pad (PLoad)
Poweron Alias Portb.6                   '+5V on Pin 7
Clk Alias Portd.4

Poweron = 1
Select5 = 1
Clk = 1

  Led0 = 1
  Led1 = 1
  Led2 = 1
  Led3 = 1
  Led4 = 1
  Led5 = 1
Do
   Select5 = 0
   Config Portd.4 = Output
   Clk = 1
   Waitms 2
   Speicher.0 = Pind.6
   Clk = 0
   Clk = 1
   Waitms 2
   Speicher.1 = Pind.6
   Clk = 0
   Clk = 1
   Waitms 2
   Speicher.2 = Pind.6
   Clk = 0
   Clk = 1
   Waitms 2
   Speicher.3 = Pind.6
   Clk = 0
   Clk = 1
   Waitms 2
   Speicher.4 = Pind.6
   Clk = 0
   Clk = 1
   Waitms 2
   Speicher.5 = Pind.6
   Clk = 0
   Clk = 1
   Waitms 2
   Speicher.6 = Pind.6
   Clk = 0
   Clk = 1
   Waitms 2
   Speicher.7 = Pind.6
   Gosub Taste
   Waitms 5
   Config Portd.4 = Input
   Portd.4 = 1
   Select5 = 1

Loop
  End

Taste:
                       ' All LEDs off.

  If Speicher.0 = 0 Then                'Button A 
Led0 = 0
  Else
Led0 = 1
 End If
  If Speicher.1 = 0 Then                'Button Start
  Led1 = 0
  Else
  Led1 = 1
 End If
   If Speicher.2 = 0 Then               'Button B
   Led2 = 0
  Else
  Led2 = 1
 End If
   If Speicher.3 = 0 Then               'Button C
   Led3 = 0
  Else
  Led3 = 1
 End If
   If Speicher.4 = 0 Then               'Button Left
   Led4 = 0
  Else
  Led4 = 1
 End If
   If Speicher.5 = 0 Then               'Button Right
   Led5 = 0
  Else
  Led5 = 1
 End If
  Return
 
Old 26 September 2008, 18:03   #11
Dimlow
Likes to be thought of as
 
Dimlow's Avatar
 
Join Date: May 2008
Location: Kent,UK
Age: 55
Posts: 529
Send a message via MSN to Dimlow Send a message via Yahoo to Dimlow
Watched the vid, but no idea what you are saying there, all i can say is nice flashing lights. As for the code, should there be a small delay after each clk = 0 ? Then maybe it will work, i have not looked into your code in detail, but i would have thought there should be that delay there, other wise there is a very very small logic 0 pulse for the clock. maybe too fast for the 74LS165, maybe it should be about 100us or so.

Last edited by Dimlow; 26 September 2008 at 21:07.
Dimlow is offline  
Old 27 September 2008, 14:08   #12
Dimlow
Likes to be thought of as
 
Dimlow's Avatar
 
Join Date: May 2008
Location: Kent,UK
Age: 55
Posts: 529
Send a message via MSN to Dimlow Send a message via Yahoo to Dimlow
So ???? Does it work ???
Dimlow is offline  
Old 27 September 2008, 14:30   #13
CrazyIcecap
 
Posts: n/a
No, same picture....:-(
I tried a standalone shift-register with some buttons, works pretty good. Why not this pad?
 
Old 27 September 2008, 17:21   #14
yaqube
Registered User
 
Join Date: Mar 2008
Location: Poland
Posts: 159
@CrazyIcecap

Do you power your pad directly form Portb.6 ??? Try to feed it directly from power rail. Also make sure you have good ground connection between the pad and Atmega (signal integrity or ground bouncing might be a problem).
yaqube is offline  
Old 27 September 2008, 18:57   #15
CrazyIcecap
 
Posts: n/a
Tried that already, no difference. I have to power it from the port because i want to use the same circuit with a Sega Genesis-Pad (the device is going to be a portable multi-system-joystick/pad-tester); the power- and select-lines are swapped on that device.
Ground connection is good.
 
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using CD32 pad on A1200 running CD32 games issue RetroPaul support.Games 23 14 October 2013 23:51
Using a six-button Megadrive pad as a CD32 pad StarEye support.Hardware 22 09 September 2013 03:51
Remapping CD32 pad antonvaltaz support.WinUAE 2 01 November 2010 08:09
using cd32 pad with winuae?? jimmer78 support.WinUAE 2 13 October 2010 15:12
The Quest To Make The Comp Pro CD32 Pad My Favourite Pad StarEye support.Hardware 0 02 December 2007 22:21

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:02.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10754 seconds with 13 queries