Ok, I've got my PICkit2 and a PIC16F54 hooked together, and, as my first program, I'm trying to get a LED to turn on. Nothing fancy, but I'm having problems. Ok, here's my code, with some comments;
Right, the PIC is on breadboard. Pin 4 is hooked to pin 1 on my PICkit 2 (the one with the arrow above it).
Pin 5 is hooked to ground, which is hooked to pin 3 on the PICkit.
Pin 12 is hooked to pin 5 on the PICkit.
Pin 13 is hooked to pin 4 on the pickit.
Pin 14 is hooked to +5V, which is pin 2 on the pickit.
Pin 15 is hooked to one side of a 2.4576 crystal, Pin 16 is hooked to the other. Each side of the crystal is hooked to ground (pin 3 on pickit) via a 22pF capacitor.
Pin 17 (RA0) is hooked to a LED, which is connected to ground via a 470 ohm resistor.
VDD is set to +5.0V in the PICkit software, the box next to it is checked
The/MCLR box in the PICkit software is unchecked.
The pickit has the Power and Target LEDs lit constantly, busy flashes while writing.
The code was assembled using MPLAB, then the pickit software was used to write the hex file to the PIC.
I'm leaning towards a hardware fault, as it is my first time using crystals, and I don't get error messages whilst assembling/writing the PIC. Thanks in advance.
Code:
;*****
;Alex E-S
;4/4/2008
;Version 1
;for PIC 16f54
;Clock 2.4576MHz
; Function: Turns LED on
list P = 16F54
include "c:\PIC\P16F5X.inc"
_config _RC_OSC & _WDT_OFF & _CP_OFF
;==========
;Declarations:
porta equ 05h
org 1FFh
goto Start
org 0
;==========
; Subroutines:
Init clrf porta ;Resets
; clrf portb ;I/O ports
movlw b'0000' ;Sets porta
tris porta ; as all outputs
; movlw b'00000000' ;sets portb
; tris portb ;as all outputs
retlw 0 ;resets working reg to 0
;==========
;Program Start
Start call Init
Main bsf porta,0 ;sets RA0 to 1 (+5v)
goto Main ;loops back to main
END
Right, the PIC is on breadboard. Pin 4 is hooked to pin 1 on my PICkit 2 (the one with the arrow above it).
Pin 5 is hooked to ground, which is hooked to pin 3 on the PICkit.
Pin 12 is hooked to pin 5 on the PICkit.
Pin 13 is hooked to pin 4 on the pickit.
Pin 14 is hooked to +5V, which is pin 2 on the pickit.
Pin 15 is hooked to one side of a 2.4576 crystal, Pin 16 is hooked to the other. Each side of the crystal is hooked to ground (pin 3 on pickit) via a 22pF capacitor.
Pin 17 (RA0) is hooked to a LED, which is connected to ground via a 470 ohm resistor.
VDD is set to +5.0V in the PICkit software, the box next to it is checked
The/MCLR box in the PICkit software is unchecked.
The pickit has the Power and Target LEDs lit constantly, busy flashes while writing.
The code was assembled using MPLAB, then the pickit software was used to write the hex file to the PIC.
I'm leaning towards a hardware fault, as it is my first time using crystals, and I don't get error messages whilst assembling/writing the PIC. Thanks in advance.