First thought is that you need a generic Buffer sized to the length you want to send. For example:
Code:
LCD_Buffer VAR BYTE[18]
I use the ARRAYWRITE command for what I think you're asking. Here is a piece of code that fills in blanks to my Buffer and loads them for a UART send:
Code:
Send_Vac: ;Send Current Vacuum Reading to Nextion
tVac = Vac ;Create a Temporary Variable We Can Modify
ARRAYWRITE NexBuf, ["vac.val="] ;Start Nextion Command Sequence, Occupies NexBuf[0] >> [7]
IF tVac > 100 THEN ;If 3 Digits
b0 = tVac / 100 ; Get the Xxx Value
NexBuf[8] = b0 + $30 ; Convert it to ASCii
tVac = tVac - (b0 * 100) ; Subtract the Xxx Value from tVac
IF tVac < 10 THEN ;If xXx = 0
NexBuf[9] = $30 ;If tVac < 10, it's Zero (ASCii)
ENDIF ;IF tVac < 10
ELSE ;tVac < 100
NexBuf[8] = $30 ;If tVac < 100, 1st Digit is Zero (ASCii)
ENDIF ;IF tVac > 100
IF tVac > 10 THEN ;If Now Double Digit
b0 = tVac / 10 ;Get the xXx Value
NexBuf[9] = b0 + $30 ;Convert it to ASCii
tVac = tVac - (b0 * 10) ;Subtract the xXx Value from tVac
ELSE ;tVac < 10
NexBuf[9] = $30 ;If tVac < 10, it's Zero (ASCii)
ENDIF ;IF tVac > 10
NexBuf[10] = tVac + $30 ;Convert xxX to ASCii & Write to Buffer
FOR b0 = 11 TO 13 ;Generate "End of Message" Sequence: $FF, $FF, $FF
NexBuf[b0] = $FF ;Load it to Buffer
NEXT b0 ;FOR b0 = 11 TO 13
NexBuf[14] = 0 ;Tells Us To Turn UART TX INT Off
RotX = 0 ;NexFlags.RotX -- Clear RotX Flag
GOTO Start_TX ;No RETURN Needed, Using GOTO Command
Bookmarks