Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

PUT

Description

The PUT command is the counterpart of the GET command. With PUT, one can send contents of variables and arrays to various destinations. PUT needs two or three arguments. The first one is the handle to the I/O interface, where data is sent to. The second one is the variable that contains the data. If this is an array, PUT needs a third argument which indicates how many array elements should be sent.

PUT knows these destinations (handles):

Handle number

Interface type

Description

Firmware
required

300 to 201

UDP

Handle for UDP channel  

200 to 101

TCP

Handle for TCP connection  

 100 to 1

 File

Handle for file on SD card  
       

-2

Data Interface

Currently selected data interface (synchronous)  

-3

 Data Interface

Currently selected data interface (asynchronous).
Async. mode means, that PUT always send data and does not wait for the receiver to acknowledge it.
 
       

-4

 RS232

Auxiliary (= 2nd) RS232 interface (asynchrounous)  

-5

I2C

I2C interface in Master mode using stop condition   

-6

I2C

I2C interface in Master mode not using stop condition  

-7

CAN

Primary CAN interface. Only arrays are allowed. Either the array size or PUTs third argument must be a multiple of 28. The array is seen as one ore more consecutive CAN frames. For a description of the structure of those CAN frames, please see the GETCAN and PUTCAN commands. > 3.36

 -8

CAN

Auxiliary (2nd) CAN interface. Same restrictions apply as for the normal CAN(-1) interface.  
       

-100 to -105

WEB

One of the six edit controls of the web page  

-201 to -224

I/O ports

Digital I/O and PWM ports > 3.48


Valid sources for PUT are:

The TIME pseudo variable

The TIME$ pseudo variable

The KEYS pseudo variable

The DATE$ pseudo variable

Arrays, either complete or the first few elements

Single elements of byte- and integer arrays

Constant values

Strings

32 bit signed integer variables

Example

The following example sends the first three bytes of an array asynchronously to the current I/O interface and the TIME$ pseudo variable afterwards.

DIM a(20)
LET a(0) = 1
LET a(1) = 2
LET a(2) = 3
PUT -3, a, 3
PUT -3, TIME$ 

Remarks

PUT tries to send as much bytes as the lenght of the source variable in bytes is. Except for arrays, where the number-of-elements argument must be given.

When PUT returns, the pseudo variable LASTERR can be read to detect failures. If LASTERR is not zero (ERR_OK), an error occured.

The handles -4, -5 and -6 must be opened with AUXOPEN, -2 and -3 are always open, if any kind of default I/O interface is active. Also -100...-105 are always open. Other handles must be explicitely opened using the appropriate functions.

If the CAN interfaces (-7 and -8) are used as destination, only arrays are allowed to PUT. In addition, if a complete array shall be send over the CAN interface, the size of that array must be a multiple of 28. If only the first few bytes of an array shall be send, then PUTs third argument must be a multiple of 28.

If PUT is used on digital I/O ports (handles -201...-224), the second argument must be a constant or a single integer variable. In this case, PUT automatically switches the pin to output mode.

 


See also: