PIC Programmer K150

From EnigmaGuy Wiki
Revision as of 08:00, 4 October 2014 by Enigmaguy (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

About PIC Programmer K150

PIC K150 Programmer

This device is obsolete and not compatible with MPLab X (new PIC development tool), so you will have to export files in HEX format from MPLab X and import to DIY application which has released last version in 2007. For small projects I believe this device for 9 USD from E-Bay (Chinese resellers) is fine but for more advanced development is recommended usage of PICKit 3. Before you will buy this device I strongly recommend you to visit DIY Site and download latest DIYpack25ep.zip file. Also you will need USB driver for K150 devices (which is different from recommended on DIY site) for Profilic USB to Serial converter. Please also be informed that Profilic USB to Serial converter mounted on K150 boards supports only Windows up to version 7. Windows 8 or Windows 8.1 won't work!

MPLabX

  • Select File->New Project->Standalone project

MPLabX - screen 1

  • Select Device->PIC16F630
  • Select Supported Debug Header: AC162052
  • Select Tool: Simulator
  • Select Compiler: XC8
  • Select project name: LED test
  • Click Finish
  • Right click on Source files -> New C Main file

MPLabX - screen 2

  • Paste the following code into new file
/*
 * File:   newmain.c
 * Author: mkonicek
 *
 * Created on September 7, 2014, 10:19 AM
 */

#include <xc.h>
#include <stdio.h>
#include <stdlib.h>
#include <pic16f630.h>
#define _XTAL_FREQ 4000000

// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.

// CONFIG
#pragma config FOSC = INTRCIO   // Oscillator Selection bits (INTOSC oscillator: I/O function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN)
#pragma config WDTE = ON        // Watchdog Timer Enable bit (WDT enabled)
#pragma config PWRTE = OFF      // Power-up Timer Enable bit (PWRT disabled)
#pragma config MCLRE = OFF      // RA3/MCLR pin function select (RA3/MCLR pin function is digital I/O, MCLR internally tied to VDD)
#pragma config BOREN = ON       // Brown-out Detect Enable bit (BOD enabled)
#pragma config CP = OFF         // Code Protection bit (Program Memory code protection is disabled)
#pragma config CPD = OFF        // Data Code Protection bit (Data memory code protection is disabled)

// Send bit to RA0
void changeled(int value){
    if(value==0){
        PORTA = 0x00;
    } else {
        PORTA = 0x01;
    }
    __delay_ms(1000);
}

int main(int argc, char** argv) {
    TRISA = 0x00; // Set PORTA as OUTPUT
    for(;;){
        changeled(0);
        changeled(1);
    }
}
  • Window -> PIC Memory views -> Configuration bits (this can generate pragma headers for your C file)
  • Run -> Clean and build main project


DIY Software

DIY Software for K150
  • Run MicroBrn
  • Select right COM port (you can find it using device manager)

Windows 7 - Device manager