Quantcast
Channel: MEL PICBASIC Forum
Viewing all articles
Browse latest Browse all 4746

Is there a neater way to do this

$
0
0
I am revising some old code and was wondering if there was an easier way to do this

PARAM1 VAR WORD
PARAM2 VAR WORD
COMMAND VAR BYTE
TX_BUFF VAR BYTE [20]
LEN VAR BYTE

Old code
Code:

IF PARAM1.15 THEN
  PARAM1 = ABS PARAM1
  SerOut2 TX,6, ["SU ", #COMMAND, " -", #PARAM1]
ELSE
  SerOut2 TX,6, ["SU ", #COMMAND, " ", #PARAM1]
ENDIF

IF PARAM2.15 THEN
  PARAM2 = ABS PARAM2
  SerOut2 TX,6, [" -", #PARAM2]
ELSE
  SerOut2 TX,6, [" ", #PARAM2]
ENDIF

Same code but into an array so I can then send by using
HSEROUT [STR TX_BUFF\ LEN]

Is there an easy way to build the array and keep track of the length (LEN)

Thanks for looking,
Tim.

Viewing all articles
Browse latest Browse all 4746

Trending Articles