Menu

Generateing a ground?

Help
2008-07-27
2013-05-30
  • Nobody/Anonymous

    I plan on using a PIC with a device that comunicates with by grounding and ungrounding I know how to make it recodnise a ground but how do I mkae a O/i pin act as one?

     
    • kent_twt4

      kent_twt4 - 2008-07-28

      Lets assume you are trying to communicate with a one-wire device, or implementing an I2C protocol.  The output pin will be pulled up to V+ with a pull-up resistor.  Here's a case where its possible to use the MCLR pin with its pull-up resistor.  So to get your high and low on a pin, you would:

      #define SDA PortB.0 'Or whatever pin is handy
      ...
      ...
      Main:
      dir SDA in 'This sets the pin as input/analog allowing
      'the pullup to set the pin high/V+
      wait 1 s
      dir SDA out 'sets pin as output/digital
      set SDA Off  'sets pin low/ground
      wait 1 s
      goto Main

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.