From: Jim Brain (brain_at_jbrain.com)
Date: 2007-05-09 17:00:47
Marko Mäkelä wrote:
> On Wed, May 09, 2007 at 01:56:20AM -0500, Jim Brain wrote:
>
>> LO->HI: switch DDR to input, then switch logic level to high to engage
>> pullup. Doing it this way ensures you never drive pin with 5v directly
>> HI->LO: disengage pullup, then switch DDR to output.
>>
>
> Oh, I did remember something about setting the PIN bit on the AVR
> when composing my answer. That was for engaging the pullup resistor
> when outputting a logic 1. But I don't think it should be necessary
> for the joystick port, because mechanical joysticks do not contain any
> pullup resistors. And I think you can safely leave the PIN bit
> initialized to 1 at all times.
>
I think you mean 0.
PORT=0, DDR=0, input, no pullup
PORT=0, DDR=1, output, low
In my defense, I wrote the joystick code after the initial IEC code, so
I was in IEC mode when writing it.
> It's a different matter on a shared bus, such as the Commodore serial bus.
> There you might want to disengage the pullups when the device is not active,
> or you won't be able to attach very many devices to the bus. I remember
> that George Page, who parted with his collection some years ago, once tested
> how many devices he can connect to the serial bus. I think he was getting
> problems after some 5 devices. That might be because the Commodore
> devices are equipped with fixed (passive) pull-up resistors.
>
That's a good idea, I'll add that to the tweaks list.
Jim
--
Jim Brain, Brain Innovations (X)
brain@jbrain.com
Dabbling in WWW, Embedded Systems, Old CBM computers, and Good Times!
Home: http://www.jbrain.com
Message was sent through the cbm-hackers mailing list
Archive generated by hypermail pre-2.1.8.