Quote:
Originally Posted by FalconFour
Connect SCL and SDA to analog pins 1 and 2, and use the standard Wire library, far as I can figure. No need for all that direct port access stuff... plus, PORTA...PORTC are direct access to the digital pins, I think something else is used to interact with the analog pins... and I think data is "written" to the analog inputs by switching the pull-up resistors on and off. I think.
|
Thanks again
It may be you are correct, but I think the Wire library will need some modification to use the different pins - pins 4 and 5 in the PORTC register are hard-coded, and the TWCR register is used by the Wire library for the processor's native two-wire serial interface support ... can it be connected to pins other than 4 and 5? Is it even possible? Maybe so, I have not dived so deeply into two-wire serial support and would need to do so to arrive at the answers. But I suspect a bit-banged version of Wire would be needed to use ANA1 and ANA2.
What I proposed before was to leave Wire alone and dual-purpose the ANA4 and ANA5 pins for the two buttons and I2C. I can see how to handle it in software, but electrically - I don't know. The MPGuino code turns on the pullups but defines the pins as inputs.