Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 1.99 KB

File metadata and controls

26 lines (19 loc) · 1.99 KB

Serial Port VBA Functions - Minimal Set

All functions support one pre-defined Com Port number with existing pre-configured settings only
VBA Function Returns Description
start_com_port Boolean 1 Starts com port with existing settings
read_com_port String Returns all 2 waiting characters from com port
read_com_port(6) String Returns up to 2 specified number (6) of waiting characters from com port
send_com_port($B$5) Boolean 1 Sends 3 contents of Cell $B$5 to com port (Excel Worksheet Only)
send_com_port("QWERTY") Boolean 1 Sends 4 supplied character string to com port
send_com_port(COMMANDS) Boolean 1 Sends 4 character string defined in VBA constant or variable COMMANDS to com port
stop_com_port Boolean 1 Stops com port and returns its control back to Windows
Com Port number defined in declarations section at start of module

Private Const COM_PORT_NUMBER as Long = 1

Footnotes

  1. Function returns True if successful, otherwise False 2 3 4 5

  2. Maximum characters returned = read buffer length (fixed value)
    More waiting characters beyond read buffer length may remain unread until next read_com_port call. 2

  3. Excel will re-send if cell $B$5 contents change.

  4. Function will block until all characters are sent or write total constant timer expires.
    Maximum characters sent limited by timer Write_Total_Timeout_Constant value. 2