LGabrielson
- 14th September 2012, 00:21
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
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