The ARRAYWRITE command prepends the LOOKUP or LOOKDOWN commands.
The ARRAYWRITE command loads what you want into a Table. In the code above, the ASCii "SOMETHING" is contained in the Table. The LOOKUP command pulls the ASCii letters from the Table one at a time and makes them available to the variable b1. If you wanted to send a dynamic value you could use:Code:b0 VAR BYTE b1 VAR BYTE Letter VAR BYTE[9] ARRAYWRITE Letter, ["SOMETHING"] FOR b0 = 0 TO 8 LOOKUP b0, [Letter], b1 HSEROUT b1 NEXT b0
In the above code an ADC value is read from AN3 to Pot then turned to ASCii ([#Pot]). If the Pot value is 133, "ARRAYWRITE Letter, [#Pot]" will load the Array "Letter" with "1", "3", and "3". The code is abbreviated to get the idea across, not intended to be plug-n-play.Code:Pot VAR BYTE b0 VAR BYTE b1 VAR BYTE Letter VAR BYTE[3] ADCIN 3,Pot ARRAYWRITE Letter, [#Pot] FOR b0 = 0 TO 2 LOOKUP b0, [Letter], b1 HSEROUT b1 NEXT b0
As for a 1000 Byte Array, PIC pages are limited to 256 bytes. You'll probably have to create 4 separate Tables to accommodate all 1000 variables. Consider an Array that contains the alphabet and numeric characters, or whatever, or a subroutine that converts your desired output to display-compatible format.




Bookmarks