Sending GMLAN SWCAN High-voltage Wake-up Message using Visual Basic and the Gryphon DLL

This example illustrates a simple way to send a high-voltage wake-up message over a single wire CAN channel.

The following code snippet works under the assumption that a Gryphon session has been activated¹, and that the channel handle has been obtained² for the desired single-wire CAN channel.


Const GCANSWSTAT_HIVOLT = 4     ' from hw/dev_527.h
Dim tx_canframe(2) As Byte
tx_canframe(0) = &H1
tx_canframe(1) = &H23

Dim tx_gcframe As Long

tx_gcframe = dgCreateFrameHandle(FT_DATA)

dgSetHeaderLength(tx_gcframe, 2)
dgSetHeaderBits(tx_gcframe, 11)

dgSetErrorStatus(tx_gcframe, GCANSWSTAT_HIVOLT)

dgSetPayload(tx_gcframe, tx_canframe(0))
gSendFrame(hSession, hChannel, tx_gcframe)


Note that in the above code snippet, function call return value checking is omitted in order to more clearly demonstrate the required logic. In a real program, however, it is strongly recommended that every return value be checked for error conditions, and acted upon accordingly.

Footnotes

1  See dgBeginSession(), Gryphon C Library User's Manual, Dearborn Group Inc.
2  See dgGetChannel(), Gryphon C Library User's Manual, Dearborn Group Inc.