NHD‐0220D3Z‐NSW‐BBW Default Baud Rate

Comments

4 comments

  • Engineering Support
    Community moderator

    Hi David,

    Thanks for your post.  The default baud rate of this display should be 9600, but the baud rate can be changed using the "Change RS-232 BAUD rate" command.  This can be verified by sending the "Display RS-232 BAUD rate" command or by placing the display in self-test mode by populating R1 and R2 with 0Ω resistors.  Can you share which example code you are referring to?

    0
  • David VB

    Hi,

    Thank you for your quick answer.

    In the datasheet of the display, there is a link to an example code:
    http://www.newhavendisplay.com/app_notes/Serial_LCD.txt

    And in this example, the code to initialize the USART of the "Master" PIC (PIC18F2321) is the following:

    void init_rs232(void)
    {
    	TXSTA = 0x26;			// rs232 transmit status register
    	RCSTA = 0x80;			// serial port enable
    	BAUDCTL = 0x08;			// BRG16 = 1;
    	SPBRG = 207;
    	SPBRGH = 0;
    }


    Which, if I'm not mistaken, sets the baud rate to 2400 baud (for a clock speed of 8 MHz, as stated on the beginning of the example)

    OSCCON |= 0x73;			// internal RC, 8MHz
    

    (Which, BTW, should (I think) be OSCCON = 0x73)

    If this code is used for the very first time with a display (set by default at 9600 baud), this will not work.  Therefore the confusion....

    If you do agree, may I suggest this example code being adapted ?  (SPBRG should be set to 51)

    Thanks a lot,

    Have a nice day,

    David.




    0
  • Engineering Support
    Community moderator

    Hi David,

    Thanks for clarifying.  I do believe you're right and I suspect the baud rate may have been mistakenly calculated for 16-bit mode rather than 8-bit mode.  I will see to have this corrected in the example code.  If I'm not mistaken, I believe setting SPBRG = 51 should correctly set the baud rate to 9600.

    0
  • David VB

    Thank you for your interest :-)
    Glad I could help!


    Kind regards,

    David

    0

Please sign in to leave a comment.