Where does Pic18F452 fit in ?

manie

Senior Member
How can you compare the 18F452 to say the 40x1/40x2 ? Besides 16K program memory and PLCQ(??) pin-out configuration, how else does it differ and is it really THAT powerfull ?

Also, can the PE (compiler??) be used with it ? I need some ammo as I want to defend my choice of chip (Picaxe).
 

Andrew Cowan

Senior Member
40x1 at 4MHz = around 1-4 commands per milliseconds.

18F452 at 4MHz = around 4000 commands per millisecond.

Increase the clock speed and the number per second increases.
 

lbenson

Senior Member
But ... one 18F452 instruction does not equal one picaxe instruction. "readtemp 0,b0" executes many instructions at the raw assembler speed of the pic micro underlying the picaxe.

You can probably get about 4000 more or less high level instructions per second on an 08M at 4mHz, so you might get 40,000 on a 40mHz 40X2. Part of the issue involves the question of what is fast enough for the task at hand.

For most hobbiest use, where we're not trying to hit a bullet with another bullet, some version of picaxe is likely to be sufficient. Where it's not, some other microprocessor will give execution speed increases--but at a great increase in the time it takes to write and test the program.
 

MartinM57

Moderator
18F452 at 4MHz = around 4000 commands per millisecond.
Srsly?

At a 4Mhz clock, there are 4000 clock ticks per millisecond, so unless your writing in a language where each command takes 1 cpu cycle....

I don't know PIC ASM at all, and although they maybe some single cpu cycle commands (NOP maybe :)), I suspect they are in the minority.

Also, PICAXE timings have been discussed many times - do a search or see see http://www.picaxeforum.co.uk/showthread.php?t=10821&highlight=instruction+timing for example

EDIT: I've just looked on the Googlebox and it seems that most PIC MPASM commands take one instruction cycle which takes 4 clock cycles (except a branch which takes 2 and 8 respectively)
 
Last edited:

womai

Senior Member
40x1 at 4MHz = around 1-4 commands per milliseconds.

18F452 at 4MHz = around 4000 commands per millisecond.

Increase the clock speed and the number per second increases.
Actually, the PICs take 4 clock cycles per instruction (except for jumps and branches which take more), so you get roughly 1000 assembler commands per millisecond at 4 MHz clock.

It's correct to say that many Picaxe commands are equivalent to a large number of assembler instructions. I have a few projects that started out with a Picaxe for proof-of-concept and that I then moved over to the equivalent PIC programmed in compiled C (which is very close in performance to assembler). Depending on the application the speed improvement was somewhere between a factor of 5 and a factor of 200, in most cases more towards the low end. So in a nutshell, the speed improvement is usually less than what you would expect.

What does improve a lot is execution timing control. The Picaxe's execution speed for a specific piece of code os dependent on several things not under my control (even changing an unrelated piece of code can have influence), while the raw PICs timing is rock-stable. For slower code you can of course remedy that to some extent by using the hardware timer etc., but if you need top speed then this becomes an issue.

By the way, the PIC18F4520 (or 2520 for the 28-pin version) is a great device with plenty of code space, plenty of RAM (1.5KB) and still pretty easy to use. (for my latest project I am using a dsPIC30F2020, and man, this is hell of a complicated device! Took me several days to get interrupts going, which was a 10min exercise on the 16F series).

Wolfgang
 

hippy

Ex-Staff (retired)
How can you compare the 18F452 to say the 40x1/40x2 ?
That's quite hard to do because it depends on what sort of comparison you want, in what sort of terms. What you are actually comparing is blank PICmicro hardware with a pre-programmed PICAXE running interpreter Firmware.

Sort of like asking : How can you compare apples and oranges ?


Also, can the PE (compiler??) be used with it ?
No.


I need some ammo as I want to defend my choice of chip (Picaxe).
That primarily comes down to ...

* Will it do the job ?
* How long will development take ?
* How easy is development, debugging and future maintenance ?
* What is the cost of development and debugging ?
* What is the cost of the tool chain ?

There's a lot more such as what support and help there is, what skills developers already have, but "cost" and "time" are usually up at the top of the list, "quantity" can affect that.

In my experience you can often have a PICAXE project assembled and running code before you have even worked out how to configure and use the tools for using something else.

But it's not a simple question of which is best as that depends on criteria and which of those criteria are most important. It also depends if it's a small quantity project, just for particular projects or you're choosing a device which all future projects will have to use.
 

BeanieBots

