HSerSendBytes

Syntax:

    HSerSendBytes(byte1, byte2 [, byte3 ... up to byte16])

Command Availability:

Available anywhere HSerSend is available, once usart.h has been loaded.

Enabling Constants:

The same enabling constants as HSerSend apply.

    'USART settings for USART1
    #define USART_BAUD_RATE 9600
    #define USART_TX_BLOCKING
    #define USART_DELAY OFF

Explanation:

HSerSendBytes sends between 2 and 16 bytes in a single call, in the order given, instead of writing one HSerSend call per byte. Each byte is sent to the default or currently configured comport; there is no comport argument, so a byte that must go to a specific comport should still be sent with HSerSend(user_byte, comport).

Example:

    #chip 16F877A, 20

    #define USART_BAUD_RATE 9600
    #define USART_TX_BLOCKING
    #define USART_DELAY OFF

    Dir PORTC.6 Out

    Do
      HSerSendBytes(1, 2, 3)   ' <<< the HSerSendBytes instruction
      HSerSend(13)             ' sends a CR
      Wait 100 ms
    Loop

Key line: HSerSendBytes(1, 2, 3) — sends the three bytes 1, 2 and 3, in that order, in a single call.

See Also:

  • HSerSend — sending a single byte, or a byte to a specific comport
  • HSerPrint — sending a string, integer, word, or long, rather than raw bytes
  • Dir — setting the pin directions before sending, as used above