PIC18 Port structure with programming

PIC18Fxxx Microcontroller's Port Structure


Writing Low(0) on PORT pin

Case : Writing "LOW" on Pin Px.x port writing zero

Internal CPU Bus(DATA Latch input)= 0
Output of DATA latch

  • Q=0
  • Q=1

Internal (TRIS Latch input)= 0 (Set direction of Px.x pin as output)
Output of TRIS latch

  • Q=0
  • Q=1

OR-gate

  • A input=1
  • B input=0
  • Y output=1
  • P-type MOSFET=OFF

AND -gate

  • C input=1
  • Dinput =1
  • Z output=1
  • N-type MOSFET=ON

The pin is pulled down by the lower FET.
Hence at Px.x = Ground or logic '0' on pin.
Hence the output becomes zero.

Writing High (1) on PORT pin

Case : Writing "High" on Pin Px.x PORT writing 1

Internal CPU Bus(DATA Latch input)= 1
Output of DATA latch

  • Q=1
  • \bar{Q}=0

Internal CPU Bus(TRIS Latch input)= 0
Output of TRIS latch

  • Q=0
  • Q=1

OR-gate

  • A input=0
  • B input=0
  • Y output=0
  • P-type MOSFET=ON

The pin is pulled down by the upper(P) FET.
Hence at Px.x = Vcc or logic '1' on pin.
Hence the output becomes High.

AND -gate

  • C input=0
  • Dinput =1
  • Z output=0
  • N-type MOSFET=OFF

Reding Low(0) on PORT pin


PORT reading Zero

Case : Reading "LOW" on Pin Px.x 

Internal (TRIS Latch input)= 1 (Set direction of Px.x pin as Intput)
Output of TRIS latch

  • Q=1
  • \bar{Q}=0

OR-gate

  • A input= X (Don't care)
  • B input=1
  • Y output=1
  • P MOSFET=OFF

AND -gate

  • C input=X (Don't care)
  • D input =0
  • Z output=0
  • N MOSFET=OFF

Both FET's remains OFF and Hence Logic 0 which at pin Px.x will be read
Read Latch

  • Input =0 
  • Q=0

Internal CPU Bus will receive = 0

Reding High(1) on PORT pin


PORT reading 1

Case : Reading "High" on Pin Px.x 

Internal (TRIS Latch input)= 1 (Set direction of Px.x pin as Intput)
Output of TRIS latch

  • Q=1
  • \bar{Q}=0

OR-gate

  • A input= X (Don't care)
  • B input=1
  • Y output=1
  • P MOSFET=OFF

AND -gate

  • C input=X (Don't care)
  • D input =0
  • Z output=0
  • N MOSFET=OFF

Both FET's remains OFF and Hence Logic 1 which at pin Px.x will be read
Read Latch

  • Input =1 
  • Q=1

Internal CPU Bus will receive = 1

References


  • Created and edited by Prof. Sujit wagh, SKNCOE, Pune
  • WikiNote Foundation

Last modified: Monday, 16 September 2019, 4:47 PM