Hi
I am new to assembler programming and am trying to get a simple program up and running on a PIC12F675 using a PICKIT2
I have wired up the circuit using pins 1-5 on the PICKIT2 programmer according to this diagram:
PIN1 MCLR to PIC PIN4
PIN2 VDD to PIC PIN1
PIN3 VSS to PIC PIN8
PIN4 ICSPDAT to PIC PIN7
PIN5 ICSPCLK to PIC PIN6
PIN6 AUX to PIC PIN5 (not used?)
The problem is in the assembling of the code. My original code is:
processor 12F675 ;set the correct PIC type
GPIO EQU 05h
TRISO EQU 85h
ORG 0x000
GOTO MAIN
MAIN: BSF 03h,5 ;Go to Bank 1
MOVLW B'000000';Put 00110 into W
MOVWF 85h ;Move 00110 onto TRISO
BCF 03h,5 ;Come back to Bank 0
START: MOVLW B'111111';put 00001 into W
MOVWF GPIO ;move contents of W onto GPIO
;MOVLW b'000000';put 00000 into W
;MOVWF GPIO ;move contents of W onto GPIO
GOTO START
END
I use the following commands to assemble to code and upload/run it on the PIC12F675
; gpasm flash.asm --assembles the program
; pk2cmd -P pic12f675 -M -F flash.hex --burns the program to the MCU
; pk2cmd -P pic12f675 -A5 -T --powers the circuit at 5v
; pk2cmd -P pic12f675 -W --removes power from the circuit
; pk2cmd -PPIC12F675 -GF my_program.hex --retrieves program stored on MCU
; gpdasm -p12F675 my_program.hex > my_program.asm --disassembles program
The problem I have is that an LED attached to pin 2 (GP5) does not light up. I tried downloading the code and disassembling it which returns:
000000: 2801 goto 0x1
000001: 1683 bsf 0x3, 0x5
000002: 3000 movlw 0
000003: 0085 movwf 0x5
000004: 1283 bcf 0x3, 0x5
000005: 303f movlw 0x3f
000006: 0085 movwf 0x5
000007: 2805 goto 0x5
Does anyone know what the problem is? The only issue I can see is in address 000003 where it seems to be pushing the direction flag data to address 05h rather than the address 85h specified in my original program. I also got the error:
flash.asm:19:Message [302] Register in operand not in bank 0. Ensure bank bits are correct.
I have spent ages trying to figure this out and would appreciate any help you can offer...
Thanks.