It only works fine though while the A0, A1 and A2 address lines change slowly. If they change too quickly the PICAXE will not be able to keep up. You can improve performance by using "SETFREQ M8" and you can also optimise your code so it runs as fast as possible -<code><pre><font size=2 face='Courier'>SETFREQ M8
DO
b0 = pins & 7
READ b0,pins
LOOP
EEPROM ( %11111110 ) ' 0
EEPROM ( %11111101 ) ' 1
EEPROM ( %11111011 ) ' 2
EEPROM ( %11110111 ) ' 3
EEPROM ( %11101111 ) ' 4
EEPROM ( %11011111 ) ' 5
EEPROM ( %10111111 ) ' 6
EEPROM ( %01111111 ) ' 7 </font></pre></code> For a PICAXE which has separate Code Flash and Data Eeprom ( 18A, 18X, 28X1, 40X1 ) You can repeat the pattern throughout Eeprom and then use thsi code which should be the fastest you can get with a PICAXE -<code><pre><font size=2 face='Courier'>SETFREQ M8
DO
READ pins,pins
READ pins,pins
: ; Repaet until memory full
READ pins,pins
LOOP </font></pre></code> There is an issue with both these solutions. If the decoder PICAXE reads the A0, A1 and A2 just as they are changed by the master, the wrong values may be read, because two lines may have changed before any other does.
The usual solution is to have an enable so the A lines can be changed, then the chip told they are stable, but another solution when cycling through a fixed sequence is to use a 'grey decoder' pattern so only one bit changes at any time.
Another alternative is to just supply an increment signal to the PICAXE and have it step through the required pattern. That also minimises the number of interfacing lines.
Edited by - hippy on 22/07/2007 17:20:34