English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. Asm / Hardware (https://eab.abime.net/forumdisplay.php?f=112)
-   -   How to Read Digital Pin 5 and Pin 9? (https://eab.abime.net/showthread.php?t=107303)

BeamCoder 11 June 2021 20:01

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?

Rotareneg 13 June 2021 01:14

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.

BeamCoder 13 June 2021 15:50

Quote:

Originally Posted by Rotareneg (Post 1490307)
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...


All times are GMT +2. The time now is 22:24.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.04084 seconds with 10 queries