I2C ReadPage with specific memory location assignment - SOLVED
4Alex
Posts: 119
Good evening everybody,
I am trying to reduce my code as much as possible. I read 16 bytes from the eeprom and I would like to assign these bytes to a buffer starting at a specific location. I do this a lot using different addresses and final positions. Is it possible to replace the following code with something shorter (and faster)? Ideally I'd like to put everything in the ReadPage command.
Thanks for any help.
Cheers,
Alex
Post Edited (4Alex) : 7/31/2009 11:43:19 AM GMT
I am trying to reduce my code as much as possible. I read 16 bytes from the eeprom and I would like to assign these bytes to a buffer starting at a specific location. I do this a lot using different addresses and final positions. Is it possible to replace the following code with something shorter (and faster)? Ideally I'd like to put everything in the ReadPage command.
i2c.ReadPage(i2cSCL, $A0, $8118, @tmpMX, 16) repeat i from 0 to 15 comms_txbuf[noparse][[/noparse]14+i] := tmpMX[noparse][[/noparse] i ] '
Thanks for any help.
Cheers,
Alex
Post Edited (4Alex) : 7/31/2009 11:43:19 AM GMT
Comments
Try this on for size.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<This space for rent>
[noparse][[/noparse]Edit] Of course, if you're just building a buffer that will be transmitted elsewhere, Brad's suggestion should work.
@JonnyMac: Thanks for your reply. Yup, I'm building a transmission buffer over several different input sources, so I do need BradC's function.
Cheers,
Alex
p.s.: the more I use the propellers, the more I'm amazed at the shear power of it compared to PIC mcu. Discovery never stops. Kudo Parallax!