• AVR Freaks

AnsweredHot!PIC18F - MCC OpenDrain GPIO usage

Author
PIC Baker
New Member
  • Total Posts : 9
  • Reward points : 0
  • Status: offline
2020/09/23 09:55:32 (permalink)
2 (1)

PIC18F - MCC OpenDrain GPIO usage

Hi
I have a GPIO configured as OpenDrain Output.
I wonder how to correctly handle the pull down on the GPIO using MCC, biut I can't find any example explaining how to properly use OpenDrain Outputs with MCC generated code.
Currently I'm doing the following calls:

// perform reset
IO_GSM_PWRON_SetLow();
utils_delayms(750);
IO_GSM_PWRON_SetHigh();
 

 
I wonder if this is the correct approach. I recently switched from ARM, so this is all pretty new to me.
Any help is appreciated.

Attached Image(s)

#1
ric
Super Member
  • Total Posts : 28660
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: PIC18F - MCC OpenDrain GPIO usage 2020/09/23 13:19:51 (permalink)
+1 (3)
Which PIC18F device are you using?
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#2
PIC Baker
New Member
  • Total Posts : 9
  • Reward points : 0
  • Status: offline
Re: PIC18F - MCC OpenDrain GPIO usage 2020/09/23 22:42:11 (permalink)
0
sorry, forgot to mention. it's the PIC18F66K40
https://www.microchip.com..products/en/PIC18F66K40
#3
ric
Super Member
  • Total Posts : 28660
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: PIC18F - MCC OpenDrain GPIO usage 2020/09/23 22:55:34 (permalink) ☼ Best Answerby PIC Baker 2020/09/23 23:06:09
+1 (1)
I thought initially you were asking about a "weak pulldown", which this device does not have.
If you just mean how to turn on the open drain transistor, just treat it as a normal output, so control the state via the LATx register (or whatever MCC call is used to control the output pins.)
If you set the pin high, the FET to ground is off.
If you set it low, the FET to ground is on.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#4
PIC Baker
New Member
  • Total Posts : 9
  • Reward points : 0
  • Status: offline
Re: PIC18F - MCC OpenDrain GPIO usage 2020/09/23 23:01:21 (permalink)
0
Great, thanks!
So my understanding of the function was right and the code from my initial post should perform as expected.
#5
Jump to:
© 2020 APG vNext Commercial Version 4.5