Does anyone have a trick or two up their sleeve for using 16 bit signed integers on Oshon Basic ?
I've got a small program to write in a PIC12F683 which uses a few negative numbers.
Using the SINGLE data type causes the memory to exceed the chip's 2k limit.
At the moment my only options seem to be using a different chip and buying a newer programmer.
Or using a different compiler.
There are multiple places in the code where I subtract two variables and the result can be negative.
Oshon's only 16 bit data type is an unsigned word.. 0-65535.
They have a single precision floating point data type, but that consumes program and data space at an alarming rate.
Using a WORD variable, the result from 8 - 10 is 65534, where as the result using SINGLE data type gives a more predictable -2.
The only solution I see is to do a comparison prior to each subtraction, if A is > than B then reverse them in the equation
and set a flag bit to indicate the result is negative. Much like we did in the PLC's on the ark.
I was wondering if there's a more elegant solution.
Use another compiler.. Vladimirs compiler is very good but lacks several things... As I can do most of the stuff in assembly, I get around, but as I program in C as well... I tend to use that..
PicBasic Pro, Swordfish Basic, proton basic... All these are better compilers..
One is called great cow.... Very good but support was supposed to be ending!! However! it hasn't
I am a Swordfish Basic advocate. It's a very competent language, but limited to PIC18F-series micros. The Swordfish Special Edition is free to download and use with extremely generous limits on program size, to the point that many users never graduate to the full paid version.
I've just been looking int Great Cow.... WOW!! they cover ALL 8 bits in the pic and AVR and Tiny micros... They have an extensive library even colour TFT's... Both normal an Graphical compiler... I haven't tried the graphical compiler, but it looks decent....
BTW graphical ide means "click/select" programming... No knowledge required..
Great Cow Basic (GCB) is good, and just about the same efficiency as Oshonsoft. However, in exchange for giving negative integers, it seems to lack real (floating) variables.
I've converted the odd program from Oshonsoft to GCB, small ones, and program space used seems a tad better with GCB
Can't win them all...