Home Contents | # v4kf:chipWrite | V4kf | Core4 Lua Event System

## SYNOPSIS

1. rdrhandle:chipWrite(address, data [, i [, j]])
2. rdrhandle:chipWriteEx(clains, address, data [, i [, j]])

## DESCRIPTION

Write data to the chip card. The optional parameters i and j select the substring data[i], data[i+1], ···, data[j]. The default value for i is 1, the default for j is the length of data.

The chip card must have been enabled by calling v4kf:chipEnable before it can be written. In addition, some chips allow writing only if a read command has been issued beforehand to avoid accidental writes.

This command can only be used if the reader is in the Locked state, which ensures that the chip contact is engaged and stays so for the whole operation.

While this state processes, the reader is in the Processing state and v4kf:isProcessing() returns true. The reader returns to the Locked state on completion.

The command returns immediately. Actual execution of any reader operation is done within the event loop.

The processing result is provided with the v4kf.processingComplete() callback.

The second form, chipWriteEx() supports an extra parameter that allows access to special memory on the chip card.

clains | SLE4418
--- | ---
0x3333 | Write and erase without protect bit (default)
0x3331 | Write and erase with protect bit
0x3330 | Write protect bit with data comparison (verification)

clains | SLE4428
--- | ---
0x3233 | Write and erase without protect bit (default)
0x3231 | Write and erase with protect bit
0x3230 | Write protect bit with data comparison (verification)

To change the pin code on a SLE4428, write the new pin to normal memory addresses 1022 and 1023.
The error counter bits are at normal memory address 1021.

clains | SLE4432
--- | ---
0x3138 | Update main memory (default)
0x313C | Update protection memory

clains | SLE4442
--- | ---
0x3038 | Update main memory (default)
0x303C | Update protection memory
0x3039 | Update security memory

To change the pin code on a SLE4442, write the new pin to security memory (0x3039) addresses 1 to 3.
The error counter bits are at security memory (0x3039) address 0.

## RETURN VALUE

Returns true if the command was accepted, false if not.

## SEE ALSO

v4kf:chipDisable, v4kf:chipEnable, v4kf:chipRead, v4kf:chipActivate, v4kf:state