Hi all,
I'm new to this forum as well as microcontrollers and am looking for some guidance/tips on the learning process. I've purchased a very cheap development kit consisting of leds, number pads, etc etc etc. It also came with a 16f877a, which I find a bit complex to start with and I am having problems.
The led's are connected to port d, where current flows from power source, thru resistor, thru led, into port d pins (so port d must be grounded to power leds). I know everything works because if I program the pic with the sample program provided in C, the leds work.
However I am trying to do a simple test in assembly and am unable to set any of the pins on any ports high or low, and I've played around with this for a week. No matter what I set the pins (on any port), nothing is affected (port RD1 is always about 3.5V and the supply is 5V). I've tried _RC_OSC and _HS_OSC (its using a 20mhz crystal).
If anyone can point out what the problem is, that would be awesome, thanks!
My program:
----------------------------------------------------------------------------------
list p=16f877a ; list directive to define processor
#include <p16f877a.inc> ; processor specific variable definitions
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _HS_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF
MAIN_PROG CODE
start
banksel TRISD
CLRF TRISD
banksel PORTD
CLRF PORTD
; remaining code goes here
goto $
END ; directive 'end of program'
I'm new to this forum as well as microcontrollers and am looking for some guidance/tips on the learning process. I've purchased a very cheap development kit consisting of leds, number pads, etc etc etc. It also came with a 16f877a, which I find a bit complex to start with and I am having problems.
The led's are connected to port d, where current flows from power source, thru resistor, thru led, into port d pins (so port d must be grounded to power leds). I know everything works because if I program the pic with the sample program provided in C, the leds work.
However I am trying to do a simple test in assembly and am unable to set any of the pins on any ports high or low, and I've played around with this for a week. No matter what I set the pins (on any port), nothing is affected (port RD1 is always about 3.5V and the supply is 5V). I've tried _RC_OSC and _HS_OSC (its using a 20mhz crystal).
If anyone can point out what the problem is, that would be awesome, thanks!
My program:
----------------------------------------------------------------------------------
list p=16f877a ; list directive to define processor
#include <p16f877a.inc> ; processor specific variable definitions
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _HS_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF
MAIN_PROG CODE
start
banksel TRISD
CLRF TRISD
banksel PORTD
CLRF PORTD
; remaining code goes here
goto $
END ; directive 'end of program'