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.

Why do we need to switch to PIC 18

Status
Not open for further replies.

mvadu

New Member
Hi,

Can any of of you brief about the benefits of PIC18 series over PIC16. or if you can direct me to any of the microchip or any other link explaining the same should be fine..
 
I think the PIC18 is supposed to be much better at C (and maybe assembler too) than the PIC16.

Taken from:
https://www.picbasic.co.uk/forum/archive/index.php/t-1772.html
"Pic16Fxxx: Slow. If you want to make blinking lights it is fine

Pic18Fxxx: If you are gonna use a pic you might as well start using the Pic18 instead, they are just as cheap as the Pic16 and generally offer better bang for the buck. The biggest Plus is that you can download a 60 day trial of the MPLABS C18 compiler for free to work with Pic18."
 
mvadu said:
Hi,

Can any of of you brief about the benefits of PIC18 series over PIC16. or if you can direct me to any of the microchip or any other link explaining the same should be fine..

You don't 'need to' at all, it's completely optional - 16F series PIC's are already far faster and over specified for the majority of applications, an 18F just makes it more so.

Main advantage of the 18F is the free C compiler, and the instruction set optimisd for C.
 
If you are coding in pic assembler and have been using the earlier popular chips like 16F873-77 etc, then you no longer have to use PCLATH every time you want to go past the 1 k limit.
Also you have loads of ram, addressable in 256 blocks, which if set up correctly allows you access to the first 384 bytes without any additional bank coding.
 
The instruction set is richer and coding is obviously simpler. And a easier to handle banking scheme.

Priority for interrupts, whehn you know how to use them are a good thing too.

Having started with the 18F family a year ago, I don't see a reason to come back to the 16Fs
 
Last edited:
Microchip document AN716 explains the differences and shows how to migrate to the 18F range.
The benefits of migrating depends on what you want to use it for.
I like the feature that removes the need for bank switching with larger programs and also the extra oscillator functions such as the 4X PLL mode that can multiply the clock speed internally allowing faster operation (up to 32Mhz) with the internal oscillator or up to 40Mhz with a 10Mhz crystal.

Chips such as the 18F2550 are also very popular as they have a built-in USB port to allow them to be connected/programmed/debugged etc by a pc now that serial ports are being phased-out.
 
I bypassed the 16 series in part because the 18 series is not that much more expensive when buying small quantities.

Little did I realise just how much being able to write in C and use the USB connection for firmware updates was going to speed up the learning and development cycle. I can compile, download and be running a new version of the firmware in less than 15 seconds.

C also allows you to *slowly* be introduced to the oddities of the PIC architecture, whilst insulating you from many of the vulgarities. The 18F series, in particular the USB capable 28-pin 18F2455/18F2550 and 40-pin 18F4455/18F4550 have so much flash ROM (24K/32K respectively) that the larger code C produces is no problem, and you can build very complex applications.

I've been using the Microchip USB bootloader and code from the UBW project here: **broken link removed**

I was able to use this code to learn a great deal quickly, try some circuits without programming, and then finally use it as a framework for sending debug information up the USB port.

In short, I've had a *lot* of fun *and* been very productive very quickly :)

Paul
 
aussiepoof said:
C also allows you to *slowly* be introduced to the oddities of the PIC architecture, whilst insulating you from many of the vulgarities.
I found trying to find information about C programming for the pic difficult, especially with all the different compilers available.

I think personally its much better to understand it at its most basic level(asm),
so you can get an idea of what its doing behind the scenes.

Just my opinion though:D!
 
bitem2k said:
I found trying to find information about C programming for the pic difficult, especially with all the different compilers available.

I think personally its much better to understand it at its most basic level(asm),
so you can get an idea of what its doing behind the scenes.

Just my opinion though:D!

Mine as well - BUT on the 18F series MicroChip provide a free C compiler, and most of the application notes are in C.
 
bitem2k said:
I found trying to find information about C programming for the pic difficult, especially with all the different compilers available.
Microchip's C18 is completely free to use forever - the 60 day trial has some optimisations that are probably only important for critical or commercial applications. You can buy the full commercial version for those reasons, otherwise the free one has a good price... :)

I think personally its much better to understand it at its most basic level(asm), so you can get an idea of what its doing behind the scenes.

Just my opinion though:D!
I think this is true if you've not done much microprocessor/microcontroller programming in your time.

After 30 years of programming, from z80's to 68000's, PDP11, firmware, Unix kernels etc. etc. etc... I can live with abstracting the instruction set a bit :)

Also, don't confuse architecture with instruction set... they are inter-related, but one does not need to know a microcontroller's assembly language in detail to understand an architecture, whereas the reverse is not true :)

You were asking why we might want to switch to the 18F series... ease of use and productivity are excellent reasons. If you just want to learn microcontroller programming then the 16 series is more than enough, as Nigel has pointed out.

ALL of which is just my opinion :)

Regards,
Paul
 
Many times it is perhaps a question of addl facilities these modern chips provide. inter-merrits are btter described by the manufacturers. they certainly release at least 2new chips every month as they have to stand in market agaist their compititors. when customer demands incorporation of a newer chip either for marketing gimik or for economic or prevention of absolesence purpose, the designer may have to come up.

