![]() ZBasic System Library
319
ZBasic Microcontrollers
Type
Subroutine
Invocation
System.DeviceID(buffer)
Parameter
Method
Type
Description
buffer
ByRef
array of Byte
The array to which the identification characters will be written.
Discussion
A call to this routine will copy up to 10 bytes to the buffer provided. The data copied to the buffer
comprise characters of a string that identify the ZBasic device on which the progam is executing. The last
byte of the identification is followed by a zero byte that serves to mark the end of the identification
characters. The example below illustrates how the data can be used to create a string.
Although this subroutine is primarily intended for manufacturing test purposes, it may be useful for other
purposes as well.
Caution
If the array provided is less than 10 bytes long, subsequent memory may be overwritten, possibly with
detrimental results.
Example
Dim buf(1 to 10) as Byte
Dim idStr as String
Dim idx as Byte
Call System.DeviceID(buf)
idStr = MakeString(buf.DataAddress, SizeOf(buf))
idx = StrFind(idStr, Chr(0))
If (idx <> 0) Then
idStr = Left(idStr, idx - 1)
End If
Debug.Print idStr ' Displays "ZX24" on a ZX-24
Compatibility
This routine is not available in BasicX compatibility mode and it is supported only on ZX devices.
|