Frank01
Newbie
This should be easy for someone, but I'm befuddled. I like to test LEDs connected to a port at the start of a program being tested to ensure the LEDs are working. I generally light the LEDs in sequence. I wrote two routines, both are supposed to light pin 0 of port d. The first one works fine, the second doesn't.
I'm programming using the OSHON software and use the Pickit3 for programming the chip. Oddly, when I run the program on the OSHON simulator, both programs light portd, pin0. It is only with the breadboard circuit that the difference shows up.
Thanks for any input.
I'm programming using the OSHON software and use the Pickit3 for programming the chip. Oddly, when I run the program on the OSHON simulator, both programs light portd, pin0. It is only with the breadboard circuit that the difference shows up.
Code:
=================================================
WORKS ON THE BREADBOARD & SIMULATOR
=================================================
;microchip 16f877a in use
;4 mhz resonator, 18 pf capacitors
;
list p=16f877a
#include <p16f877a.inc>
__CONFIG _CP_OFF & _DEBUG_OFF & _WRT_ENABLE_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC
;
banksel trisd ; bank 1
clrf trisd ; portd pins made outputs
;
banksel portd ; bank 0
movlw 0x01 ; move the value 0x01 t0 the accumulator
movwf portd ; move the value in the accumulator to portd
goto $
end
Code:
=========================================================================
DOESN'T WORK ON THE BREADBOARD, DISPLAYS 0XC7, OXE7 - WORKS ON SIMULATOR
==========================================================================
;microchip 16f877a in use
;4 mhz resonator, 18 pf capacitors
;
list p=16f877a
#include <p16f877a.inc>
__CONFIG _CP_OFF & _DEBUG_OFF & _WRT_ENABLE_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC
;
banksel trisd ; bank 1
clrf trisd ; portd pins made outputs
;
banksel portd ; bank 0
bsf portd,0 ; set portd, bit0
goto $
end
Thanks for any input.
Last edited by a moderator: