Continue to Site

# 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.

#### blueroomelectronics

##### Well-Known Member
You can learn for free using MPLAB, C18SE & the MPLAB simulator. All free. In the long run you'll need a programmer like the PK2

#### Nick'

##### New Member
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?

#### birdman0_o

##### Active Member
They haven't developed telepathic methods... yet.

Last edited:

#### blueroomelectronics

##### Well-Known Member
1. MPLAB is an IDE
2. You need a complier that supports the PIC you want to use.
3. You need a programmer.

#### AtomSoft

##### Well-Known Member
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..

#### Nigel Goodwin

##### Super Moderator
1. MPLAB is a IDE (BUT it has ASM built in which is technically being compiled)

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

#### Nick'

##### New Member
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).

#### Pommie

##### Well-Known Member
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:

#### Nick'

##### New Member
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

#### Pommie

##### Well-Known Member
You don't say which one it is and so it's hard to comment. If its a serial one then maybe not.

Mike.

#### Nigel Goodwin

##### Super Moderator
Thanks guys

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.

#### AtomSoft

##### Well-Known Member
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

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:

#### Nick'

##### New Member
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:

#### AtomSoft

##### Well-Known Member
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:

#### Pommie

##### Well-Known Member
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: #### AtomSoft ##### Well-Known Member yeah i was thinking the same heh I might make a few clones for PIC18F chips only and sell it for cheap. #### Nigel Goodwin ##### Super Moderator Most Helpful Member 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 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. #### Nick' ##### New Member 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?

#### AtomSoft

##### Well-Known Member
TO DEBUG:

Reprogram is like updating. Once you debug a program and are complete you program it to the IC. Now you can run the program with no PC. Now if you alter the code and add/remove some stuff from code you need to re-program the IC.

Status
Not open for further replies.

Replies
2
Views
1K
Replies
11
Views
2K
Replies
4
Views
1K
Replies
12
Views
2K
Replies
4
Views
801