14M storage locations?

Andrew Cowan

Senior Member
I have a circuit with a 14M in, in which I need to store 18 bytes of data (which change throughout the program). Obviously bxx variables are not enough - there are only 14 of them.

Are there other locations that I can use to store bytes? I'm thinking peeking and poking is the answer, but I haven't used that before.

Manual 2:
Addresses $50 to $7E are general purpose registers that can be used freely.

Do these overlap with the bxx variables - ie are some already used?

Thanks

Andrew
 
Last edited:

Andrew Cowan

Senior Member
Have you though of posting your code in case someone can optimise for you :confused:
I considered it, but it's 140 bytes over, and still not finished. It's also very complex with no similar/repeating sections left to optimise - using a 14X2 give me more room to expand too. Plus the speed increase will be very helpful.
 

westaust55

Moderator
I considered it, but it's 140 bytes over, and still not finished. It's also very complex with no similar/repeating sections left to optimise - using a 14X2 give me more room to expand too. Plus the speed increase will be very helpful.
Reducing space does not always need to be through the creation of a subroutine.
Sometimes other programming structures or commands can achieve the same result with different program space requirements.
 

william47316

New Member
im usually quite good at optimising my own code, i've managed to squeeze quite a bit on 08M's most of the time. you should post your current code. heres some general tips

use pauses <= 255 (8bit numbers) or omit them full stop
cut down your serouts and sertxds and any relativity long ASCII strings (remove fancy formatting too eg tabs and even CRLF's)
use set pins if you want some pins on or off at the same time instead of separate high/lows
 

MartinM57

Moderator
Andrew isn't a junior programmer - I'm sure he's done the standard tricks already (haven't you? :D)

Sometimes a PICAXE just isn't big enough...
 

eclectic

Moderator
Just an opinion.
The 14M costs £2.00
The 20X2 costs £3.51

Is it really worth spending ages fiddling with code,
without any guarantee that it will fit,
for the sake of £1.51 ?

e
 

hippy

Technical Support
Staff member
I'd go with eclectic, though I don't always come as quickly to the same conclusion as I'm as tight-fisted as the next man.

It's easy to look at a near doubling of price and see that as 'exorbitant', easy to forget that in total terms of a project or the value a project has that's usually only a smaller increase, and especially if one casually discounts time and effort as being "free" which we all tend to, after all it's usually a hobby we do for fun.

It really comes from where one gets one's hobby fun from; if it's the fun of downright determination to get something working on a particular chip come what may, by all means have that fun, go for it, commit the time and effort, enjoy that challenge for what it is.

If satisfaction and fun comes in getting the project working, as you want, with fewer up-hill battles it's often worthwhile spending a little more to save something somewhere else ( which is usually time and effort ).

There's always a balance, and I think we're all in the game of as cheap as possible in most cases and enjoy the challenge, so there's no hard and fast rules. There's always a satisfaction in getting something to work on the cheapest or smallest, the joy of beating, "they said it couldn't be done", but there's no shame in taking the easier way out and spending money to get to where you want to go to.

In terms of optimising PICAXE code when up against limits. In my experience, saving 10% is probably reasonably achievable, 20% possibly, beyond that it may well require major redesign and a lot of effort and even dropping some functionality. Plus most optimisation will take away the aesthetics of the original code, make it harder to understand and to modify.

If at the limit and just needing a bit more then the project is done it may be worthwhile, but if near the limit and there's a lot more you'd like to add, it's probably easier to 'suck it up' and accept that a more capable PICAXE will likely be the best way forward.
 

Dippy

Moderator
I've seen people on this Forum wittering on about driving 50 miles to save 50p. Or spend 3 weeks to save a quid.
Saving money at all costs gets a bit silly after a while.
And choosing a bigger PICAXE isn't a waste of money - after all , it releases a smaller one for a smaller task - if you see what I mean.

The challenge can be fun and as said above I'm Andrew has tried his best.
And sometimes you feel the urge to add a little bit more and "Oh, bother" you've run out of space.

"Suck it up" - hippy, OMG dude , you've been watching too much American TV :rolleyes:
You'll be saying "My Bad" next , at which point I will arrange a Hit Squad.
Remember what MI6 did to that bloke stuffed in a bag a couple of months back? :eek:
 
Top