How to invert OWOUT pin in assembly?


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2007
    Posts
    15

    Default How to invert OWOUT pin in assembly?

    Using 18F67K22, I need a "stronger" OWOUT to drive a "heavy" 1-wire network.
    So using 2 FETs, in a modified version of Maxim's AN244.

    This means that to be able to use the PBP OWOUT command to drive the lower FET (the one that pulls the line low), and not wanting to add an external inverting gate, I need to invert the pin level at the OWOUT pin.

    I will be reading from the 1-wire network using non-inverted levels on a different pin, so no need to invert for OWIN.

    I have no knowledge of Microchip assembly, but I think it would probably be possible to invert the OWOUT pin levels with a simple edit of the OWOUT section of the pbppic18.lib library file (PBP 3.0).

    Any hints (other than go learn Assembly!)?

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


    Did you find this post helpful? Yes | No

    Default Re: How to invert OWOUT pin in assembly?

    It doesn't look too hard. I would create a new DEFINE (DEFINE OWINV 1 ?) if I were you. That way you can use the same library - inverted or not.
    I did nearly the same thing with DEBUG. I have a define that lets me run DEBUG in an open-collector mode - useful for high-speed serial networking
    between PICs.

    I can give you some hints this evening, but I don't have any OneWire devices to test.
    Charles Linquist

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


    Did you find this post helpful? Yes | No

    Default Re: How to invert OWOUT pin in assembly?

    But - be careful Your plan may not work as you wish. A PIC pin can easily drive 25mA (low) without a FET booster. That equates to a 200 ohm pull-up. That combination will drive an awfully long wire or dozens of devices. But One-Wire sensors have to drive the same line. Just because the PIC can drive the line and the pull-ups does not mean that the One-Wire devices can drive it. And even if your One Wire devices can sink decent current, you may not want them to. If your devices are temperature sensors, then any time they are sinking current they will generate heat. If you read them often, the temperature rise - even if you have them sinking 5mA, will be noticeable.
    Charles Linquist

  4. #4
    Join Date
    Jun 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default Re: How to invert OWOUT pin in assembly?

    Thanks for your comments. The output will actually be 3-state: a passive pullup (1K resistor, equivalent to 5mA sink on sensors), active pull down (FET) and active pull up (FET) - the actives with an effective resistance of 100 Ohm = the nominal line impedance. The active pull up is driven by another circuit, based on transition voltage and line sampling, as per the Maxim Application Note. http://pdfserv.maxim-ic.com/en/an/AN244.pdf

    The FET's serve 2 functions:
    - harder pull down and pull up
    - slew rate control (pulse shaping via associated RC).
    In the case of direct pull-down with a PIC pin, we may be able to sink up to 25 mA (much less on some ports of the 18F67K22), but do not have slew rate control (although the internal resistance of the output pin does limit pulse rise/fall time), and the line impedance is less well matched.

    I think the combination of better impedance matching and slew rate control has advantages in long "heavy" networks, so I still want to go for driving the pull down with an inverted OWOUT.

    Your "DEFINE OWINV 1" suggestion sounds promising, I would rather do this than edit the library itself. Any code snippets that would point me in the right direction?

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


    Did you find this post helpful? Yes | No

    Default Re: How to invert OWOUT pin in assembly?

    Give me a little time, I may be able to find a few minutes here and there to make the mods and test them. But my "DEFINE OWINV 1" comment *** DOES *** involve editing the library. It simply adds a 'switch' that causes OWOUT to be inverted when the define is used, and "in the normal way" when it isn't.

    I have to ask... I have used one wire devices once in the past, and while I think the idea is kind of neat, my opinion is that saving two wires (compared to I2C) is generally not worth it - especially when you start adding special drive circuits. Is there some reason you aren't using I2C?
    Charles Linquist

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: How to invert OWOUT pin in assembly?

    A little more than inverting the OWOUT command ... you would need to change the 1-Wire command into a 3-wire command for AN244.

    Not impossible, but do ya really want to go there ?
    DT

  7. #7
    Join Date
    Jun 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default Re: How to invert OWOUT pin in assembly?

    Well....yes, I do. The application is a big sensor network, partially in a dangerous environment, where for safety reasons current has to be limited. Hence the "parasitic powering" from the 1-wire line. Also for reverse-compatibility with existing, installed sensors.

    Darrel, I take your point. What I am planning is a modified implementation of AN244, with the active pull-up implemented using a separate comparator and PIC (PIC#2). The comparator monitors the line voltage, comparing with a logic threshold reference voltage. When the level on the line rises beyond the threshold voltage (because either the master or a sensor has "let go"), the comparator outputs high. PIC#2 monitors the comparator output, and when it goes high it drives the active pull-up on. The preceding low on the line has been timed by PIC#2, and depending on the combination of the length of the preceding low and whether it has been pulled down by the master (pre OWOUT toggle pin state on main PIC) or by a slave, PIC#2 knows how long to hold the active pull-up.

    The code for the above is regular PBP stuff, no big problem.

    But inverting the OWOUT pin?
    Charles, thanks for the clarification, that makes a lot of sense. In the meantime, I will add an inverting gate on the breadboard and test my code, so that I at least (fingers crossed) have a proof of concept...

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