# question about k150 DIY PIC programmer

#### hunterage2000

Joined May 2, 2010
487
I have recently bought a k150 DIY PIC programmer and used it with JALEDIT and microbrn.exe by micropro. I have downloaded MPLAB X and xc8 compiler but when setting up a new project, at step 4 hardware tools my k150 isnt there. I have a 6 pin socket (NC, PGC, PGD, GND, VCC and VPP),

do these have to be connected to be recognised by MPLAB? if so where are they connected?

#### spinnaker

Joined Oct 29, 2009
7,835

2. Take the programmer and place it carefully in the bottom of the can.

3. Take the trash can outside and dump it into your outside trash can to be collected.

4. Go buy a PicKit 2 or PicKit 3 from Microchip.

The programmer from microchip is only around \$30. Why would you buy anything else?

Your programmer is not supported by MPLAB. You will need to do your programming with the software that comes with the programmer. You will need to produce a hex file with mplab then use that in the software. I doubt you will even be able to debug with it, another HUGE advantage of the Microchip programmers.

The lines you are talking about are the ICSP lines. They are used by the programmer to program the chip but are also used for debug assuming you have a supported programmer.

#### t06afre

Joined May 11, 2009
5,934
I have recently bought a k150 DIY PIC programmer and used it with JALEDIT and microbrn.exe by micropro. I have downloaded MPLAB X and xc8 compiler but when setting up a new project, at step 4 hardware tools my k150 isnt there. I have a 6 pin socket (NC, PGC, PGD, GND, VCC and VPP),

do these have to be connected to be recognised by MPLAB? if so where are they connected?
It is perhaps somewhat harsh to recommend dumping your new programmer. Anyway the k150 can not be used from MPLAB. So you have to compile your program in MPLAB. Then use whatever tool you have to load the hex file and do the programming. If I remember correct you have 16f887 chip.

This is how you will connect for programming. I will recommend that you do the programming in circuit. You will very quickly damage your chip if you take it in and out of circuit for programming. Note your PIC has 2 set of VDD/GND pins. All of those must be connected

#### spinnaker

Joined Oct 29, 2009
7,835
It is perhaps somewhat harsh to recommend dumping your new programme
I's a lot more cruel to encourage the OP to go forward with a headache creator. The OP is not even sure if the device was assembled correctly nor how reliable it is going to be.

I searched for Dave's blog on EEV where he mentions these things but can't find it. His words were pretty much the same on the programmers. A waste of time and money.

I like to get the truth right between the eyes. Initially it is painful but it is over quick.

#### hunterage2000

Joined May 2, 2010
487
Yeah my chip is the PIC16F887A and the programmer is a DIY k150. I have tried debugging a program but a screen with Hardware tools comes up and at the top it says "Real ICE not found" so I cant check for errors. Is there a way around this? if not can someone recommend more compiler options that uses C. I tried Bloodshed Dev C++ but I couldnt save as a .hex file

I do have JALEDIT working with the PIC but I would rather work with C.

#### t06afre

Joined May 11, 2009
5,934
Yeah my chip is the PIC16F887A and the programmer is a DIY k150. I have tried debugging a program but a screen with Hardware tools comes up and at the top it says "Real ICE not found" so I cant check for errors. Is there a way around this? if not can someone recommend more compiler options that uses C. I tried Bloodshed Dev C++ but I couldnt save as a .hex file

I do have JALEDIT working with the PIC but I would rather work with C.
Debugging is something you do then your program is free from C syntax errors. The compiler will not create a hex file before this. You do not save as a hex file. You compile and if no errors your hex file will be created. Have you written any C code so far for testing, and does this code compile correctly without any errors. That should be your first goal

#### hunterage2000

Joined May 2, 2010
487
I got a bit sick of trying to get MPLAB to work so I downloaded PICbasic Pro using BASIC langauge. So with the k150, does it need to be powered with the 6 pin socket? if so what is VPP, PGC and PGD and where are they connected to? I've searched the net for answers which are there but I just cant make out what its saying.

With Jaledit when you compile the .jal file it scanned the file for syntax errrors then created a .hex file along with it. I used Micropro to upload the .hex file and I didnt need to use the 6 pin socket, just the usb connection.

The K150 is attached as an image.

