Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Serial1.write9bit(word) usage question

  1. #1
    Junior Member
    Join Date
    Jul 2019
    Posts
    1

    Serial1.write9bit(word) usage question

    Hi,

    Anyone have an example or explanation on how to use Serial1.write9bit(word) for Teensy 3.2 to set or cleared the 9th bit? I am new to Teensy. I was able to modify the HardwareSerial.h with SERIAL_9BIT_SUPPORT. I am able to compiled with HWSERIAL.begin(115200, SERIAL_9N1);

    I am confused on how to set or cleared the 9th bit. Could anyone provide me an example?

    For instance, I am trying to send a byte 0x32 with 9th bit set. Do I use: Serial1.write9bit(0x328) ? Since 0x8 is 1000 (bits)
    and if my byte is 0x01 with 9th bit cleared: do I use Serial1.write9bit(0x010) ?


    Thank you

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,322
    Quote Originally Posted by sheng View Post
    For instance, I am trying to send a byte 0x32 with 9th bit set.
    Try Serial1.write9bit(0x132)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •