Shop OBEX P1 Docs P2 Docs Learn Events
Setting address on power-up. How to reclaim those pins.... — Parallax Forums

Setting address on power-up. How to reclaim those pins....

pacmanpacman Posts: 327
edited 2010-01-22 10:05 in Propeller 1
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?
=================

Comments

  • Miner_with_a_PICMiner_with_a_PIC Posts: 123
    edited 2010-01-22 00:17
    A quick random thought...how about using a resistor and capacitor on only one I/O line per prop chip? Keep the capacitor size fixed and vary the resistor size to alter the address. You would need to write a routine (some probably already exist) to measure how long the capacitor takes to charge/discharge that would run at start-up. It is likely that some characterization would be necessary as capacitor values vary greatly from the printed value and the RC times would need to be different enough to guarantee the ability of the program to differentiate one RC from another reliably.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-22 00:37
    There are several I2C I/O Expanders on the market, both 8-bit and 16-bit. Any of them would make a nice way (with some DIP switches) to set a device address. This could be attached to the same I/O pins used by the EEPROM. All of them (I believe) have weak pullups either always there or configurable, so you'd only need the DIP switch.
  • matbmatb Posts: 39
    edited 2010-01-22 09:34
    You could share with pins that normally operate as outputs driving a high impedance. Use high pull up/pull down resistors.
    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
  • Andrey DemenevAndrey Demenev Posts: 377
    edited 2010-01-22 10:05
    I use this schematic for setting configuration. With 2 pins, you can have 32=9 configurations, with 3 pins - 33=27 configurations, with 4 pins - 34=81 configurations! Pins still can be used as outputs, if they are connected to hi-impedance cirtuits, and you don't care if they change their state during few microseconds after startup. I use to connect such configuration network to SDI/SDO/SCK lines of SPI devices used. Having CS line pulled up, I am sure these lines are in Z-state on startup, so I can safely read the config.
    623 x 382 - 10K
Sign In or Register to comment.