Does the EPIC set the configs for you? If so, you may need to set them in the *.inc file for your setup when using the PicKit.
http://www.picbasic.co.uk/forum/showthread.php?t=543
Does the EPIC set the configs for you? If so, you may need to set them in the *.inc file for your setup when using the PicKit.
http://www.picbasic.co.uk/forum/showthread.php?t=543
Dave
Always wear safety glasses while programming.
Hi Dave,
I tried playing with the configuration string but I must be making a mistake, please look at my code. I'm sure its something simple that I have emitted or added that is wrong.
PS: I have to use MPASM as I am using windows 7 64 bit and PM gives an error that it cannot work oon 64bit.
]'************************************************* ***************
'* Name : SEROUT2.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2004 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 2004/05/24 *
'* Version : 1.0 *
'* Notes : TEST FOR PICKIT 2 WITH 16F877A *
'* : *
'************************************************* ***************
@ __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF
Define OSC 20 ' Set Xtal Frequency
trisd.0=0
COUNTER VAR BYTE
COUNTER=0
LED1 VAR PORTd.1
LED2 VAR PORTd.0
LED1=0
LED2=0
start:
pause 500
LED2=0
LED1=1
pause 500
LED1=0
LED2=1
SEROUT2 PORTd.2,84,["COUNTER=",DEC COUNTER,13,10] 'BAUD = 38400
COUNTER=COUNTER+1
goto start
END
´************************************************* **************
Regards
Chris
Hi,
Looking at your two files they are clearly different.
Importing SEROUT2.HEX into MPLAB and lookin at the disasambly listing it shows adress $00F6 being the last one used while ReadSEROUT2.hex shows adress $00FC and, obviosuly, the checksum are not the same. However the CONFIG bits seems to be set the same way in both example so I don't think that's the problem even though that WAS my first guess too (I might be wrong though).
What software are you using to run the PK2? Are you running it from within MPLAB, using the standalone application or the commandline interface? How are you telling the PK2 which the target device is? Have you tried reading back the code after it being programmed with the PK2?
/Henrik.
Hi Henrik,
I have used the cmd form from Microcode studio and the stand-alone app from microchip for controlling the PICKit2, both have the same problem. I tried what you said and read back my program. They are different at the end as you will see attached. I think there is a difference in crystal speed as the program is working but sending out rubbish or incorrect rate. The one LED also does not flash.
I am not using MPLAB, only MPASM v3.6
Regards
Chris
SEROUT2 PORTd.2,84,["COUNTER=",DEC COUNTER,13,10] 'BAUD = 38400
84 is 9600 baud and it is True mode. If you are connecting directly to a PC you will need to use Inverted mode.
Dave
Always wear safety glasses while programming.
Hi Dave,
That was my typo, I was messing with a RS232 converter chip to see if it was a problem with true mode and also with different speeds and forgot to change the comment.
It doesn't matter what mode or speed I choose I get either a dead program or just junk. Sometimes it only starts when I unplug the programming plug from the programmer.
Regards
Chris
I will assume you are not powering the chip with the PicKit?Sometimes it only starts when I unplug the programming plug from the programmer.
Is the chip still in the EPIC when you use the PicKit?
Maybe a picture of your setup?
Dave
Always wear safety glasses while programming.
Bookmarks