Saturday, 31 March 2012

If you mean PAUSE don't write WAIT

Be careful with the wait command.

I used one in error (I meant pause). And the consequences were more than just waiting 1000 times as long as I had intended (wait counts in seconds, pause counts in microseconds).

With wait in my coding, my 20x2 wouldn't program. Not only wouldn't it program, but it wouldn't re-program with any other program. I thought I had "bricked" the chip.

Luckily, I found instructions on how to tackle a chip that won't reprogram: remove the 5v lead, start the programming process, wait one or two seconds, then replace the 5v. If that doesn't work, remove all the other connections to the chip (except for the 0v, Serial In and Serial Out) and try again: I was getting a voltage on the 5v pin with no power connected, but with a 5v feed to pin C.1.

Once I removed the wait command, the chip would reprogram normally.

Tuesday, 20 March 2012

Long-cable connection between Picaxe Units

Found at last - what looks like a reliable, flexible, and economical way of linking Picaxe chips over considerable distances of Cat5 cable.

The answer is to use a P82B96 IC at each end of the run:


The P82B96 is available as a DIP8 costing less than a 20x2 in the UK (I used RS online). Using the i2cslow_8 setting, I have managed 300m with just a simple master-slave pair. Adding a second slave (simply teeing off from the two twisted pairs) saw the system fail on a 300m length, but it is fine on a 100m length (I don't have any lengths in between to test with).

Don't forget the pull-up resistors on SCL and SDA on both master and slave (10k worked for me)!

Source of the 12v circuitry is here - see Figure 4

Hope this helps someone.

Monday, 12 March 2012

Superscript dots on AXE133Y (and probably AXE134Y) OLED/LCD

Suddenly found superscript dots (same size as full-stop/period) in the display on an OLED using AXE133Y - and eventually found the explanation: it is the result of outputting an empty string, eg:
  serout pinOLEDdisplay,oledSpeed,("")

Not terribly useful, as it still uses up one character - but at least it isn't anything more significant.

Sunday, 4 March 2012

Problems with hi2cIn or hi2Cout?

Took me a while to spot that with syntax such as:

HI2CIN [newslave],location,(variable,...)

the square brackets DO NOT mean that the variable is optional (which you might guess, given that this is the nomenclature often used in computer manuals). It means that you literally type the square brackets around the value

Thus :

HI2CIN [%10010010],0,(122,154)