Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
LIST P=PIC16F84
#INCLUDE "P16F84.INC"
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _LP_OSC
errorlevel -302
cblock 0x0c
d1,d2,d3
endc
org 0
init
banksel TRISA ;bank 1
clrf TRISA
clrf TRISB
banksel PORTB ;bank 0
clrf PORTB
main bsf PORTB,0
call delay5sec
bcf PORTB,0
nop ;slight delay for possible RMW problem
bsf PORTB,1
call delay2sec
bcf PORTB,1
nop ;slight delay for possible RMW problem
bsf PORTB,2
call delay5sec
bcf PORTB,2
goto main
delay5sec ;5second delay
movlw 0x3F
movwf d1
movlw 0x20
movwf d2
Delay5sec_0
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay5sec_0
return
delay2sec ;2second delay
movlw 0x7F
movwf d1
movlw 0x0D
movwf d2
Delay2sec_0
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay2sec_0
return
end
The only difference is that the 16F84A can run at up to a 20MHz clock speed. The 16F84 can only do 10MHz. That is all.Q1> Is there different between pic 16F84 and Pic 16F84A?
I know this by looking up the **broken link removed** at Microchip's site and downloading the 16F84/16F84A Migration document.Q2> How can u know if there is a different or not?
hey what is mean by
movlw 0xDA
goto $+2
movlw 0x0C
LIST P=PIC16F84A
#INCLUDE "P16F84A.INC"
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _LP_OSC
errorlevel -302
cblock 0x0c
d1,d2,d3
endc
org 0
init
banksel TRISA ;bank 1
clrf TRISA
clrf TRISB
banksel PORTB ;bank 0
clrf PORTB
main bsf PORTB,0
call Delay1sec
bcf PORTB,0
call Delay1sec
goto main
Delay1sec
;999990 cycles
movlw 0x07
movwf d1
movlw 0x2F
movwf d2
movlw 0x03
movwf d3
Delay1sec_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay1sec_0
;6 cycles
goto $+1
goto $+1
goto $+1
;4 cycles (including call)
return
end
Toggles bit-0 of PortB on and off continuously with a delay between. If you have an LED with current limiting resistor on the pin, with anode to the pin and cathode to ground, it will flash.Q> what does this program do ?
It would appear that you have the wrong oscillator type selected in your __CONFIG line. A 4MHz crystal should have XT selected, not LP. Your config lineQ>how i know if the crystal i bought 4MHz is working or not?
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _LP_OSC
__CONFIG _CP_OFF & _PWRTE_OFF & _WDT_OFF & _XT_OSC
There's the problem. Like I said previously, MCLR must be pulled high with a resistor. Your schematic shows it pulled low. When MCLR is held low the PIC is in RESET, and halted. No program runs with MCLR pulled low like that.I will post the schematic that i am following
In case you didn't understand 3v0's pullup/pulldown explanation I found another on the interweb.Q> What you mean by pulled high and pulled low and when do i use pulled high or pulled low?
And, like 3v0 says, don't connect MCLR directly to VDD. Use a pullup resistor between the MCLR pin and VDD.
This is really just personal choice, PIC's are designed for a direct MCLR connection if you wish, but obviously it prevents ICSP - if you don't use ICSP, then you don't need a resistor - if you do use ICSP, then you need a resistor and a diode.
The behavior of the ESD protection on the MCLR pin
differs from previous devices of this family. Voltages
applied to the pin that exceed its specification can
result in both Resets and current consumption outside
of device specification during the Reset event. For this
reason, Microchip recommends that the MCLR pin no
longer be tied directly to VDD. The use of an RCR
network, as shown in Figure 14-5, is suggested.