1. About the deviceThe PIC12F675 is a little 8pin microcontroller device which has some interesting features. Is cheap, ideal for beginners and can be freely supported by many commercial languages on the market.
Features:
PIC12F675
| |
Parameter name
| Value
|
| Program Memory Type | Flash
|
| Program Memory (KB) | 1.75
|
| CPU Speed (MIPS) | 5 |
| RAM Bytes | 64 |
| Data EEPROM (bytes) | 128 |
| Timers | 1 x 8-bit, 1 x 16-bit |
| ADC | 4 ch, 10-bit |
| Comparators | 1 |
| Temperature Range (C) | -40 to 125 |
| Operating Voltage Range (V) | 2 to 5.5 |
The device can be used in a reasonable variety of projects as Windmill/Solar controllers/loggers, Water pump controllers, Stepper motor drivers, Alarms and Automotive applications, etc.
2. About our missionFor such a device, the only thing desired from actual languages/compilers on the market (commercial or freeware) is to obtain the smallest code possible, without much effort form the user. But this objective is harder and harder to attain with the modern compilators which must come with support for the most recent devices from Microchip and with the best featured library possible - I always said that these days, with the powerful microcontrollers available at competitive prices, a feature rich library is more important that the ability to produce the smallest code. A language/compiler which come with easy support for USB, SD Card, Network and USB & Network bootloaders can be the winner. Because this can also assure a large online community of users.
But what is happening with the support for our older and smaller devices? It is a common practice to make common libraries to support a large family of microcontrollers but the price is high for small devices - more and more space memory occupied from a version to another of actual compilers. Older projects can't compile on newest version of libraries/compilers.
So, let's see what is the situation for 12F675 device and Pascal like languages/compilers today. Initially, we will use a small project consisting of a small Windmill/Solar controller and later, a more complex logger application.
3, The compilers and tools used
Here are just three of them - don't know for others.
4. Testing using standard libraries
4.1 Simple Windmill/Solar controller:
| Compiler | Code space used (instructions) | Data space used (bytes) |
| mikroPascal PRO 4.60 | 610 | 13 |
Oshonsoft PIC Basic 6.91
| 460 | 30
|
| PMP 1.6.0.86* | --- | --- |
| JALv2 2.4n | 352 | 38 |
*
Note: The standard library for Analog to Digital conversion from
PMP can not be used on 12F675 device without modifications.
Oshonsoft Basic was introduced recently just to see where is situated, compared with the others (it is the best PIC simulator in the world but as compiler not as good as PMP and JALv2) - sorry for inconvenience.
The sources are included inside "standard.zip" archive - see the attachments.
5. Testing using custom libraries/functions
5.1 Simple Windmill/Solar controller:
| Compiler | Code space used (instructions) | Data space used (bytes) |
| mikroPascal PRO 4.60 | 587 | 12 |
Oshonsoft PIC Basic 6.91
| 451 | 32
|
| PMP 1.6.0.86 | 293 | 31 |
| JALv2 2.4n | 276 | 33
|
The sources are included inside "custom.zip" archive - see the attachments.
5.2 Windmill/Solar controller and logger:
The reference design can be found
there, here will be only the firmware as a test (not sure yet, maybe first I will post there the modified project). This will not work with standard libraries so it is posted on this section only - I will try to keep the 32bit integer math for calculating required voltages. Otherwise, an adjustable voltage power supply is mandatory - no big deal but it will take some time, my power source is down.
--- to be completed ---