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.

The Art of Programming Microchips

Status
Not open for further replies.

Musicmanager

Well-Known Member
As the good book says ' It is easier for a man (or was it an elephant ? Much the same thing in my case) to pass through the eye of a needle than it is to pass into the kingdom of the microchip '

You build the breakout board, you connect the USB to Serial adaptor, because you don't have any serial ports anymore, you smile in anticipation, you wait .. .. and wait again .. .. . and then, yes, ... .yes .. ..yes ... Ah ! sorry this device is not compatible ! *********

OK let's try something else.. which language .. ASM, Microk, MicroK C, C C+, C++, CDM , I know, lets try a PIC .. they're supposed to be straightforward .. .. .. Obtain the programmer; download the MPLAB and the User Manual, all 274 pages; spend half the morning trying to install a driver for a piece of software 'you must have ' and then two pages further on ' except if you using *****, which I presume I am because it doesn't work !

Ah, I need a compiler - which one ? ranging from £0 to £****** .. .. any clues -- nope ! Ah, back to the user manual, that will tell me .. .. in your dreams boy !

I have never been so b******* confused in all my life !! I'm currently sitting on a sandwich and wiping my elbow with a piece of toilet roll !!

Do I want any help ??? Nope !! What I want is a first class plane ticket for South America, a tent and machete .. .. to hell with it ! :D

S
 
PIC's are fairly easy - particularly now.

Simply install MPLAB (pick the old MPLAB, and NOT the newer MPLABX, which isn't as easy), plug in your PICkit2 or PICKit3 and away you go.

Here's a Pickit2/3 veroboard layout for an 18 pin PIC, the Pickit simply plugs directly on the right angle pins at the left.

I'd suggest you use the 16F1287 as in the diagram, it's my PIC of choice now, as an enhanced 14 bit device (and is nice and cheap).
 

Attachments

  • 16F1827.png
    16F1827.png
    51.8 KB · Views: 258
Last edited:
MM if I can do pic anyone can..... what are you trying to do ? what hardware do you have , what code are you happy with ?
 
I know, lets try a PIC .. they're supposed to be straightforward .. .. .. install a driver for a piece of software 'you must have '

Ah, I need a compiler - which one ?

If you have something like a Pickit2 or 3 it is fairly straight forward, the compiler is included in MPLAB IDE, I believe Ver 8.92 is the last version.
The only 'hitch' I found is that Pickit3 especially you need to connect it in the sequence as per the info sheet or it shows a can't find pickit error.
Max.
 
I did a small introduction to MPLABIDE v8.xx..

https://www.electro-tech-online.com/articles/creating-projects-in-mplab-ide.582/

It shows how to run a project using MPABIDE Hi-tech( XC8 ) C compiler in "Lite" mode...

Once you create a project and a target you can step though and watch.... I know everyone said that its easy peasy.. Well it kinda is.. Once you successfully write, compile and burn your first chip, sit and marvel at your achievement, you will wonder why there was even the slightest struggle... The IDE does everything for you!!
 
If you program and test in the debugger mode, you can step through and watch the I/O and registers change.
The MPLAB manuals walk you through it.
One suggestion I have is if starting with Assembly on the 16f series to cut your teeth on, once proficient, gravitate to the 18f, they have much improved instr set/commands and quite a few other plus's.
Max.
 
MM! What programmer have you bought? Have you a pickit2? Have you tried Oshonsoft IDE?

There are a number of different compilers, quite a few are free, so no money outlay ( apart from the chip and board )
 
Joking apart, some of the guys here have given me some vital advice .. .. . and changed some of the software I was trying to use .. . which now means I've got a 'working set' of programs & devices .. .. . I may be in with a chance after all.

I'll have another go tomorrow .. ..

IR .. .. Thanks for that, I'll have a good look at it .. .

S
 
Programmer .. ..

See attached pic ...ture :)

I built some timers last year for my son using a 16f628a in a kit that came with .hex so all I had to do was load it, so I bought this K150. Has not given me any problems so far ..

S
 

Attachments

  • PIc Programmer 1.JPG
    PIc Programmer 1.JPG
    947.4 KB · Views: 244
