There are countless applications in which hardware needs to be made intelligent - often to save on having to build acres of circuitry using discrete 7400 series logic. Instead a PIC microcomputer can be employed. These versatile 8 bit microprocessors by Microchip became popular in the early 1990's and can be found embedded in many items from games consoles to washing machines.
Having designed the hardware to control whatever system you have in mind the subject of software must be addressed. Source code is normally written in assembler since PICs use a RISC architecture with as minimum of 35 instructions to learn!
The release of Microchip's assembler (MPASM) spawned an explosion of assemblers for use on IBM compatible PCs. However, few exist for use with RISC OS - !PICbasic is one of those.
It assembles from disc a tokenised BBC BASIC file containing mnemonics in exactly the same way as you would use them if writing ARM assembler or 6502 assembler on a BBC Micro. A side by side example is available for comparison of syntax.
The result of assembling the source code will be an object code file which is ready to be programmed into the PIC chip. Where possible use of a flash/EEPROM/UV-erasable based part is recommended for initial prototyping since these allow for iterations while the bugs are being ironed out of your software! The final revision can of course be put into a one time programmable (OTP) version.
For parts which have on board EEPROM data memory this can be pre initialised at the time of programming, for example with calibration constants or lookup tables that your code uses.
In addition to the assembler, a whole suite of software is available:
PICbasic - the assembler which allows you to write as you would in BASIC II or BASIC V but using PIC mnemonics instead targetting the 12/14/16 bit instruction set [Latest V1.43].
PICdis - the disassembler takes a binary file (for example one read off a chip) and outputs either on the screen, or saved into a textfile. The format of the disassembly listing is conveniently the exact format which the assembler uses permitting the listing to be reassembled then reprogrammed onto the chip [Latest V1.19].
PICtracer - a simulator designed to allow you to monitor how your latest piece of software will behave before even putting it on a chip [Latest V1.15].
PICprog - along with the PIC programmer board (included in the price) this commits your software to the device of your choice. The software includes program/verify/blank check/dump capability. Configuration bits, user id, EEPROM data memory, and of course code memory can all be read or programmed and saved in a variety of formats [Latest V1.57].
PIClaunch - this program avoids the need to leave the familiarity of the desktop when assembling/disassembling as you simply drop the file onto the iconbar. Also comes with some other handy programming aids such as binary comparision tools and template source files [Latest V1.32].
The PICsuite package contains the programming hardware, comprehensive printed manual, and software diskette. All software is suitable for running on any version of RISC OS from 3.10 to 5.xx inclusive, though PICprog will require access to a 25 pin parallel port:
|RISC OS version of the programmer/disassembler/assembler/simulator/launcher|
|Power adapter 12V||
|UK style plug AC-AC adapter for the PICsuite programmer board|
|Centronics printer lead||
|For 25 pin D shaped parallel port|
In addition the programmer driver is capable of handling the micros listed in the following table (some need a simple passive adapter if physically too big to fit into the on board ZIF socket - full details are supplied on how to build these).
As PICsuite is driven by device 'templates' it is normally only necessary to add the desired device to the list of known PICs.
|Low cost 6 pin PICs, with a single comparator and timer
|Tiny 8 pin PICs, with or without non volatile EEPROM data memory
|Tiny 8 pin PICs, which can also be run with an internal oscillator
|High speed CMOS PICs
|High speed CMOS PICs with an assortment of peripherals
|Flash based PICs, operating down to 2.5V
|PICs with ADCs, from 8 to 12 bits resolution
|USB 1.1 PICs (special 24MHz versions)
|18 pin PICs with EEPROM code memory
|Low cost flash based PICs, with a wide array of peripherals
Does PICbasic understand the pseudo mnemonic OPT?
Yes, however only certain bits of it are valid - for example offset assembly must ALWAYS be used as the assembler isn't running on the PIC itself.
Does PICbasic output to Intel hex object format files or similar?
No, the resulting file is a binary file ready to be programmed straight into the flash, EEPROM, EPROM or PROM memory inside the PIC chip.
Can I preprogram the EEPROM data memory within the PIC?
Yes, you simply drop the desired contents onto the 'Data Memory' box in the programming window before pressing 'Start'.
The motherboard doesn't have a parallel port, how do I connect the programmer?
The main requirement is the ParallelDeviceDriver module (which adds the 'Parallel' device to DeviceFS). This is present by default on the Risc PC and A7000 and A7000+. A PCI based parallel port can also be used supported by Tank's driver, or PCI express based parallel port for motherboards with PCIe sockets.
What happens if the PIC I've chosen isn't supported?
As PIC suite is driven by device 'templates' it is normally only necessary to add the desired device to the list of known PICs. But check first with the author as it may already have been added.