• AVR Freaks

PIC18FK42 can't control output pins

Author
Glenn Wilson
Starting Member
  • Total Posts : 56
  • Reward points : 0
  • Joined: 2015/01/07 20:05:28
  • Location: 0
  • Status: offline
2020/09/16 12:47:06 (permalink)
2 (1)

PIC18FK42 can't control output pins

I have programmed about a dozen 8 bit microchip processors using MPLAB X IDE and XC8 but can not make this processor control a few output pins.
Glenn Wilson

 
My question is attached because it would not let me type it here.
 
#1

4 Replies Related Threads

    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11982
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: PIC18FK42 can't control output pins 2020/09/16 12:56:20 (permalink)
    +3 (3)
    You haven't configured them as outputs with the TRIS registers.  They are inputs by default.
    #2
    Glenn Wilson
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2015/01/07 20:05:28
    • Location: 0
    • Status: offline
    Re: PIC18FK42 can't control output pins 2020/09/16 14:30:26 (permalink)
    -1 (1)
    I haven't typed a tris statement in quite a while. I've been using the pin configurator - - - but maybe not following through to get that turned into tris ext..  Thanks for the info - I'll try to figure out why tomorrow. Glenn
    #3
    ric
    Super Member
    • Total Posts : 28337
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC18FK42 can't control output pins 2020/09/16 15:51:06 (permalink)
    +1 (1)
    The "TRIS" statement is a long obsolete command intended for much much older PICs.
    In all modern PICs, you write data to a TRIS register (TRISA, TRISB, etc. one per port).
     

    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
    ric
    Super Member
    • Total Posts : 28337
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC18FK42 can't control output pins 2020/09/16 15:54:49 (permalink)
    +1 (1)
    Glenn Wilson
    ... I've been using the pin configurator

    Huh?
    I assume you're talking about a part of MCC.
    Your source code does not contain anything produced by MCC, so anything you have done in the "pin configurator" will have no effect on your program.
     
    You appear to have a big slab of code output by the configuration bit editor, then seven lines you have written yourself by hand. None of it came from MCC.
     

    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!
    #5
    Jump to:
    © 2020 APG vNext Commercial Version 4.5