eeprom and 18M2 for servo replay

fritz42_male

Senior Member
Hi all,
I'm about to begin a build of an animatronic control system. I want to use an 18M2 with eeprom to replay stored sequences of servo movements. There will basically be 2 groups of servos - 1 group controlling 3 axis head movement and the other group will control 2 axis eye movement. I have not begun coding but have finished the initial Pebble layout (untested - if you see a mistake or way of improvement please let me know).

Code:
IC||471|210|2||U?|||PICAXE18M2|IC||PICAXE18M2_2
Resistor|330|611|322|2|Resistor|R?||1||IC||
Resistor|330|693|322|2|Resistor|R?||1||IC||
Resistor|330|665|322|2|Resistor|R?||1||IC||
Resistor|330|638|322|2|Resistor|R?||1||IC||
Resistor|330|556|322|2|Resistor|R?||1||IC||
Resistor|330|529|322|2|Resistor|R?||1||IC||
Wire||587|402|21||11|#CC6633|1|11||10|
Miscell||605|418|1||XX?||1|32|Miscell||misc_32
Miscell||687|391|1||XX?||1|32|||misc_32
Miscell||687|445|1||XX?||1|32|Miscell||misc_32
Miscell||605|391|1||XX?||1|32|Miscell||misc_32
Miscell||687|418|1||XX?||1|32|||misc_32
Miscell||605|445|1||XX?||1|32|Miscell||misc_32
Miscell||659|391|1||XX?||1|32|Miscell||misc_32
Miscell||659|418|1||XX?||1|32|Miscell||misc_32
Miscell||659|445|1||XX?||1|32|||misc_32
Miscell||632|391|1||XX?||1|32|Miscell||misc_32
Miscell||632|445|1||XX?||1|32|Miscell||misc_32
Miscell||632|418|1||XX?||1|32|Miscell||misc_32
Miscell||523|391|1||XX?||1|32|Miscell||misc_32
Miscell||550|445|1||XX?||1|32|||misc_32
Miscell||550|391|1||XX?||1|32|||misc_32
Miscell||550|418|1||XX?||1|32|||misc_32
Miscell||523|445|1||XX?||1|32|Miscell||misc_32
Miscell||523|418|1||XX?||1|32|Miscell||misc_32
Capacitor|0.1uF|715|211|4|Capacitor|C?||3|4|||cap_434
Miscell||528|340|1||XX?||1|36|CUT||misc_36
Miscell||555|340|1||XX?||1|36|CUT||misc_36
Miscell||637|340|1||XX?||1|36|CUT||misc_36
Miscell||692|340|1||XX?||1|36|Cut||misc_36
Miscell||664|340|1||XX?||1|36|CUT||misc_36
Miscell||610|340|1||XX?||1|36|CUT||misc_36
Wire||194|44|22||11|#FF0000|14|11||10|
Wire||207|72|23||11|#000000|14|11||10|
Wire||589|308|12||11|#FFFF00|5|11||10|
Wire||589|180|11||11|#FFFF00|5|11||10|
Wire||671|152|11||11|#CC6633|4|11||10|
Wire||587|72|21||11|#000000|1|11||10|
Wire||124|454|11||11|#000000|2|11||10|
Wire||124|42|11||11|#FF0000|2|11||10|
Wire||779|209|21||11|#CC6633|3|11||10|
Wire||781|317|11||11|#CC6633|2|11||10|
Resistor|10000|748|405|2|Resistor|R?||1||IC||
Wire||754|372|11||11|#00A060|3|11||10|
Wire||752|209|21||11|#00A060|3|11||10|
Resistor|22000|646|119|1|Resistor|R?||3||IC||
IC||361|210|1||U?|||EEPROM|IC||EEPROM_1
Wire||368|44|21||11|#FF0000|2|11||10|
Wire||450|402|21||11|#000000|2|11||10|
Wire||370|317|11||11|#000000|1|11||10|
Wire||398|345|11||11|#000000|1|11||10|
Miscell||221|391|1||XX?||1|32|Miscell||misc_32
Miscell||221|418|1||XX?||1|32|Miscell||misc_32
Miscell||221|445|1||XX?||1|32|Miscell||misc_32
Miscell||249|391|1||XX?||1|32|Miscell||misc_32
Miscell||249|418|1||XX?||1|32|Miscell||misc_32
Miscell||249|445|1||XX?||1|32|Miscell||misc_32
Resistor|330|226|212|2|Resistor|R?||2||IC||
Resistor|330|254|212|2|Resistor|R?||2||IC||
Miscell||276|391|1||XX?||1|32|Miscell||misc_32
Miscell||276|418|1||XX?||1|32|Miscell||misc_32
Miscell||276|445|1||XX?||1|32|Miscell||misc_32
Resistor|330|281|212|2|Resistor|R?||2||IC||
Wire||343|171|12||11|#CC6633|13|11||10|
Wire||781|454|11||11|#000000|2|11||10|
Wire||386|182|22||11|#3253FF|7|13||10|
Wire||413|182|22||11|#3253FF|5|13||10|
Wire||387|366|11||11|#3253FF|4|21||10|
Wire||414|311|11||11|#3253FF|2|21||10|
Wire||452|180|11||11|#3253FF|3|11||10|
Resistor|330|309|212|2|Resistor|R?||2||IC||
Resistor|330|336|212|2|Resistor|R?||2||IC||
Miscell||304|391|1||XX?||1|32|Miscell||misc_32
Miscell||304|418|1||XX?||1|32|Miscell||misc_32
Miscell||304|445|1||XX?||1|32|Miscell||misc_32
Miscell||331|391|1||XX?||1|32|Miscell||misc_32
Miscell||331|418|1||XX?||1|32|Miscell||misc_32
Miscell||331|445|1||XX?||1|32|Miscell||misc_32
Wire||316|143|12||11|#CC6633|11|11||10|
Wire||288|116|12||11|#CC6633|10|11||10|
Wire||261|88|12||11|#CC6633|9|11||10|
Wire||233|155|13||11|#CC6633|9|11||10|
BREADBOARDSTYLE=BB37
SHOWTHETOPAREA=false


