Home > HMS NETWORKS > HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide

HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide

CAN@net NT/CANbridge NT Lua ADK  
C Funcons Called from Lua  
-- copy only 2 bytes from the source array  
format = array.compile("#1,0,#2,0x55")  
dest_array = array.repack(format, src_array)  
-- this corresponds to  
dest_array[1] = src_array[1]  
dest_array[2] = 0  
dest_array[3] = src_array[2]  
dest_array[4] = 0x55  
References to addional uncon parameters are also possible:  
-- copy 2 byte variables and 2 bytes from the source array to the  
destination array  
format = array.compile("@1,@2,#3,#4")  
dest_array = array.repack(format, src_array, var1, var2)  
-- this corresponds to  
dest_array[1] = var1  
dest_array[2] = var2  
dest_array[3] = src_array[3]  
dest_array[4] = src_array[4]  
Important to know:  
• The length of the desnaon array is directly given by the format string length.  
• The maximum value for a reference (e.g. #8) is the source array length.  
• The maximum number for variable references (e.g. @1) is 32.  
• Valid value for variables are 0to 255(unsigned byte).  
• The maximum value for a constant is 255, or 0xff.  
Funcon 'array.repack'  
dest_array = array.repack(format, src_array)  
Packs the data from the array src_arrayaccording to the compiled format string formatand returns the  
result array.  
Valid Operaons on Arrays  
Read a value:  
val = a[2]  
Write a value:  
a[l] = val  
Size of the array:  
num_bytes = #a  
Page 18 of 20  
4.02.0332.20002 Version 1.5  
GeneralDetails
NameHMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide
MakeHMS NETWORKS
LanguageEnglish
FiletypePDF (Download)
File size MB
Download PDF
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

If you have any questions regarding HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide, please ask here and describe the problem in detail.

Leave a Reply

Your email address will not be published. Required fields are marked *

2 × five =

HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide