Good Morning Skimask, thanks for the suggestions, but what are you referring to "short of reprogramming"?
Good Morning Skimask, thanks for the suggestions, but what are you referring to "short of reprogramming"?
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?
Last edited by tazntex; - 15th September 2008 at 17:26.
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.
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.
Last edited by rmteo; - 15th September 2008 at 18:35. Reason: - typos.
Thank you all for the tips. I will have to do some studying on the EEPROM, I have never used this.
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.
Last edited by rmteo; - 15th September 2008 at 20:32. Reason: - added reference to manual.
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...
Last edited by skimask; - 15th September 2008 at 18:30.
Bookmarks