for instance 16F84 is almost outmoded and 16F628 /629 are freely available and littelcheaper too. later 16F88 price might comedown much lower- persons like Aussiepoof have worked thro' ages and are capable of playing with chips we admire them and also hats off to their hard learning over decades. some of us remaind in analog world and and are trying to use micros only now, so we start enjoying or suffering the porocess now at later parts of our lives.
 
I was dragged towards 18F basically because of USB capability. There are two 16C PICs with USB built in but they are OTP chips which are no use for learners. I am thinking to buy a PIC18F2550 and jump directly to the pool :). Please tell me can I use JDM style programmer to program these chips.
(I have self made JDM programmer with ICSP header 0V-5V-13V-PGC-PGD, i have a 40pin ZIF can connect these header outputs to any of the 40 pins)
 
aussiepoof said:
I think this is true if you've not done much microprocessor/microcontroller programming in your time.

After 30 years of programming, from z80's to 68000's, PDP11, firmware, Unix kernels etc. etc. etc... I can live with abstracting the instruction set a bit :)

I’m just getting started in this whole microcontroller game, but I see where you’re coming from.

I am experienced in programming high level languages, like c, c#,etc, but I'm only 21 and thus have not grown up around any severe hardware limitations (i.e. like early PC's). I have read a few early C books, and they talk about things like, having to make sure you have enough memory to hold a simple string, different memory banks etc:D! Before I started on the PIC, I thought that concepts like these were laughably outdated.
I stand corrected.

Anyway,
I WAS tempted to dive straight into C so I could bury my head in the sand about the :eek:ASM, but I’m finding the ASM experience very useful and rewarding (at the moment anyway!)
 
mvadu said:
I was dragged towards 18F basically because of USB capability. There are two 16C PICs with USB built in but they are OTP chips which are no use for learners. I am thinking to buy a PIC18F2550 and jump directly to the pool :). Please tell me can I use JDM style programmer to program these chips.
(I have self made JDM programmer with ICSP header 0V-5V-13V-PGC-PGD, i have a 40pin ZIF can connect these header outputs to any of the 40 pins)
You can indeed... you use it just once to program the bootloader, and from that point on the bootloader lets you use the USB to download the main firmware :)

Just connect the ICSP pins to the corresponding pins on the 18F2550 (see the datasheet for the pin numbers - I don't have them to hand.)

Take a look at the URL for the UBW project above... there's an example schematic, the bootloader, and some example source code in C.

Good luck!
Paul
 
bitem2k said:
I’m just getting started in this whole microcontroller game, but I see where you’re coming from.

I am experienced in programming high level languages, like c, c#,etc, but I'm only 21 and thus have not grown up around any severe hardware limitations (i.e. like early PC's). I have read a few early C books, and they talk about things like, having to make sure you have enough memory to hold a simple string, different memory banks etc:D! Before I started on the PIC, I thought that concepts like these were laughably outdated. I stand corrected.
Ahh... the good ol' days! LOL As I'm sure you're finding, it's not only very instructive to work within severe limits, but also very rewarding to see just how much you can do!

I find too that knowing assembler, understanding how to write operating systems (firmware is a smaller type of OS!), and knowing how compilers work is a real benefit even if you're writing C#. There will be times when your OS fails, your compiler fails, your libraries have bugs... despite how much money you pay for your development environment :) I believe that being a complete software engineer includes being able to debug your tools! Or at least realise they have a bug... ;-)

Anyway, I WAS tempted to dive straight into C so I could bury my head in the sand about the :eek:ASM, but I’m finding the ASM experience very useful and rewarding (at the moment anyway!)
Excellent! I find it's often hard to convince a younger audience of this. I blame cheap GB's of memory, 100's of GB of disk and multi-Ghz CPUs :)

Some figures for you: my first computer had 32KB of RAM and ran at 4Mhz. My first 5.25" HD was 10MB (yes, MB) and sucked 40W of power! My first multi-user Unix experience was on a 1 MIP computer with 1MB of memory for 50 users :) Oh, and it would crash every now and again, typically when other students had 30-60 mins of work unsaved in their editor. I seemed uncannily capable of predicting the crashes... very useful when working to a project deadline.

I crossed to the "dark side" of marketing and senior management about 15 years ago. Interestingly working with the PIC has rekindled my interest in writing code again. Wonderful chips eh?

Regards,
Paul
 
aussiepoof said:
Excellent! I find it's often hard to convince a younger audience of this. I blame cheap GB's of memory, 100's of GB of disk and multi-Ghz CPUs :)

Thats it, why bother trying to make things run extra efficiently when you've got no limiting hardware factors, and especially when speed is not critical.

aussiepoof said:
Wonderful chips eh?

indeed:D.
 
I learnt to program on the 16C series - yes thats a C not an F - I got a load of 16F72a in surface mount cheap - talk about diving in at the deep end.

Kind of good for me really as if I cocked it up then it cost me money - I made sure everything worked before it approached the OTP chip.

Now I use the 18F almost exclusively despite having a couple of hundred 16F series knocking around.

I've adapted the Microchip serial bootloader for use on the 18F1320 so it stays hooked up to the PC 24/7 while I'm coding and testing a new application takes seconds from compiling to seeing if it runs.

Main differences I've found with the 18F is the lack of paging/bank selecting (makes it a little more idiot proof), more memory, a few more instructions including a nice little 8x8bit hardware multiplier, self writing facility for program code (I know some 16F had this as well) and probably some other stuff I've forgotten in my haste to finish this post and get a beer ;)

I hate going back to 16F after using the 18F series.

Dom
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top