English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 11 June 2021, 21:01   #1
BeamCoder
Registered User

 
Join Date: Dec 2020
Location: Philippines
Posts: 30
How to Read Digital Pin 5 and Pin 9?

Hi, there are some things I'm confused about how to read Pin 5 and Pin 9.

In HRM p.241 it says: "A button is a normally open switch that shorts to ground. The Amiga must provide a pull-up resistance on the sense pin. To do this, set the proper pin to output, and drive the line high (set both OUT ... and DAT ... to 1). Reading POTINP will produce a 0 if the button is pressed, a 1 if it is not."

What I'm confused about this is if I should only do the writing of POTGO register once(set OUT and DAT to 1 at startup and only read DAT every frame) or should I do it for every frame(read DAT then set DAT to 1). Does the Amiga/controller automatically set the DAT to 1 if button is not pressed?

And would this method don't cause any problems for controllers like Megadrive and CD32 even if I read Pin 5? Would Pin 9 read still work?
BeamCoder is offline  
Old 13 June 2021, 02:14   #2
Rotareneg
Registered User
Rotareneg's Avatar
 
Join Date: Sep 2017
Location: Kansas, USA
Posts: 256
Write once to POTGO. The built-in pull-up resistor will apply +5v to the pin. When you read POTINP (POTGOR in newer HRM) the relevant data bit will be 0 if that pin is currently grounded via a button, or 1 if not, that's all there is to it.

No idea about Megadrive or CD32 pads.
Rotareneg is offline  
Old 13 June 2021, 16:50   #3
BeamCoder
Registered User

 
Join Date: Dec 2020
Location: Philippines
Posts: 30
Quote:
Originally Posted by Rotareneg View Post
Write once to POTGO. The built-in pull-up resistor will apply +5v to the pin. When you read POTINP (POTGOR in newer HRM) the relevant data bit will be 0 if that pin is currently grounded via a button, or 1 if not, that's all there is to it.

No idea about Megadrive or CD32 pads.
Thanks for the answer! It is clear to me now.

Regarding the Megadrive and CD32 I look at the pinouts here: http://wiki.icomp.de/wiki/DE-9_Joystick

With Megadrive, since I write to Pin5(Button3), it will apply +5v which on the Megadrive side Pin5 is +5v. I assume nothing bad will happen here and the controller will work as a 2 button controller because of Pin 7(+5v) of Amiga sending high signal to Pin7(Select out) of Megadrive?

For CD32, again Pin5(Button3) is set and high signal is send on the Pin5(Shift Load Out) of the CD32 controller. When shift load is high, CD32 will treat the controller as gamepad mode(2 buttons only). So I guess nothing bad will also happen here?

I don't know anything about electronics...
BeamCoder is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Normal 34-pin floppy drive on external 26-pin roctec SilverZguru Hardware mods 45 20 December 2020 13:05
15-pin female plug (PC joystick) to 9-pin female plug (Amiga joystick port) eva support.Hardware 7 21 April 2016 21:03
23-pin to 9-pin video cable pinout MagerValp support.Hardware 9 22 August 2008 16:00
VGA Adapter 23 pin -> 15 pin High Density @UAE support.Hardware 11 16 October 2006 14:32
Pin Out Help... DeltaWolf7 support.Hardware 16 03 September 2002 12:16

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 09:37.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.06674 seconds with 15 queries