ActiveX LIN Master Object
KIT33912EVME System Basis Chip with LIN Tranceiver Setup Instructions, Rev. 2.0
Freescale Semiconductor
25
Chapter 8 ActiveX LIN Master Object
8.1
Overview
The chapter gives a basic description of the ActiveX LIN Master Object. This object is able to perform LIN Master tasks on a PC
and can be used for LIN network control from an HTML page. The following section provides the basic information:
•
8.2
Quick Reference
An ActiveX control is an object that supports the LIN Master functionality. It is delivered as the cabinet (.cab) file “flinbox.cab”. An
ActiveX control is identified by object in an HTML file. If the control has been stored in a “.cab” file, the object must include a
CODEBASE attribute that specifies the URL for this “.cab” file. The following excerpt from a sample HTML file demonstrates how
the object and the CODEBASE attribute are used.
<OBJECT id="lin" name="lin" height="1" width="1"
classid="clsid:A6D06BA3-A530-45FF-A02F-48A9B82BB25B"
codebase="flinbox.cab#Version=1,2,0,4">
<PARAM name="BaudRate" value="9600">
<PARAM name="PortName" value="COM1">
</OBJECT>
The FLINBOX.LinMaster object has 6 methods and 3 properties:
•
bool OpenPort([vPortName, vBaudRate]);
— Open RS232 port. It must be called before any other function. Returns true when successful.
–
vPortName
(string) - RS232 port to open. Optional, default COM1.
–
vBaudRate
(numeric) - Communication speed. Optional, default 9600.
•
void ClosePort()
;
— Close RS232 port
•
bool SendMessage(vIdent, vData [, vDataLen])
;
— Send LIN message and return true if succeeded.
–
vIdent
(numeric) - Message ID byte.
–
vData
(string/array) - Data to send, passed either as a VBScript array or a semicolon-delimited string.
–
vDataLen
(numeric) - Length of data to be sent. Optional, default 0 which forces calculation of the length from
the vData parameter (do not use 0 for VBScript arrays, as they always contain one dummy
item at the end).
•
string RecvMessage(vIdent, vExpectedDataLen [, vData])
;
— Requests and receives a LIN message. Function returns the number of bytes received. It returns 0 for checksum
errors or timeouts.
–
vIdent
(numeric) - Message ID byte.
–
vExpectedDataLen
(numeric) - Length of data to be received. When set to 0, up to 255 bytes are received
using the maximum timeout value for that size.
–
vData
(output array) - VBScript array of the returned data. Optional, use the
LastRecvData
property to get the
data after this call.
•
bool Sleep();
— Put the node the Sleep mode. In this mode, the port remains open and the master waits for the wakeup character
(0x80, 0xC0 or 0x00). After this is received, the OnWakeup event is triggered. You can handle the OnWakeup event
using the VBScript handler. The Sleep mode is aborted by a call to the Wakeup, SendMessage or RecvMessage
functions. Even in the OnWakeup event, you remain in the Sleep mode until one of these three functions is called.