henninggs
Member level 2
Hi.
I am trying to design a simple rs485 slave. The slave will get its address from a 5 position Dip switch. It will only need to read the switch once: When it is powered on. (Storing the address in a register for later use)
I could dedicate 5 pins on the microcontroller to this purpose, but those 5 pins would be nice to have for other things once the PIC is done reading the address.
There is 2 solutions as I see it:
1. Use 5 pins for the read, then disconnect the dip switch from the pins. (How is that done ?)
2. Connect the switch to some resistors and dedicate a single analog-to-digital pin for the read. Convert the voltage drop to an address. Something like this:
What would be the best solution to my "problem" and how could it be done ?
Thanks for any replies.
I am trying to design a simple rs485 slave. The slave will get its address from a 5 position Dip switch. It will only need to read the switch once: When it is powered on. (Storing the address in a register for later use)
I could dedicate 5 pins on the microcontroller to this purpose, but those 5 pins would be nice to have for other things once the PIC is done reading the address.
There is 2 solutions as I see it:
1. Use 5 pins for the read, then disconnect the dip switch from the pins. (How is that done ?)
2. Connect the switch to some resistors and dedicate a single analog-to-digital pin for the read. Convert the voltage drop to an address. Something like this:
What would be the best solution to my "problem" and how could it be done ?
Thanks for any replies.