Hello,

What is the best way to save and send multiple strings via serial?

I need to send motion commands to a stepper motor controller. Each command (Stop, Left, Right, etc.) is comprised of (8) Hex codes. These are sent TTL 9600BPS, 8N1.

My thought was to save each of these to a VAR (which could be a constant?) and then reference each when calling HSEROUT.

' Instead of directly:
HESEROUT [HEX 55, AA, 1, FF, 0, 0, AA, 56]

' Use something like this:
HESEROUT [mcuStop]

Although directly works fine, it is quite awkward when creating elaborate motion profiles.

I am not sure how to store these strings as VAR's/Array's/Tables or how to call them?

Thanks!


' Partial list of about 24 commands.
mcuStop = [HEX 55, AA, 1, FF, 0, 0, AA, 56]
mcuCoast = [HEX 55, AA, 12, EE, 0, 0, AA, 56]
mcuForward = [HEX 55, AA, 3, FD, 0, 0, AA, 56]
mcuReverse = [HEX 55, AA, 4, FC, 0, 0, AA, 56]
mcuLeft = [HEX 55, AA, 5, FB, 0, 0, AA, 56]
mcuRight = [HEX 55, AA, 6, FA, 0, 0, AA, 56]
mcuSpeed1 = [HEX 55, AA, 17, E9, 0, 0, AA, 56]
mcuSpeed2 = [HEX 55, AA, 1A, E6, 0, 0, AA, 56]
mcuSpeed3 = [HEX 55, AA, 18, E8, 0, 0, AA, 56]
mcuSpeed4 = [HEX 55, AA, 19, E7, 0, 0, AA, 56]