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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
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