Tranx
Newbie level 3
I am new to Micro-controller programming.I have some lessons on PICs which i follow,but they are all designed for programming using a simple JDM programmer.Lesson codes are in assembly language. Here's a code for PIC16F84A ...
It's just supposed to blink an led. I've set configuration bits in MPLAB IDE as oscillator to be XT as i'm using a 4 MHz crystal and successfully built the HEX file.
1. The first problem is the LED doesn't blink in regular intervals all the time. It randomly changes the blinking interval.
2. Here's a another problem. I got two uC s . PIC16F84A and PIC16F877A. The picpgm software identifies the pic16f84a but not the other one. In winpic800 it says "Unknown device " for the PIC16F877A but it also identifies the PIC16F84A.
If you guys can help me out with the problems, i would be very grateful.
Thanks!
Code:
*****Set up the Constants*****
STATUS equ 03h
TRISA equ 85h
PORTA equ 05h
CounterL equ 0Dh
CounterH equ 0Eh
;*****Set up the port*****
bsf STATUS,5
bcf TRISA,0
bcf STATUS,5
;*****Turn the LED on*****
Start bsf PORTA,0
;*****Delay loop1*****
Loop1 decfsz CounterL,1
goto Loop1
decfsz CounterH,1
goto Loop1
;*****Turn the LED OFF*****
bcf PORTA,0
;*****Delay loop2*****
Loop2 decfsz CounterL,1
goto Loop2
decfsz CounterH,1
goto Loop2
goto Start
end
1. The first problem is the LED doesn't blink in regular intervals all the time. It randomly changes the blinking interval.
2. Here's a another problem. I got two uC s . PIC16F84A and PIC16F877A. The picpgm software identifies the pic16f84a but not the other one. In winpic800 it says "Unknown device " for the PIC16F877A but it also identifies the PIC16F84A.
If you guys can help me out with the problems, i would be very grateful.
Thanks!