pic as 1-wire Slave


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    If you are going to use two wires, then you might as well use software RS-232 in it's open-collector, idle-high incantation. The best reason to use this protocol is the large amount of support already in PBP. RS-232 open-collector operation gives the advantages of I2C without the hassle.

    In my network, I send out the slave's address, plus a command byte, plus a checksum.
    When the slave decodes it's address, it sends back the slave address, the data and a checksum.
    It very reliably "talks" at 38.4Kbaud across a large network. The Master is a 18F8723 running at 40MHz, but all the slaves are 18F2221's running on their internal 8MHz oscillators ! If you have a chip with a less stable oscillator, you can just run at a slower baud rate.

    An additional benefit of doing things this way is that you can use the hardware receiver shift register (HSERIN). This gives you a two-byte buffer and an easy interrupt source.
    Because of the interrupt and the buffer, the slave never misses any data and can do other tasks while waiting for a poll. On the slave side, you can't use HSEROUT (at least without a hardware buffer) because it isn't open-collector, but that isn't a problem.
    The host can use HSERIN as well, reducing the load on that side.


    I have a network "reserved" address of 253. All slave devices are initially programmed to that address. Whenever the MASTER calls that address, the command byte it sends contains the new address that I want to give the slave. That new address value is stored in the EEPOM of the slave device. The slave reads that value from EEPOM every time it powers up. I can easily program the slave address of the device that way, and no dip switches are needed. I write the device's address on a label to keep track.

    Before anyone says that I'm lying about getting 38,400 baud with an 8Mhz oscillator and SEROUT2, I should admit that I'm actually using DEBUGOUT, which has lower software overhead than SEROUT2. I modified the PBP libraries to give me an open-collector output on the DEBUGOUT command.
    If you don't want to modify any libraries, you can still easily get 19.2Kbaud using an 8MHz oscillator and SEROUT2.

    I use 4.7K pull-ups on TRANSMIT and RECEIVE of all devices (including the host), and have no trouble across at least 25' of wire.

    One final benefit: You can hook a MAX-232 to the two data lines and easily debug any communication issues with your PC.
    Charles Linquist

  2. #2


    Did you find this post helpful? Yes | No

    Default

    I think Hansolo is trying to make a slave device for 1-wire. There are nice parts that Maxim is DNRing as the DS2423, that I would like to make a replacement for.
    Tim Barr

  3. #3
    Join Date
    Nov 2007
    Posts
    2


    Did you find this post helpful? Yes | No

    Cool Thanks for all the help

    I have several ideas now. I am using a vb.net program I wrote using the DS9490 to talk to 1-wire network. If I could use serial I would but I am looking at a way to bit bang a protocal just for pic communication using a .dll. If I do this it could be a cheap way to talk to pics using a ready made usb link in the DS9490. I will post the code if I do this. I am also looking at the DS2423 but it says "Do not use for new designs".
    I guess I could use a DS2405 to latch a pin on a pic then write to a memory 1-wire using master mode then read the data. This seems excessive.
    Thanks for all the Ideas.

  4. #4
    kartem's Avatar
    kartem Guest


    Did you find this post helpful? Yes | No

    Default Re: pic as 1-wire Slave

    I found this pic 1-wire slave
    k

Similar Threads

  1. one line led light make image
    By bioul in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 13:19
  2. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 21:36
  3. Comm example: Pic to Pic
    By Chadhammer in forum Code Examples
    Replies: 4
    Last Post: - 15th November 2006, 00:26
  4. Replies: 2
    Last Post: - 10th June 2005, 03:34
  5. DS1820 headache
    By Calco in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 12th August 2004, 01:28

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