Hot!"SPBRGH1 = 0x00;" from MCC but SPBRGH1 = 0xC2 in the debug-mode

Author
BL
Starting Member
  • Total Posts : 76
  • Reward points : 0
  • Joined: 2011/01/23 10:15:14
  • Location: 0
  • Status: offline
2018/04/17 23:21:02 (permalink)
0

"SPBRGH1 = 0x00;" from MCC but SPBRGH1 = 0xC2 in the debug-mode

Hello,
 
I did generate an EUSART1 with the MCC. This writes an void EUSART1_Initialize(..) with the command "SPBRGH1 = 0x00;"
If I debug this, in the SPBRGH1 stays not 0 but 0xC2;

Can someone explain that?

Attached Image(s)

#1

7 Replies Related Threads

    qɥb
    Monolothic Member
    • Total Posts : 2632
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: online
    Re: "SPBRGH1 = 0x00;" from MCC but SPBRGH1 = 0xC2 in the debug-mode 2018/04/17 23:40:50 (permalink)
    +1 (1)
    ALWAYS specify which PIC you are talking about.
    Yes, it matters.
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #2
    BL
    Starting Member
    • Total Posts : 76
    • Reward points : 0
    • Joined: 2011/01/23 10:15:14
    • Location: 0
    • Status: offline
    Re: "SPBRGH1 = 0x00;" from MCC but SPBRGH1 = 0xC2 in the debug-mode 2018/04/18 01:02:19 (permalink)
    0
    Sorry, PIC18F67K22.
    #3
    qɥb
    Monolothic Member
    • Total Posts : 2632
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: online
    Re: "SPBRGH1 = 0x00;" from MCC but SPBRGH1 = 0xC2 in the debug-mode 2018/04/18 06:09:39 (permalink)
    +1 (1)
    What mode is the baud rate generator in?
    i.e. what value has been written to the BAUDCON register?
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #4
    BL
    Starting Member
    • Total Posts : 76
    • Reward points : 0
    • Joined: 2011/01/23 10:15:14
    • Location: 0
    • Status: offline
    Re: "SPBRGH1 = 0x00;" from MCC but SPBRGH1 = 0xC2 in the debug-mode 2018/04/18 07:25:41 (permalink)
    0
    void EUSART1_Initialize(void)
    {
        // Set the EUSART1 module to the options selected in the user interface.

        // ABDOVF no_overflow; TXCKP async_noninverted_sync_fallingedge; RCIDL idle; BRG16 8bit_generator; WUE disabled; ABDEN disabled; RXDTP not_inverted;
        BAUDCON1 = 0x40;

        // SPEN enabled; RX9 8-bit; RX9D 0; CREN enabled; ADDEN disabled; SREN disabled;
        RCSTA1 = 0x90;

        // TX9 8-bit; TX9D 0; SENDB sync_break_complete; TXEN enabled; SYNC asynchronous; BRGH hi_speed; CSRC slave_mode;
        TXSTA1 = 0x24;

        // Baud Rate = 9708.738; SPBRG1 102;
        SPBRG1 = 0x66;

        // Baud Rate = 9708.738; SPBRGH1 0;
        SPBRGH1 = 0x00;
        
        UartWDT1 = 30000;
        UartCo1 = 0;

    }

    #5
    qɥb
    Monolothic Member
    • Total Posts : 2632
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: online
    Re: "SPBRGH1 = 0x00;" from MCC but SPBRGH1 = 0xC2 in the debug-mode 2018/04/18 13:29:40 (permalink)
    +1 (1)
    BAUDCON1 = 0x40;

    That means the BRG16 bit is low, so the SPBRGH1 register is essentially disabled.
    It doesn't matter what it contains.
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #6
    PA91
    Starting Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2012/09/03 21:45:40
    • Location: 0
    • Status: offline
    Re: "SPBRGH1 = 0x00;" from MCC but SPBRGH1 = 0xC2 in the debug-mode 2018/04/22 22:46:22 (permalink)
    0
    Hi,
    I tested with the scenario that you have explained, with latest MPLABx(4.15), XC8(1.45) MCC 3.55.1.
    I am not seeing the behaviour that you are mentioning. I have attached the screenshot of the same.
     
    Please recheck once or you can provide me with the details related to MPLABx, XC8 and MCC version that you are using so that I can check with that.
    post edited by PA91 - 2018/04/22 22:48:32

    Attached Image(s)

    #7
    BL
    Starting Member
    • Total Posts : 76
    • Reward points : 0
    • Joined: 2011/01/23 10:15:14
    • Location: 0
    • Status: offline
    Re: "SPBRGH1 = 0x00;" from MCC but SPBRGH1 = 0xC2 in the debug-mode 2018/04/26 08:01:32 (permalink)
    0
    Thanks!

    I have it.
    #8
    Jump to:
    © 2018 APG vNext Commercial Version 4.5