Moderator
How can you compare the 18F452 to say the 40x1/40x2 ? Besides 16K program memory and PLCQ(??) pin-out configuration, how else does it differ and is it really THAT powerfull ?

Also, can the PE (compiler??) be used with it ? I need some ammo as I want to defend my choice of chip (Picaxe).

More to the point, how can YOU compare them?
Can YOU program a 18F452? Can YOU prgram a 40X2?

If your answers are no to the first and yes to the second, then the PICAXE comes out as a very clear winner. Let's face it, a blank 18F452 is not very 'powerful' is it?
 

Dippy

Moderator
"In my experience you can often have a PICAXE project assembled and running code before you have even worked out how to configure and use the tools for using something else."
- ABSOLUTELY!

"What is the cost of the tool chain ?"
- what on Earth does that mean? Can you translate for us thickies (i.e. me) please.
It reminds me of Civil Servants doing Executive Speak to impress the onlookers :)
School For Scoundrels was a great old movie.


"I need some ammo as I want to defend my choice of chip (Picaxe)."
- do you mean you are trying to justify the cost (to a client) of (a) You-programming-PICAXE or (b) a Pro-programming-PIC , or (c) You-programming-PIC?

All I'll say is that if you have to ask if PE can programme an 18F452 then it'll take you months to do code using a Compiler.
And if if you have to say 18F452 then you're showing your age ;)

And don't forget the Forum Help.
You've received tons of help (and micky taking) over the last months - all free of charge and all fairly quickly with good-ish humour.

I recently looked at another Forum where a PICAXEr has taken the plunge. I've seen the questions and the replies from people.
Believe me Manie, if you'd asked your questions on that Forum you would have had few replies and most would have been slightly abrupt.

Just think for a moment, your development time has probably been halved by the people on this Forum - after all, you'd still be wondering how to drive a MOSFET...
So, the assistance must also count towards the final choice I would have thought?
 

hippy

Ex-Staff (retired)
"What is the cost of the tool chain ?"
- what on Earth does that mean? Can you translate for us thickies (i.e. me) please.
Fair point : The tool chain is the set of tools, hardware equipment and software programs, which are required to develop and program, usually used sequentially hence 'chain' - Edit, Compile, Download, Debug.

For the PICAXE this is, the Programming Editor or AXEpad ( and USB driver if using AXE027/USB010 ), plus the download cable and the PICAXE and board to be programmed. The software development environment is integrated within the Programming Editor or AXEpad and pre-configured. Everything accessed by simple mouse clicks with minimal setup required.

For others this may be a more complicated or less integrated set of tools. Install an IDE ( Integrated Development Environment, a graphical interface the equivalent of Programming Editor - if there is one ), install compilers and configure the IDE to use them. Compile the code, install another program to get code into the actual chip, install other programs to view debug or serial output or to simulate. In some cases one may need to install and configure a 'complete development environment' such as MinGW or Cygwin. On the hardware side one may need a specialised / particular hardware programmer or it may require removing the chip from its hardware to program it.

The PICAXE software tools are provided free of charge. Others may require software to be purchased and may require different purchases depending upon which chips are being used or require periodical license fees to keep using the tools or to get bug fixes. Some may require considerable research to determine exactly what is needed and there may be no centralised support for the set of programs used.
 
Last edited:

hippy

Ex-Staff (retired)
Microchip's Status on the 18F452 is "Not Recommended for new designs". Now how the other million or whatever PICmicro variants compare to the PICAXE ... ;-)
 

womai

Senior Member
If I had to justify the use of a Picaxe (over a "normal" PIC) to a client, how about the following argument:

- Picaxe is based on normal Mircrochip device; so hardware-wise, if you get it working on a Picaxe, it is guaranteed possible to port it onto a PIC later if necessary, since the hardware is identical (e.g. 28X1 can be substituted with PIC16F886). The same is not true e.g. for the Basic Stamp.

- But Picaxe - being very simple to use - will get you a working circuit much faster and with much less effort, that leaves more time to work on further improvements etc. That's especially true if the application is a good fit for the Picaxe's advanced features like I2C, one-wire etc. - from my own experience I can tell that what takes minutes to get going on a Picaxe can take hours or days on a normal PIC.

There's nothing better than a working prototype that you can feel and touch and play with in order to get the wrinkles out of your concept (often things that you failed to see during the theoretical design).

And many times the Picaxe will just work fine in the application, with no need to move to raw PICs.

Wolfgang
 

manie

