Setting address on power-up. How to reclaim those pins....
pacman
Posts: 327
I'm working on a device that will {potentially} exist in a multi-drop environment.
This means I need to have a way of setting the device address easily - say via dip switches that are read on power-up.
Now if I have 4 inputs that gives me 16 possible addresses (more than ample) but it means that those input pins are 'lost' for other purposes - unless there is away of reading pins on powerup then reassigning them to other functions once read.
I know I could assign them as outputs once read, but I'm concerned that during the read cycle they outputs could behave in an unpredictable way.
Am I just being paranoid?
Is there some tried and true method that someone would like to share?
I realise I could store the values in the eprom, but that means I need to come up with a way to easily allow the address to be changed with a serial terminal - which means access to a serial terminal would be required. I would like to remove the need for carrying a laptop to configure this unit...
Thanks in advance.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
=================
The future is in our hands.
Which way to the future?
=================
This means I need to have a way of setting the device address easily - say via dip switches that are read on power-up.
Now if I have 4 inputs that gives me 16 possible addresses (more than ample) but it means that those input pins are 'lost' for other purposes - unless there is away of reading pins on powerup then reassigning them to other functions once read.
I know I could assign them as outputs once read, but I'm concerned that during the read cycle they outputs could behave in an unpredictable way.
Am I just being paranoid?
Is there some tried and true method that someone would like to share?
I realise I could store the values in the eprom, but that means I need to come up with a way to easily allow the address to be changed with a serial terminal - which means access to a serial terminal would be required. I would like to remove the need for carrying a laptop to configure this unit...
Thanks in advance.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
=================
The future is in our hands.
Which way to the future?
=================
Comments
For ANY output you need to check its behaviour during startup when the pins are floating. In this case check they are safe in either state. For things such as motor drivers you make sure there is a pull up/down on the enable as appropriate, whereas the direction could be left floating.
Alternatively, use one pin with a C, and switch in different R's via the DIPs. Use (at least) binary powers for R values so you can differentiate any combination.
Post Edited (matb) : 1/22/2010 9:45:38 AM GMT