Justin Payne Posted November 1, 2016 Share Posted November 1, 2016 I just thought I could get a quick question about this project I found (http://www.raphnet.net/electronique/atari_usb/index_en.php) which uses a ATMega8a. In the schematic, they connect the analog pins the the Atari 9-pin port. This makes sense for pins 5 and 9, which are used for the POTs, but shouldn't the designer of the circuit use the digital pins for the joystick pins? Quote Link to comment Share on other sites More sharing options...
+Stephen Moss Posted November 1, 2016 Share Posted November 1, 2016 I am not certain having not used the ATMega8 bit as it is a Microcontroller I assume it will be similar to Microchip PICs in which case you can select which pins are used as inputs and outputs by writing the required value to the correct register within the Microcontroller that enables/disables the respective I/O (input/output) tristate buffers for each pin. Additionally, many pins are used as both a standard digital I/O pins or I/O pins for peripherals such as UARTS for serial communications and ADC's. Again by setting values in various registers inside the device you can decide if you want a pin to used as a digital I/O pins or for a peripheral so the pin text shown in brackets in the schematic refer to a pins secondary (or secondary and tertiary functions). I am certain that in this instance the affected pins would be set for use as Digital I/O pins, it would be pointless to use and ADC as Microcontrollers usually only have one ADC which is multiplexed to several ADC pins which means you would have to read one pin at a time and determine if its value results in a digital 1 or 0, this takes a lot longer than reading all the pins in go as digital inputs. Quote Link to comment Share on other sites More sharing options...
Justin Payne Posted November 1, 2016 Author Share Posted November 1, 2016 Ahhhh. Ok. Reason why I ask is that I was thinking about using a Arduino Mega 2560 to make a 4 port joystick to usb for playing 4 player games on the emulator. This was the only board with enough digital i/o's. If I had to use analog, no boards had enough of those. Quote Link to comment Share on other sites More sharing options...
Osgeld Posted November 1, 2016 Share Posted November 1, 2016 (edited) you can use analog pins as digital pins, but you cant use digital pins as analog on 8 bit AVR's in the arduino enviroment analog pins addressed as digital just keep going up in pin numbers, so on a uno the last "digital" pin is 13, the first analog pin would be digital pin 14 Edited November 1, 2016 by Osgeld Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.