I downloaded the all the tutorials from NG's Winpicprog last night and went through them .. I think I can succeed with those OK .. ..

My problem so far has been to get hardware and software and computers to shake hands with one another and adopt that americanism .. ... togetherness !

But I swapped MPLAB X IDE for MPLAB IDE which I can follow; and I've got a breakout board that connects via USB without any problem; I've ordered the bits to build most of NG's practice boards .. ... ..

and I've also bought an Arduino this afternoon. It's in a hard plastic case ... I thought if I can't get it to work I can always bite hard on it ! :)

Is that programmer OK ?

S
 
Is that programmer OK ?
Yes! For the midrange... Trouble is I have migrated to the enhanced range...

The pic16f887 has replaced the pic16f877... Much cheaper ( I buy many )
The pic18f45k20 has replaced the pic18f4520 ( My main processor )
The pic12f1840 is my new pic12f675.....

All these newer chips are far superior in every respect..
I have recently used pic16f1825 / 8 / 9... These are awesome... The pickit2 has taken a bit of a back seat as the pickit3 is needed for the majority of new chips..

All the pic32's need the pickit3.

BUT!!!! As you are starting out and will probably use the pic16f628a... Good choice..

I have the Arduino setup and have used the Uno in several projects...I upgraded them to netduino as I was learning C# at that time.. I wouldn't use Arduino nowadays, not even to flash an LED...
 
I have both the Pickit 2 and 3, I still use my Pickit2 for compatible μp.
The stand alone programmer and Usart diagnostic & Logic tool is a nice feature which unfortunately they did not carry over to the Pickit3.
The now well known
Max.
 
Yes, I can see that is all fair comment. At the time when I bought that K150 I was going to program 8 or 10 16f628a's and then not do anything more .. I didn't realise then that electronics would become such a fascinating hobby ... and as you say, it will do to start the journey.

If I get to advance and need to update the programmer you won't be able to silence my delight !

The arduino is really to try out with a stepper motor project I can't complete .. not much more ..

Thanks for your help Ian .. .
Actually .. Thanks for your help everyone :)

S
 
The PICkit 2 or PICkit 3 are by far the best choice in reasonable cost PIC programmers. People who try to make the JDM and othe designs find themselves on a quest to find a laptop with a serial port to make the beasts run, or to find the mythical USB adapter that's supposed to work. Their hobby becomes the quest, and the original goal of actually loading a program to a PIC becomes a hazy memory.

One under-appreciated option for the PIC18F-series parts is Swordfish Basic. Easy to use (although the newer K-series parts can be a bugger), generates fast code, and the "special edition" is a free trial version. The limits on it are so generous that some people never even need the paid version.
 
MM You know MPLAB will compile a .hex file from your .asm code for you , just find it and send to your programmer , cause you do ... ( I always try to include a startup led on an IO pin so I can see code is running )
 
Ok, you have a Pic set up at the moment and lots of suggestions for following that line; like many thats the way I started too.

It means having to / or ending up, building or buying quiet a complex dev board, buying a programmer, ideally a Pickit to ensure you can program most chips, and decide on which IDE /complier you need to use.

Why not spend all of £4 on a Ardunio clone like this one and have a go with C++ programming, its a different world from the Pics.
Nothing more to buy, its complete with USB cable, inbuilt serial monitor/bootloader , free ide with masses of examples and masses of online free tutorials and a large active user forum.
Ok, its not rocket science but you can soon get things running and there is a natural follow on if you want to move to more complex work.
Importantly it is literally plug and go, and perhaps simply put , more fun.:happy:
**broken link removed**
 
Hi Wp

Thanks for that .. .. I have exactly that Arduino on the way in the post now .. .. .ordered a couple of days ago with exactly the thought you're commending ..

However, as you rightly say, it's a different world from the Pics and I think I want to explore both in their own context .. .. If I live long enough I'd like to explore several of the programming languages and contexts but for me 3 score and 10 may not be enough !

With some guidance, I've made a few discoveries in the last 24 hours that do put yesterdays problems into a tunnel with a light at the end of it .. and just maybe .. .. . the tent will have to wait a while longer :)

Thanks for your help

S
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top