Senior Member
Lots of good points there. The reason I asked was I got involved in an argument with an older "professional" who has ready made project boards (looks quite good actually) that uses the 18F Pic. It apparently has 16K program memory and then off course is slightly faster. On my question as to Basic programming his answer was "yes", but later admitted that it cost him +- 2000 Pounds(Brittish...) and that it chews up a lot of memory. The discussion also went on to usefullness to students at Technicon level etc. This is where I dug my heels in and said for education NOTHING can beat a Picaxe. Period. So I thought I'd better ask here, "just in case I was wrong...". I believe I was right though.

Thanks for the response, and Dippy yes, Africa is not a continent for sissies..... we can do anything here, including watching the sublimation of Mosfets......;)
 

BeanieBots

Moderator
Manie, the proof is in the doing.
Set him a challenge.
Something very simple on a PICAXE such as:-

Read two pots and a DS18B20 temp sensor.
Display the results on a serial LCD (AXE033 or similar)
but ONLY when a particular Sony IR signal has been received.
Send the received IR code out after a 10 second delay.
Then swap a few pin assignments and see how long it takes to change.

Should take you less than an hour to code that.
Bet it takes him SERIOUSLY longer.

I've chosen those particular commands for very good reasons.
PICAXErs have the luxury of taking them for granted.
 

hippy

Ex-Staff (retired)
Key is, whether the work's been done for you or you have to crack open numerous specs and work from first principles, debugging and testing as you go. I'm sure some other systems are as usable as a PICAXE and - importantly - vice versa.

Many of the advanced or professional programmers and software engineers on this forum, and out on the web, still choose to use a PICAXE when they are well capable of using anything put in front of them. Albeit not exclusively, but it is very often that PICAXE is their preference. Not many processors attract a following from those who have no previous experience through to top-end professionals.

When you have Michelin Chefs eating at the burger and chip bar it must have merit beyond cheap and cheerful :)
 

manuka

Senior Member
Manie - your "education" comment reminds me of the considerable flack I encountered (~2002-3) when first introducing PICAXEs at tertiary level here in NZ. Most students naturally loved them, but peer reviewers mumbled that "they make things too easy". Such comments were predictably from those who'd spent days/weeks with raw micros (& low level coding) trying to drive a stepper etc. Many considered that the next generation should put in the learning hard yards too- even if the approach was no longer cost effective.

My view was (& remains) that when learners become enthusiastic and rewarded by working circuitry,their overall motivation towards electronics improves. Only THEN will most usually strive. Relate this to say the slog involved in getting ones pilots license- even a quick airfield spin will act as a great motivator!

Those with similar experiences to my own will no doubt confirm tertiary engineering dropout rates can be exceedingly lamentable. There's no single reason for this of course (although MANY are on offer), but " far too much theory with way too little meaningful hands on practical" is a common complaint... Stan.

EXTRA: How DID your wireless chook-house work out!?
 
Last edited:

manie

Senior Member
OK guys, OK ! I'm not to be converted here, someone else who has never even heard the phrase "Picaxe" must come round !!:D

The ease of proramming "in-circuit" wasmy main contentender in the bout, for this he could offer "all you have to do is just bring up the chip to 13V, maybe even at 12.5V, and it is in programming mode..." to which I obviously returned with "just plug in your USB cable while the programming is running, hit your reset button if you're in a hurry, and watch the download....", he could only say "USB ?? Really ??". I do think however, he is already converted....

Stan: RF tests were run here live, with 100% error-free results ;), I am still very impressed with these Polygon units. They were called "a tad deaf..." here a while back but I can't spot that yet. The installation is being completed tomorrow (Saturday). The electric fence here did prove to be a problem, but NOT with the RF.... the DS18B20's were badly affected :eek:, probably spikes or something. I've now switch to LM35DZ's because the ADC (from battery monitoring and Honeywell/Rev-Ed Humidity sensor) does not seem to be affected. I've also now de-coupled the 5V and signal lines as per 35DZ datasheet plus nice screened instrument cable etc. We'll see tomorrow....
 

manie

Senior Member
Never mind. PICAXE rules eh
At last he admitted it !!!!:rolleyes:

And you're WRONG ! I do not know much, I know ZERO/NADA about programming Pics... but "Just you wait Henry Higgins, just you wait....";)

Hey, its almost 1:00 AM here, aren't you kipping some ?
 

boriz

Senior Member
“All I want is a room somewhere,
Far away from the cold night air,
With one enormous rack of instruments, including a hi frequency digital storage oscilloscope, spectrograph, function generator ... “
 

