What program did you draw that in?
Got a few old computer psus.
Do you just put the LEDs in between the certain port and Vcc?
what does _RC_OSC mean?
Why the hell did microchip make this so bloody complicated?
I don't believe the F84A has an internal oscillator optionI replaced the config with the fuses you said earlier but it did not work, all it is doing is making all the outputs high
Which config gets it to use the inbuilt oscillator?
The PIC16F84A oscillator design requires the use of a
parallel cut crystal. Use of a series cut crystal may give
a frequency out of the crystal manufacturers
specifications. When in XT, LP, or HS modes, the
device can have an external clock source to drive the
OSC1/CLKIN pin
When using resonators with frequencies
above 3.5 MHz, the use of HS mode rather
than XT mode, is recommended. HS mode
may be used at any VDD for which the
controller is rated.
;********************************************************
;PIC16F84A Code template ASM file
;By Brent Morse, 2006
;********************************************************
list p=16f84A
include "p16f84A.inc"
ERRORLEVEL -224,-302,-305 ;supress compiler errors
__FUSES _CP_OFF & _WDT_ON & _RC_OSC & _PWRTE_OFF
cblock 0x0c ;This is where you declare your variables
safe_w
safe_s
tick
endc
;---COMMON-------all inputs pulled high externally
#define LED PORTA,0 ;
;----------------------------------------------
org 0x00
goto Start
;---INTERRUPT ROUTINE--------------------------
org 0x04 ;interrupt vector
INT ;save working vars
movwf safe_w ;save w
swapf STATUS,w ;swap status, w
movwf safe_s ;save status(nibble swap, remember)
;----------------------------------------------
;Do Interrupt stuff here
;----------------------------------------------
clrwdt ;Clear the watchdog timer
End_int ;restore working vars
swapf safe_s,w ;fetch status, reswap nibbles
movwf STATUS ;restore status
swapf safe_w,f ;swap nibbles in preparation
swapf safe_w,w ;for the swap restoration of w
bcf INTCON,2 ;clear interrupt flag
retfie ;return from interrupt
;---end of Interrupt routine-----------------
;-----------------------------------
Port_init
;PORTA-------------------------
BANKSEL PORTA ;
clrf PORTA ;Init PORTA
bcf STATUS,RP1 ;Bank 1
BANKSEL TRISA ;
movlw b'00000000' ;All Outputs
movwf TRISA ;
;PORTB-------------------------
BANKSEL PORTB ;
clrf PORTB ;Init PORTB
bcf STATUS,RP1 ;Bank 1
BANKSEL TRISB ;
movlw b'11111111' ;All Inputs
movwf TRISB ;
retlw 0
;-----------------------------------
Timer_init
bsf INTCON,7 ;enable global interrupts
bsf INTCON,5 ;enable TMR0 int
bcf INTCON,2 ;clear TMR0 int flag
clrf TMR0 ;clear timer
clrwdt ;clear watchdog timer
movlw b'00000000' ;set up timer. no prescale
;set int to TMR0 not WDT
;portb pullups not enabled
option ;send w to option. generate warning.
clrf TMR0 ;start timer
retlw 0
;------------------------------------
; a short delay routine
;--------
Delay movwf tick
Delay_loop decfsz tick,f
goto Delay_loop ;w is not damaged, so Delay can
return ;be recalled without reloading
; Program starts here
;--------------------
Start call Port_init ;set port directions
call Timer_init ;start timer based interrupt
My_loop
bcf LED ;turn on led
movlw 0xFF
call Delay ;Run Delay, so you can see LED on
bsf LED ;Turn off LED
movlw 0xFF
call Delay ;Run Delay so you can see LED off
goto My_loop ;keep the program running!
end
;********************************************************
; Brutally simplified 16F84A BLINKY LED code
; blinks LED at approx 7 Hz
;********************************************************
list p=16f84A
include "p16f84A.inc"
ERRORLEVEL -224,-302,-305 ;supress compiler errors
__FUSES _CP_OFF & _WDT_ON & _RC_OSC & _PWRTE_OFF
;----------------------------------------------
Port_init
BANKSEL TRISA ;
movlw b'00000000' ; PORTA All Outputs
movwf TRISA ;
movlw b'00000111' ; TMR0 = 1:256 prescaler
movwf OPTION_REG ;
BANKSEL PORTA ;
clrf PORTA ; Init PORTA
Blinky_LED
btfss INTCON,2 ; wait for TMR0 overflow flag
goto $-1 ;
clrf INTCON ; (this is a 64mS delay)
movlw b'11111111' ; toggle all PORTA pins
xorwf PORTA,f
goto Blinky_LED ; keep blinkin'
end
by Jake Hertz
by Jake Hertz
by Jake Hertz
by Aaron Carman