PDA

View Full Version : Addressing with Dip Switch or ???



tazntex
- 15th September 2008, 16:34
I am using an rf module, the transmitter is addressed the same as the receiver using a dip switch. My question is if I use a dip switch is this the best way to separate identical units or is there another option? And if there is a better way, what would the maximum addresses I could have be? I am using a 16F628A with three available I/O pins.

Thanks

skimask
- 15th September 2008, 16:50
And if there is a better way, what would the maximum addresses I could have be? I am using a 16F628 with three available I/O pins.

Short of reprogramming each unit? Probably not...

3 free I/O's...

8 combinations using logic level I/O (high, low)...

Could have 27 using logic level, plus an Open state (high, low, open)

Could have practically unlimited options using RCTIME and a big handful of 1% (or better) resistors along with a tight tolerance capacitor... Combine a few pins using RCTIME and those same parts, and you could, in theory, have 2^48 combinations (not gonna happens, but it's theorectically possible).

tazntex
- 15th September 2008, 16:57
Good Morning Skimask, thanks for the suggestions, but what are you referring to "short of reprogramming"?

tazntex
- 15th September 2008, 17:20
Skimask,
what if I do this?
serout2 serpin,16572,[$AA,$AA,$AA,$AA,$AA,$AA,synch,address,address,addr ess,keydata,keydata,keydata]

address would be a byte so that is 8 bits 00000000, and if were to use 11111111 that would be dec 255. So am I correct by saying I could actually have 255 individual addresses,if I used a word the maximum could be 65,535 if I programmed them separately?

CocaColaKid
- 15th September 2008, 18:14
You are correct in that you can address up to 256 devices using a byte variable and 65,535 using a word variable. The problem is how to program the device id? That is what I believe he meant by "short of reprogramming". You could program it though so you could change it in software. I would assign a default value that doesn't get used for anything else but installing new devices. For example use id 0 for new devices only. This allows you to put a new device on without interfering with other devices prior to setting the device id.

skimask
- 15th September 2008, 18:23
Good Morning Skimask, thanks for the suggestions, but what are you referring to "short of reprogramming"?

The other method described above works too...
Set the units address if/when it's the only unit plugged into the chain, or maybe one of those I/O pin goes to a 'program ID' button.

Reprogramming as in - programming each unit with it's own recognition code of some sort.

And while I'm on that, you could use the 3 I/O's for 8 (or 27) different 'addresses', then -reprogram- each 8 (or 27) bunches of units to respond to different addresses...

rmteo
- 15th September 2008, 18:28
You could store the Device ID (address) in EEPROM. As suggested by CocaColaKid, use ID 0 as the broadcast ID (every unit responds to this ID) to have the ability to change/add ID's. No need for switches, I/O's, etc. You can have up to 255 ID's - or if you use 2 bytes of EEPROM, up to 65535 ID's, if you should need that many.

tazntex
- 15th September 2008, 19:58
Thank you all for the tips. I will have to do some studying on the EEPROM, I have never used this.

rmteo
- 15th September 2008, 20:11
That is exactly what EEPROM is for - storage of configuration data, etc. The data is non-volatile, it is retained even if the PIC powered down, and is available on power-up. The 16F628A comes with 128 bytes of EEPROM built in. You now have 3 extra I/O pins available plus you save on the cost of the DIP switch and other components.

See page 123 of the manual for the READ command, and Page 159 for the WRITE command to read/write EEPROM.

tazntex
- 15th September 2008, 21:24
Thanks again.

Dave
- 16th September 2008, 12:19
tazntex, Why not just use a 1 wire silicon serial number device from Maxim?

Dave Purola,
N8NTA