I have a few queries though:

1) Can the 18M do multiple simultaneous reads of an eeprom via the multitasking or should I adopt a different approach of reading all sequences via the eeprom and then passing them to the individual control programs?

2) I'm hoping to preprogram the eeprom from data derived from a PC. I see that there are plenty of PC based eeprom programmers on eBay - are the ones that list 24C256 (for example) suitable for 24LC256?

Any other suggestions or pointers would be appreciated.

Cheers

Mike
 

BillyGreen1973

Senior Member
First things first, I'm not sure what that block of 'code' is in your above post, so can't comment on that.

Now on to your questions..

1)..the 18M2 is NOT a true multitasking IC. It actually only executes one command at a time, but can do it very quickly and 'jumps' between the four programs when time allows. This gives the 'illusion' of four thread multitasking. So to answer you question, no, you cannot do multiple simultaneous reads from the EEPROM. I wouldn't really worry too much about the speed of the reads from EEPROM as they are going to be much faster than your servo's can respond to. I would point out though, that using EEPROM heavily as you suggest, will significantly shorten the life of the IC. Have you considered using a 28x2 picaxe's scratchpad area?

2) The 24C256 and 24LC256 are operationally identical in terms of reading and writting to them using I2C. They differ only in their electrical specifications. I would not bother buying a seperate EEPROM programmer. Once you have your circuit built, you can write a small program for the picaxe that will program the EEPROM for you. This would work by taking a byte in serially and programming that byte to the EEPROM, then increment the EEPROM location counter and take another byte in through the serial port. Continue this till EEPROM is full. Job done.
 

fritz42_male

Senior Member
Thanks for the reply. The code is a Pebble layout.

You say that using the eeprom the way I am proposing will shorten the life. I thought it was writes that shortened the life and the number of reads was very large. I am only proposing to write 3 or 4 times while I tweak the motion routine.

I will be doing the actual motion on a VSA system then exporting the data to the eeprom.

If I find that the final data size for the stored movements is less than the RAM or scratchpad area of the 18M2 then I can dispense with the eeprom but I'm playing safe at the moment as I think it's likely to be a lot higher.
 
Last edited:

BillyGreen1973

Senior Member
Oh I see, yeah your quite right, reading from an EEPROM shouldn't cause too much of a problem.
I would still think about using the 28X2 or 40X2 as reading from the scratchpad is a LOT quicker than reading from I2C EEPROM.
You could load the 'scene' from EEPROM into scratchpad at startup and read it from there when needed. As the Scratchpad area is RAM it will not wear out anywhere nearly as quickly as EEPROM would (almost indefinate).
This way your main program would stay the same, and you would only need to change the EEPROM contents when a new 'scene' is needed.
The 28X2/40X2 'slot 1' program could be you EEPROM programmer and could be invoked by the main program checking the condition of an input at startup.
 

fritz42_male

Senior Member
Speed of read really isn't a problem as the servos will take some time to transistion between settings.

Want to keep the cost down and use a Kiwi board for the layout as I have a few spares. Hence the 18M2
 
Top