Hi guys,
I’m new to PIC programming and to Assembly so bear with me please; I recently bought a kit which comprised the Velleman VM111 programmer and P16F627 and tried one of the demo applications which came with the software, and a couple of simple programs I adapted from online to learn assembly, which worked fine. I then adapted a sample program from a basic tutorial, assembled it with MPASM and wrote it to the microcontroller with Progpic2, and it worked… but somehow progpic2 can no longer communicate with the μc, so I can’t change the program, or even remove the program from the device. I’m totally stumped as to why, as I’ve also double-checked the configuration in progpic2.
I’ve since been advised by the creator of the tutorial that since I used the config settings he specified in his tutorial before changing them to the defaults given in the demo applications as seen in the code below, some poorly-designed programmers are unable to enter programming mode when the PIC’s internal oscillator is activated. Is the VM111 one of them?
The code I used:
;Hello chip program, adapted from http://www.winpicprog.co.uk/pic_tutorial1.htm.
LIST p=16F627 ;tell assembler what chip we are using
include "P16F627.inc" ;include the defaults for the chip
__config _BODEN_ON & _CP_OFF & _DATA_CP_OFF & _PWRTE_ON & _WDT_OFF & _LVP_OFF & _MCLRE_ON & _XT_OSC
cblock 0x20 ;start of general purpose registers
count1 ;used in delay routine
counta ;used in delay routine
countb ;used in delay routine
endc
org 0x0000 ;org sets the origin, 0x0000 for the 16F628,
;this is where the program starts running
movlw 0x07
movwf CMCON ;turn comparators off (make it like a 16F84)
bsf STATUS, RP0 ;select bank 1
movlw b'00000000' ;set PortB all outputs
movwf TRISB
movwf TRISA ;set PortA all outputs
bcf STATUS, RP0 ;select bank 0
Loop
movlw 0xff
movwf PORTA ;set all bits on
movwf PORTB
nop ;the nop's make up the time taken by the goto
nop ;giving a square wave output
call Delay ;this waits for a while!
movlw 0x00
movwf PORTA
movwf PORTB ;set all bits off
call Delay
goto Loop ;go back and do it again
Delay movlw d'250' ;delay 250 ms (4 MHz clock)
movwf count1
d1 movlw 0xC7
movwf counta
movlw 0x01
movwf countb
Delay_0
decfsz counta, f
goto $+2
decfsz countb, f
goto Delay_0
decfsz count1 ,f
goto d1
retlw 0x00
end
The error I keep receiving:
Naturally I’ve made sure the programmer’s set to program mode, the PIC is securely in place, and I used a program which previously worked fine (and made sure the config settings in progpic2 were correct).
Any help solving this problem would be greatly appreciated.