Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Microcontroller newbie

Status
Not open for further replies.

Nick'

New Member
I am new to microcontroller and would like very much to learn about it. I am going to buy a PIC microcontroller and going to program it using C language. Can anyone tell me whether I can programme it without using the PIC programmer (PICKIT) . This is because it is expensive and i will have to wait for months to collect those money.
 
By the way, is MPLAB a compiler? Cant i use GCC compiler instead (with pic libraries)?
2. Is pic programmer necessary in order to program a PIC micro controller?
 
OK here is my thoughts. You need a PIC programmer of course to program PICs.

1. MPLAB is a IDE (BUT it has ASM built in which is technically being compiled)
2. ASM is a programming language.
3. If you want to program in C there are many choices.

For PIC10/12/16/18/32 ... well all pics in C you can use Hi-Tech compiler:
Embedded C Compilers and Tools for Software Development: HI-TECH Software

For PIC18F only you can use C18 which is best in my opinion... but im leaning toward Hi-Tech now.

You can debug using MPLAB sim but its no fun :( i suggest you get a PICKIT 2 or Bills Junebug.
blueroomelectronics - Smart Kits Build Smart People

i also suggest you learn to blink a LED in asm before starting with C. This will definitly help you in C. Because you will better understand loops and the way the PIC registers are accessed.

If i was you i would start with a PIC16F687 or a PIC18F2480.

Both contains SPI/I2C hardware built in. Which will help you connect to other devices like external eeprom, sensors, etc..
 
OK here is my thoughts. You need a PIC programmer of course to program PICs.

1. MPLAB is a IDE (BUT it has ASM built in which is technically being compiled)
2. ASM is a programming language.
3. If you want to program in C there are many choices.

For PIC10/12/16/18/32 ... well all pics in C you can use Hi-Tech compiler:
Embedded C Compilers and Tools for Software Development: HI-TECH Software

For PIC18F only you can use C18 which is best in my opinion... but im leaning toward Hi-Tech now.

You can debug using MPLAB sim but its no fun :( i suggest you get a PICKIT 2 or Bills Junebug.
blueroomelectronics - Smart Kits Build Smart People

i also suggest you learn to blink a LED in asm before starting with C. This will definitly help you in C. Because you will better understand loops and the way the PIC registers are accessed.

If i was you i would start with a PIC16F687 or a PIC18F2480.

Both contains SPI/I2C hardware built in. Which will help you connect to other devices like external eeprom, sensors, etc..

Nice one.
By the way, can i use GCC compiler to compile the c code and pass it to my PIC programmer? Or i have to use only hi-tech compiler?
Does MPLAB support C?

I just bought a cheap programmer compatible with PIC. It is only for programming, no debugging. Can I reprogram my PIC using this PIC programmer with C ? Or maybe ASM? I know C and basics of ASM(GAS & INTEL).
 
I don't know about GCC but both HiTechC and BoostC will work with MPLAB and both have free student version. I prefer BoostC but thats just a personal preference.

Also, there is the free version of C18 from Microchip, but that won't do the 16 series chips.

Mike.
 
Last edited:
I just bought a cheap programmer compatible with PIC. It is only for programming, no debugging. Can I reprogram my PIC using this PIC programmer with C ? Or maybe ASM? I know C and basics of ASM(GAS & INTEL).
Thanks guys
 
You don't say which one it is and so it's hard to comment. If its a serial one then maybe not.

Mike.
 
No, assembler is 'assembled' not compiled - a very different procedure.

Define Assemble:
1 : to bring together (as in a particular place or for a particular purpose)
2 : to fit together the parts of

Define Compile:
# roll up: get or gather together; "I am accumulating evidence for the man's unfaithfulness to his wife"; "She is amassing a lot of data for her ...
# compose: put together out of existing material; "compile a list"

Now from the definition they are in fact the same word. The outcome is the same from C to (ASM to HEX) so to me its the same. I know they do different things but it doesnt have to be so technical :D

Nick':
MPLAB supports C18, BoostC, Hi-Tech and others you just have to look around. But i would suggest any of those 3 since they are more common and you will receive better help if you use one of those.
 
Last edited:
You don't reprogam your PIC with any of those, you reprogram it with machine code, passed to the programmer as a HEX file. It makes no difference what compiler or assembler you use to generate the HEX file (as long as it generates it correctly of course.

Ic, So PIC runs with HEX. ok Then. By the way, after writing the HEX into my PIC, can I delete and write new instructions?
Here is my PIC programmer

The first 2 items on the list. Thank you.
 
Last edited:
Seems to be a Pickit 2 clone;

Compatible with Microchip's PICkit2

So i assume you can re-program pics with it.

EDIT:
Note: “Use Vpp First Programming Entry” is not supported by UIC00A. Therefore,
PIC16F88, PIC16F87, PIC16F818, PIC16F819, PIC16F62xA, and PIC648A that is
configured under condition (a), (b), and (c) is not supported by UIC00A:
(a) It uses the internal oscillator
(b) The MCLR pin is turned off to use as a digital input instead
(c) The program code enabled the Timer1 Oscillator in the TICON register.
Please avoid any of the condition above to ensure UIC00A compatibility for listed PIC.
 
Last edited:
The programmer you have bought will work with MPLAB and is both a programmer and a debugger. So, yes, you will be able to reprogram your chips. However, to use it as a debugger you will have to add a connector to your circuits.

Edit, Wow, US$14 for a pickit2 clone. Now, that is cheap.

Mike.
 
Last edited:
Define Assemble:
1 : to bring together (as in a particular place or for a particular purpose)
2 : to fit together the parts of

Define Compile:
# roll up: get or gather together; "I am accumulating evidence for the man's unfaithfulness to his wife"; "She is amassing a lot of data for her ...
# compose: put together out of existing material; "compile a list"

Now from the definition they are in fact the same word. The outcome is the same from C to (ASM to HEX) so to me its the same. I know they do different things but it doesnt have to be so technical :D

Why not just use the correct word in the first place? - and the dictionary definitions don't particularly apply exactly to the electronics/computer useage of the terms.

Basically a 'compiler' produces assembly code, and the 'assembler' then converts that to machine code - assembler is just a convenient 'human' method for describing the machine code, and requires no changing. A high level language, which has to be compiled, bears no resemblance to the machine code, and has to do a LOT of work 'writing' the equivalent assembler for you.
 
The programmer you have bought will work with MPLAB and is both a programmer and a debugger. So, yes, you will be able to reprogram your chips. However, to use it as a debugger you will have to add a connector to your circuits.

Edit, Wow, US$14 for a pickit2 clone. Now, that is cheap.

Mike.

What do you mean by "you have to add a connector to the circuits"? I don't really get it. Sorry, I am new.:)

Secondly, what is the differences between debugging and reprogramming?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top