PIC Programmer K150: Difference between revisions
No edit summary |
No edit summary |
||
(5 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
[[File:K150.jpg|200px|thumb|PIC K150 Programmer]] | [[File:K150.jpg|200px|thumb|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 [http://www.kitsrus.com/pic.html DIY Site] and download latest [http://www.kitsrus.com/zip/DIYpack25ep.zip DIYpack25ep.zip] file. Also you will need USB driver for K150 devices (which is different from recommended on DIY site) for [http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=225&pcid=41 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! | 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 [http://www.kitsrus.com/pic.html DIY Site] and download latest [http://www.kitsrus.com/zip/DIYpack25ep.zip DIYpack25ep.zip] file. Also you will need USB driver for K150 devices (which is different from recommended on DIY site) for [http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=225&pcid=41 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 == | == MPLabX == | ||
* Download [http://www.microchip.com/pagehandler/en-us/family/mplabx/ MPLab X] from Microchib website with [http://www.microchip.com/pagehandler/en_us/devtools/mplabxc/ MPLab XC8 Compiler] | * Download [http://www.microchip.com/pagehandler/en-us/family/mplabx/ MPLab X] from Microchib website with [http://www.microchip.com/pagehandler/en_us/devtools/mplabxc/ MPLab XC8 Compiler] | ||
* Select File->New Project->Standalone project | |||
[[File:Mplabx1.png|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 | |||
[[File:Mplabx-2.png|MPLabX - screen 2]] | |||
* Paste the following code into new file | |||
<syntaxhighlight lang="c"> | |||
/* | |||
* 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); | |||
} | |||
} | |||
</syntaxhighlight> | |||
* Window -> PIC Memory views -> Configuration bits (this can generate pragma headers for your C file) | |||
* Run -> Clean and build main project | |||
== DIY Software == | |||
[[File:Diy-k150.png|200px|thumb|DIY Software for K150]] | |||
* Run MicroBrn | |||
* Select right COM port (you can find it using device manager) | |||
[[File:K150-1.png|Windows 7 - Device manager]] |
Latest revision as of 08:00, 4 October 2014
About PIC Programmer K150
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
- Download MPLab X from Microchib website with MPLab XC8 Compiler
- Select File->New Project->Standalone project
- 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
- 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
- Run MicroBrn
- Select right COM port (you can find it using device manager)