#### Attachments

• 28.4 KB Views: 133

#### takao21203

Joined Apr 28, 2012
3,702
When I built this PIC programmer, I also had various questions covering the gist and hest about ICSP, the power supply, and the RS232 connection.

I used a schematic but that was extraordinary bad, so I added components.

It was clear before I built it that there is no debugging, and it only can program a few PICs.

Unfortunately there are not really any good websites "How to build a really useful PIC programmer", including information how to actually use it.

Most people don't build PIC programmers.
Most people use a programmer that's supported by MPLAB, that's the only way to use modern PICs.

#### Attachments

• 214.6 KB Views: 94

#### hunterage2000

Joined May 2, 2010
487
The k150 works with jaledit and micropro programmer but I wanted to program in C but MPLAB doesnt work, device manager doesnt show Microchip tools and when creating a project the k150 isnt shown.

Now I am trying BASIC programming with PICBASIC PRO which I have created the .bas file and the .hex for a blinking light but it isnt working and I dont get why this code sets port B0 as the output.

Rich (BB code):
mainloop:
High 0
low 1              ' Turn on LED connected to PORTB.0
Pause 500       ' Delay for .5 seconds

Low 0
high 1             ' Turn off LED connected to PORTB.0
Pause 500
' Delay for .5 seconds

Goto mainloop   ' Go back to loop and blink LED forever

End

#### nigelwright7557

Joined May 10, 2008
532
I still use an old Microchip PICSTART !
No messing about with ICSP just plug the chip in and MPLAB programs it.
You can remove and insert a chip in circuit many times before the socket dies if you are careful.

#### spinnaker

Joined Oct 29, 2009
7,835
The k150 works with jaledit and micropro programmer but I wanted to program in C but MPLAB doesnt work, device manager doesnt show Microchip tools and when creating a project the k150 isnt shown.

Now I am trying BASIC programming with PICBASIC PRO which I have created the .bas file and the .hex for a blinking light but it isnt working and I dont get why this code sets port B0 as the output.

Rich (BB code):
mainloop:
High 0
low 1              ' Turn on LED connected to PORTB.0
Pause 500       ' Delay for .5 seconds

Low 0
high 1             ' Turn off LED connected to PORTB.0
Pause 500
' Delay for .5 seconds

Goto mainloop   ' Go back to loop and blink LED forever

End
That does not look right to me at all.

Take a look here.

You need to specify the Port when making a call with high or low.

High PortB.0
Low PortB.0

I know this is a matter of pride and all and maybe a little bit of money but believe me that programmer is not worth the hassle. You are dealing with an unknown. You have no idea how well that programmer works,if at all or how well it will work into the future.

As a beginning programmer it is hard enough dealing with just learning pics, the last thing you need is dealing with a programmer that may or may not wok.

#### t06afre

Joined May 11, 2009
5,934
Here is a simple program that will blinks LEDs on PORT D. Remember to use a series resistor then connecting the LED to the port pin, 330 ohm will be fine. In MPLAB create a new project and use this code. The program is set up to use the internal oscillator so no crystal will be needed.
Ps. If you do not know how to create a project look here. The program will not compile else. http://microchip.wikidot.com/mplab:how-to-create-a-standalone-project
Rich (BB code):
/*
* File:   hello world.c
*
* Created on 11. november 2012, 13:52
*/

// PIC16F887 ConfiguratioBit Settingsn

//#include "htc.h" //for hi-tech c compiler 8.x
#include "xc.h"
// PIC16F887 ConfiguratioBit Settingsn
__CONFIG(FOSC_INTRC_NOCLKOUT & WDTE_OFF & PWRTE_OFF & MCLRE_OFF & CP_OFF & CPD_OFF & BOREN_OFF & IESO_OFF & FCMEN_ON & LVP_OFF);
__CONFIG(BOR4V_BOR40V & WRT_OFF);
#define _XTAL_FREQ  4000000
int main(void)
{
ANSEL=0b00000000;//Turn off analog functions
ANSELH=0b00000000;//Leave this as is til the day you need analog functions
TRISD=0b00000000; //We are going to use PORTD as output
PORTD=0xff;
while(1)
{
PORTD=~PORTD;
__delay_ms(1000);
}
}