![]() |
![]() |
#1 |
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... ![]() |
![]() |
#2 |
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. |
![]() |
![]() |
#3 |
move.w #$4489,$dff07e
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 |
![]() |
![]() |
#4 |
Posts: n/a
|
Perhaps....first i need to learn 68k-Assembler and Verilog...;-)
|
![]() |
#6 |
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. |
![]() |
#7 | |
Likes to be thought of as
|
Quote:
How have you tried and failed ? what have you done to fail ? What circuit are you using ? |
|
![]() |
![]() |
#8 |
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..) |
![]() |
![]() |
#9 |
Likes to be thought of as
|
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. |
![]() |
![]() |
#10 |
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 |
![]() |
#11 |
Likes to be thought of as
|
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. |
![]() |
![]() |
#12 |
Likes to be thought of as
|
So ???? Does it work ???
|
![]() |
![]() |
#13 |
Posts: n/a
|
No, same picture....:-(
I tried a standalone shift-register with some buttons, works pretty good. Why not this pad? |
![]() |
#14 |
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). |
![]() |
![]() |
#15 |
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 | |
![]() |
||||
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 |
|
|