Addressing with Dip Switch or ???


Closed Thread
Results 1 to 11 of 11
  1. #1

    Default Addressing with Dip Switch or ???

    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
    Last edited by tazntex; - 15th September 2008 at 16:48.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by tazntex View Post
    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).

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Good Morning Skimask, thanks for the suggestions, but what are you referring to "short of reprogramming"?

  4. #4


    Did you find this post helpful? Yes | No

    Default

    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.

  5. #5


    Did you find this post helpful? Yes | No

    Default

    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.

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by tazntex View Post
    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...
    Last edited by skimask; - 15th September 2008 at 18:30.

  7. #7
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    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.

  8. #8


    Did you find this post helpful? Yes | No

    Default

    Thank you all for the tips. I will have to do some studying on the EEPROM, I have never used this.

  9. #9
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    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.

  10. #10


    Did you find this post helpful? Yes | No

    Default

    Thanks again.

  11. #11
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    tazntex, Why not just use a 1 wire silicon serial number device from Maxim?

    Dave Purola,
    N8NTA

Similar Threads

  1. Rotary Hex Dip Switch Code???
    By dangill in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 13th March 2008, 13:30
  2. DIP switch select delay
    By mongater in forum General
    Replies: 15
    Last Post: - 17th January 2008, 14:13
  3. Replies: 14
    Last Post: - 26th September 2007, 05:41
  4. dip switchs & inputs
    By grounded in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th September 2006, 13:37
  5. Newbie - 16F628A and switch latching
    By malc-c in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 19th May 2006, 02:35

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts