PICAXE versus PIC PC serial connection?

ScottCarson

New Member
Could someone please explain to me how the PICAXE serial interface to the PC is accomplished using the 2 resistors but a PIC microcontroller requires a special driver/receiver chip comparable to the MAX232?

Given the PICAXE is simply a PIC + bootloader, does the bootloader provide this additional functionality?

Thanks

Scott
 

Dippy

Moderator
You don't need a MAX232 (or similar!) to go from PIC to PC in most cases. Though obv if you're running the PIC at 3V for example then you will probably need a 3V version of the MAX232 (or similar).

I won't say ALL cases as I haven't tried every PC ever made, but I have done serial from PIC to PC just using inverting transistors from the hardware Tx/Rx PIC pins. On all the dozen PCs I tried it was fine. I'm sure it'll be fine from non-hardware serial PIC pins too as long as you get polarity correct.

Someone else can give you the RS232 tech spec. as the MAX232 does the level shifting and will also afford some protection and electrical buffering (not data).
 

ylp88

Senior Member
To establish a serial connection between the PICAXE and a PC, resistors are not actually required, however it is recommended in order to protect the systems should a short circuit or other erroneous event occur. The same also applies to a PIC. If you are referring to the two download resistors used for the PICAXE, (using the values recommended in the documentation) the 10k resistor keeps the serial in pin low while the 22k resistor limits current into the pin (which may help the internal clamping diodes to work).

Using such an approach, the PIC and PC can communicate serially, however by adding a RS-232 transceiver chip such as a MAX232, it is possible to get better performance. To elaborate, the MAX232 chip does (most simply) two things: inverts the bit stream and amplifies the drive voltage. It is this which makes a normal bit stream of 1s and 0s "RS-232 compatible". Typically we refer to low=0=0V and high=1=5V, however RS-232 uses negative logic with low=+ve voltage and high=negative voltage. The extra buffering may allow for longer transmission distances and/or better reliability in noisy environments at higher bit rates. RS-232 transceiver chips also often advertise high ESD protection (which can be an issue, especially with transmission lines which may not always be always conencted at the other end), with the MAX232 advertised to be around 15kV or so...

With regard to signalling voltages, trusty Wikipedia says:
...signal levels of ±5 V,±10 V,±12 V, and ±15 V are all commonly seen...
And further to talk about voltage protections:
RS-232 drivers and receivers must be able to withstand indefinite short circuit to ground or to any voltage level up to +/-25 volts...
A PICAXE (or PICmicro) will probably curl its toes and run away if you tried subjecting it to these conditions!

So long-story-short, there is nothing special about how the PICAXE bootloader implements the serial communications systems - technically whatever the PICAXE can do, a plain PICmicro can do as well. However the system typically used to connect the PICAXE to a PC is very simple because that's the way we like to do things!!! Keep it simple! However, by all means add a RS-232 chip if you want, but remember that the signal levels are inverted and you'll need to compensate for that on either the receiver or transmitter end (use T4800 instead of N4800 when writing your PICAXE code, for example).

ylp88
 
Last edited:

hippy

Technical Support
Staff member
A PICmicro doesn't require a MAX232, as you note the PICAXE is itself just a PICmicro with some pre-loaded software.

If the PICmicro wants to do serial to a PC through an on-chip UART/AUSART it needs to have those signals inverted and the easiest way to do that is with a MAX232. It also has the advnatage that it makes the interface 100% compliant with the RS232 standard.

The two-resistor interface isn't RS232 compliant but does work in almost all cases, and is a cheaper and easier option for the traget market it's used in. To use a two-resistor interface the PICmicro has to have its bootloader written not to use the UART/AUSART but to bit-bang the serial data in and out.
 

ScottCarson

New Member
Thanks for the excellent answers. The PICAXE simplicity is outstanding and this forum is a tremendous help.

My question regarding the interface surfaced after I realized today that the PICAXE 14M supplier I've been using here in the USA (phanderson) is no longer selling individual processors. I've been using the 14M for some high school robotics projects and have become a bit concerned that the USA doesn't have a listed distributor, the PICAXE 14M price is now more than $4.00 USD, and as an individual I'm not able to get bulk pricing from techsupplies.co.uk.

I really prefer the PICAXE simplicity, but I also don't want to find myself and my programs suffering from limitied suppliers, parts availability, and unaffordable prices.

One alternative I decided to explore was to possibly identify a PIC alternative plus a comparable bootloader. I've identified several bootloaders, but have yet uncovered the serial comm functionality without using a MAX232 or comparable.

So I'd appreciate any information regarding a PIC bootlIoader that might provide comparable functionality to the PICAXE solution? Still not sure what I'll do for a BASIC language replacement. The PICAXE BASIC has been excellent for student use.

Or perhaps someone can provide some re-assurances that USA customers such as myself will continue to have access to the PICAXE at affordable prices? As I mentioned, the 14M chips are now over $4.00 USD ea. from limited USA suppliers. My initial look at PIC alternatives (no bootloader, etc.) indicates that more powerful PICs are readily available for less than $2.00 USD, but of course suffer from the MicroChip PIC complexity.

Please don't interpret my comments as complaints. The PICAXE solution continues to be my preferred solution. I'm just trying to ensure that I can continue to provide my students with inexpensive robotics kits.

Thanks again.

Scott
 

manuka

Senior Member
I'd not realized "phanderson" was limiting PICAXE sales, but given his generous service can appreciate he's increasingly short on time for small orders. If the 14M is suitable for your needs, then you're strongly advised to keep using it- workaround hacks (as mentioned in postings above) will drive both you & us crazy otherwise -it'd be akin to trying to make your own nuts & bolts!

Suggest hence you just use another supplier- I know of at least these alternative US/Can outlets (& several have the 14M at US$3.85) -

WES => www.world-educational-services.com

HVWtech => www.HVWTech.com

Ron Hackett => www.jrhackett.net

Wulfden => www.wulfden.org/stamps/picaxe.shtml

An alternative is to get someone in UK/NZ to kindly order for you,& in return you send some comparable US items back. Ex. Electronic Goldmine (Arizona) goodies=> www.goldmine-elec.com/
 
Last edited:

hippy

Technical Support
Staff member
As part of a PICmicro project I looked for a bootloader which could be made PICAXE compatible but came up blank. Most seem to use the on chip AUSART which needs the MAX232 or some other inversion, and those which used bit-banging usually had some overly complicated or inelegant reset / download process to go through.

In the end I wrote my own but unfortunately I cannot make the source nor .HEX files available. On one hand it's fairly straight forward to do it yourself, on the other it does involve a lot of detailed knowledge of the PICmicro, an ability to squidge all the code into a 256 word block and there's quite a lot of debugging involved to get high-speed serial and Flash programming right. Plus you'll need to develop a PC-side application to download the .HEX files.

You can of course forego needing a bootloader and program the PICmicro directly. I'd recommend the Mcrochip PicKit2. With the right circuit you can program in-circuit so it's not really any more difficult than using a bootloader once you've got over the initial learning curve. You may have to go that route anyway because not all PICmicros are self-programming so cannot be used with a bootloader.

There are alternatives to PICAXE Basic out there, compilers for Basic, C and other languages ( JAL, Forth ). Many of the compilers are commercial but often have limited capability demo versions for a limited range of PICmicros. The entire Microchip MPLAB Development Suite including C compilers is free of charge and very capable but can be difficult to get to grips with. A lot depends upon what you want to do, how you want to do it, how much you are prepared to pay, and how much time you're wiling to invest in getting familiar with tools which can be more complicated to use than the Programming Editor.
 
Top