inglewoodpete
Senior Member
Over the last few years the restrictions caused by the PICAXE's positive-integers-only numbering system has been discussed several times. I can understand the reasons for these restriction in the early days: limited firmware space, limited variable space and a desire to keep the PICAXE really simple to use, being just three.
While some others have asked for more complicated number formats like signed or even (gasp) floating point variables, I can see the value of keeping everything really simple for an entry level microcontroller and an entry level programmer.
I thought I'd open a discussion on the pros and cons of the PICAXE firmware having a read-only Carry bit available to the programmer. This would be set and cleared according to the last arithmetic operation: Carry (variable overflow) or borrow (variable underflow). Most importantly, this user-accessible carry bit would not change the way any existing PICAXE code works.
My current thought is that the firmware would initialise the Carry bit as 0 as the start of every Let (or implied Let) statement and set it to 1 whenever an overflow/underflow occurred during that calculation. My idea is to allow experienced programmers to determine when the result of a calculation has overflowed the limits of a byte, word or bit variable more simply.
Thoughts, anyone?
While some others have asked for more complicated number formats like signed or even (gasp) floating point variables, I can see the value of keeping everything really simple for an entry level microcontroller and an entry level programmer.
I thought I'd open a discussion on the pros and cons of the PICAXE firmware having a read-only Carry bit available to the programmer. This would be set and cleared according to the last arithmetic operation: Carry (variable overflow) or borrow (variable underflow). Most importantly, this user-accessible carry bit would not change the way any existing PICAXE code works.
My current thought is that the firmware would initialise the Carry bit as 0 as the start of every Let (or implied Let) statement and set it to 1 whenever an overflow/underflow occurred during that calculation. My idea is to allow experienced programmers to determine when the result of a calculation has overflowed the limits of a byte, word or bit variable more simply.
Thoughts, anyone?