Dippy

Moderator
Manie, it's so easy... or should I call you Eliza? :) Yes, I had an education too!

The LVP bit configuration register CONFIG4L enables
low voltage ICSP programming. This mode allows the
microcontroller to be programmed via ICSP using a
VDD source in the operating voltage range. This only
means that VPP does not have to be brought to VIHH,
but can instead be left at the normal operating voltage.
In this mode, the RB5/PGM pin is dedicated to the programming
function and ceases to be a general purpose
I/O pin. During programming, VDD is applied to the
MCLR/VPP pin. To enter Programming mode, VDD must
be applied to the RB5/PGM, provided the LVP bit is set.
The LVP bit defaults to a (‘1’) from the factory.

Note 1: The High Voltage Programming mode is
always available, regardless of the state
of the LVP bit, by applying VIHH to the
MCLR pin.
2: While in low voltage ICSP mode, the RB5
pin can no longer be used as a general
purpose I/O pin, and should be held low
during normal operation to protect
against inadvertent ICSP mode entry.
3: When using low voltage ICSP programming
(LVP), the pull-up on RB5 becomes
disabled. If TRISB bit 5 is cleared,
thereby setting RB5 as an output, LATB
bit 5 must also be cleared for proper
operation

If Low Voltage Programming mode is not used, the LVP
bit can be programmed to a '0' and RB5/PGM becomes
a digital I/O pin. However, the LVP bit may only be programmed
when programming is entered with VIHH on
MCLR/VPP.
It should be noted that once the LVP bit is programmed
to 0, only the High Voltage Programming mode is available
and only High Voltage Programming mode can be
used to program the device.
When using low voltage ICSP, the part must be supplied
4.5V to 5.5V, if a bulk erase will be executed. This
includes reprogramming of the code protect bits from
an on-state to off-state. For all other cases of low voltage
ICSP, the part may be programmed at the normal
operating voltage. This means unique user IDs, or user
code can be reprogrammed or added.


Or, to cut it short as I know you won't read that lot:
For ICSP use a programmer.
For PICAXE-like programming, bootload it first then programme it serially using Tx/Rx.
(Which will require a MAX232 or transistor inverter circuit)
Of course, you'll need a programmer to chuck in the bootloader - oh dear!
Still not as easy/inexpensive - so stick to PICAXE.
 

BeanieBots

Moderator
he could only say "USB ?? Really ??
I'm not surprised. I think many people would be shocked.

PICAXE is programmed with RS232 (style).
Very few devices can handle USB. Your download cable (AXE027) takes care of the conversion for PICAXE.
 

Dippy

Moderator
Extending BB's comments...
Perhaps he misunderstood YOU manie re: USB.
Maybe he thought you just shoved in a USB lead, but really you meant a USB-Serial lead (?).
USB/HID bootloaders are possible which obviously gives (some) PICs the edge - apart from the programming complexity of course.
Anyway, no point preaching to the convered huh?
And unless you need certain very fast functions or complete-PIC-control functions or need to programme numerous chips then PICAXE is just fine.
 

manie

Senior Member
Dippy: I did read read that WHOLE lot, good copy from the manual/datasheet... I actually understood alot of it BUT, nahhhhh ! Still too complicated and way to involved for casual programming, for that the Picaxe is king and will remain there for a long time...

BB and Dippy: No, not misunderstood, I told him about the Axe027 cable and built-in converter to 3.5mm stereo plug. Needless to say he was "amazed" a little but quite a nice and intelligent chap, he immediately saw the embedded worth in it all and almost immediately we were talking aboutthe student aspect. He liked the USB part because computers don't reallyhave RS-232 anymore. I think he became converted the minute the missionary spread the word......

I'll have to speak to Rev-Ed regarding import rights to S.A. ??? I think it will be a go-situation ???
 

Dippy

Moderator
I just cnp it from a random PIC data sheet.

I agree that PICAXE is the easiest method of getting code onto a PIC.

For the multitude of reasons given before PICAXE is the best option for you. And I can't think of an easier/cheaper option for students.

PS. I have programmed PICs using AXE027. But don't tell anyone as that's another story.
PPS. I take it your mate is quite old if he hasn't heard of PICKITx ?
PPPS. Horses For Courses innit.
 

manie

Senior Member
Thanks guys.

Dippy: 5 years to go to 60....(him), so yeah, you say so...

For the moment I have quite enough "adventure" with a Picaxe thanks..... don't need no more excitement.....
 
Top