Limited 12-bit Core Support
PICBASIC PRO™ version 2.40 added limited support for all the 12-bit core
(instruction set) PIC®
microcontrollers. The reason the support is limited is that the
resources on the 12-bit core devices are limited. Some of these limits
include only a two-level hardware stack and very small amounts of general
purpose RAM memory. The code page size is also small at 512 bytes. There is also
a limitation that calls and computed jumps can only be made to the first half
(256 words) of any code page. These limitations have made it necessary to
eliminate some compiler commands and modify the operation of some others.
While many useful programs can be written for the 12-bit core PIC MCUs using
the PICBASIC PRO Compiler, some applications will not be suited for these
devices. Choosing a 14- or 16-bit core device with more resources will, in many
cases, be the best solution.
Commands that are not supported for the 12-bit core PICmicro MCUs:
|
Command |
|
|
Reason |
|
ArrayRead |
|
|
Not enough RAM or stack |
|
ArrayWrite |
|
|
Not enough RAM or stack |
|
Dtmfout |
|
|
Not enough RAM or stack |
|
Freqout |
|
|
Not enough RAM or stack |
|
Hpwm |
|
|
No hardware PWM |
|
Hserin |
|
|
No hardware serial port |
|
Hserin2 |
|
|
No hardware serial port |
|
Hserout |
|
|
No hardware serial port |
|
Hserout2 |
|
|
No hardware serial port |
|
On Interrupt |
|
|
No Interrupts |
|
Readcode |
|
|
No support in devices |
|
Resume |
|
|
No Interrupts |
|
Serin2 |
|
|
Not enough RAM or stack |
|
Serout2 |
|
|
Not enough RAM or stack |
|
USBIn |
|
|
No USB devices |
|
USBInit |
|
|
No USB devices |
|
USBOut |
|
|
No USB devices |
|
USBService |
|
|
No USB devices |
|
Writecode |
|
|
No support in devices |
|
Xin |
|
|
Not enough RAM or stack |
|
Xout |
|
|
Not enough RAM or stack |
Trying to use these commands with 12-bit core devices will result in numerous
errors. If you must use one of these commands, choose a 14-bit or 16-bit core
device with more resources.
|
Commands that have had their operation modified are:
BUTTON: The Define for debounce, BUTTON_PAUSE is limited to 65 milliseconds.
DEBUG, DEBUGIN: The Serin2 and Serout2 modifiers are not supported for these commands because
of memory and stack size limits.
ERASECODE: This command has been adapted to erase a row of
EEPROM when using a 12-bit device that has dataspace. It does not
erase Code Space as it would when using a 14-bit or 16-bit device.
I2CREAD, I2CWRITE: The I2C clock and data pins are fixed at compile time by Defines. They still
must be specified in the I2CRead and I2CWrite statements, though this information is ignored by the compiler.
Define I2C_SDA PORTA,0
Define I2C_SCL PORTA,1
Because of memory and stack constraints, the Define for I2C_SLOW does not do
anything. Low-speed (100 kHz) I2C devices may be used up to 4MHz. Above
4MHz, high-speed (400kHz) devices should be used.
The Define for I2C_HOLD has no effect.
LCDOUT: The Serout2 modifiers are not supported for this command because of memory
and stack size limits.
OWIN, OWOUT: The Rep, Skip and Str modifiers are not supported for these commands because
of memory and stack size limits.
SEROUT: The open drain modes are not available due to TRIS register constraints.
SHIFTIN, SHIFTOUT: The Define for SHIFT_PAUSEUS is not available because of stack size
limitations.
|
General Considerations:
Because of the architecture of the 12-bit core PIC MCUs, programs compiled for them by PBP will, in general, be larger and slower that programs
compiled for the other PIC MCU families. In many cases, choosing a device from one of these other families will be more appropriate. However,
many useful programs can be written and compiled for the 12-bit core devices.
The two main programming limitations that will most likely occur are running out of RAM memory for variables and running past the first 256 word limit for
the library routines.
The compiler uses between 20 and 22 bytes of RAM for its internal variables, with additional RAM used for any necessary temporary variables. This RAM
allocation includes a 4 level software stack so that the BASIC program can still nest
GOSUBs up to 4 levels deep. Some PIC MCU devices only have
24 or 25 bytes of RAM so there is very little space for user variables on those devices. If the Unable
To Fit Variable error message occurs during
compilation, choose another PIC MCU with more general purpose RAM.
12-bit core PIC MCUs can call only into the first half (256 words) of a code page. Since the compiler's library routines are all accessed by
calls, they must reside entirely in the first 256 words of the PIC MCU code space. Many library routines, such as I2CRead, are fairly large. It
may only take a few routines to overrun the first 256 words of code space. If it is necessary to use more library routines that will fit into the first
half of the first code page, it will be necessary to move to a 14- or 16-bit core
PIC MCU instead of the 12-bit core device.
|