Skip to main content
Visitor II
February 18, 2004
Question

UART2 interupt problem

  • February 18, 2004
  • 2 replies
  • 528 views
Posted on February 18, 2004 at 14:44

UART2 interupt problem

    This topic has been closed for replies.

    2 replies

    jones2Author
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:58

    Hello,

    I have trouble getting uart 0 and 1 interrupts, I will

    try to set high priority, but even so, I have an error that

    I don't understand, and I suspect it might be the problem.

    In the ''upsd3200.h'' appears:

    // --- UART2 SFRS ----

    sfr SCON2 = 0x9A; // UART2 Serial Control

    sfr SBUF2 = 0x9B; // UART2 Serial Buffer

    and:

    /* SCON 2 */

    sbit SM02 = SCON2^7;

    sbit SM12 = SCON2^6;

    sbit SM22 = SCON2^5;

    sbit REN2 = SCON2^4;

    sbit TB82 = SCON2^3;

    sbit RB82 = SCON2^2;

    sbit TI2 = SCON2^1;

    sbit RI2 = SCON2^0;

    I get errors regarding the sbit declarations:

    ..\COMMON\UPSD3200.H(474): error C146: 'SCON2': invalid base address

    what could it be?

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:58

    steadicopter,

    SCON2 is not a bit-addressable SFR, only SCON is. As such, Keil won't let you define SFR bit variables (sbit) for this register. You'll have to use masks to turn individual bits on and off. As a matter of fact, I don't know how you could have a problem other than this error, because this will prevent you from compiling your source. Hope that helps.

    Best Regards,

    pHaze426