Sending data via I2C
Hi!
I want to send this data string via I2C instead of a serial interface.
[noparse][[/noparse](Xmg.BIT15 * 2 + "+"), DEC (ABS Xmg/ 1000), ".", DEC3 (ABS Xmg), ",", (Ymg.BIT15 * 2 + "+"), DEC (ABS Ymg/ 1000), ".", DEC3 (ABS Ymg), ",", (Zmg.BIT15 * 2 + "+"), DEC (ABS Zmg/ 1000), ".", DEC3 (ABS Zmg), CR, LF]
The readout is something like this: "+0.054,-0.009,+1.056"
// Marcus L
I want to send this data string via I2C instead of a serial interface.
[noparse][[/noparse](Xmg.BIT15 * 2 + "+"), DEC (ABS Xmg/ 1000), ".", DEC3 (ABS Xmg), ",", (Ymg.BIT15 * 2 + "+"), DEC (ABS Ymg/ 1000), ".", DEC3 (ABS Ymg), ",", (Zmg.BIT15 * 2 + "+"), DEC (ABS Zmg/ 1000), ".", DEC3 (ABS Zmg), CR, LF]
The readout is something like this: "+0.054,-0.009,+1.056"
// Marcus L
Comments
// Marcus Löfstrand
This is _UNTESTED_, but I suspect it's probably going to have to be more like this:
[noparse][[/noparse]SDEC (Xmg.BIT15 * 2), DEC (ABS Xmg/ 1000), ".", DEC3 (ABS Xmg), ",", SDEC (Ymg.BIT15 * 2), DEC (ABS Ymg/ 1000), ".", DEC3 (ABS Ymg), ",", (SDEC Zmg.BIT15 * 2), DEC (ABS Zmg/ 1000), ".", DEC3 (ABS Zmg), CR, LF]
I imagine you were intending to use the "+" as a catenation operator, but unfortunately there is no such operator in PBASIC.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
// Marcus L
// Marcus L
If you've found a catenation operator, I'm sure that Jeff Martin would love to hear about it, as he WROTE PBASIC. Hoping that "+" will catenate a "+" sign is just that - hope. SDEC will PERMIT and GENERATE a + or - based on the content of the data.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
// Marcus Löfstrand
Post Edited (lond) : 9/30/2006 6:55:56 PM GMT