PIC18F46K22 config issue


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2011
    Posts
    35

    Default PIC18F46K22 config issue

    Hi folks,

    Im trying to use a PIC18F46K22 for the first time, and am having a little trouble with the config for PORTD. I am using D.2 & D.3 as DEBUG pins, and D.5 as a LED indicator. The first thing I'm trying to do is turn off the LED by setting D.5 high. So far, so good. Then I try to send something out the DEBUG port D.2. The LED promptly turns right back on again.

    The only PORT config I have is:

    ASM
    ;PORT D
    CLRF PORTD
    MOVLW 00001000b ;SET PIN DIRECTIONS
    MOVWF TRISD
    ENDASM

    and my DEBUG setup looks like this:

    'DEBUG PORT
    DEFINE DEBUG_REG PORTD 'DEBUG PINS ARE IN PORTD
    DEFINE DEBUG_BIT 2 'TRANSMIT DEBUG PIN IS PORTD.2
    DEFINE DEBUGIN_BIT 3 'RECEIVE DEBUG PIN IS PORTD.3
    DEFINE DEBUG_BAUD 115200 'DEBUG PORT IS 115200 BAUD.
    DEFINE DEBUG_MODE 0 'INVERTED OUTPUT

    Can someone with more experience with these configs tell me why my DEBUG command might be interacting with my LED?

    Thanks much,
    Len

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,519


    Did you find this post helpful? Yes | No

    Default Re: PIC18F46K22 config issue

    Hi,
    Don't think it has anything to do with your CONFIG bits, it sounds more like a RMW issue to me. To verify if that's the case either insert a PAUSE between the setting the output and the DEBUG statement or control the LED by writing to LATD instead of PORTD.

    /Henrik.

  3. #3
    Join Date
    Jul 2011
    Posts
    35


    Did you find this post helpful? Yes | No

    Default Re: PIC18F46K22 config issue

    Datasheet Page 153 [10.7]

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts