Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

functions in the while loop issues

Paul Chen
2010-05-19
2013-03-12
  • Paul Chen
    Paul Chen
    2010-05-19

    Hi,

    I am a newer of SDDC. The following are my codes, to do some memory access by 8051.
    Please kindly to give me some hints to solve them.
    Thank you very much.

    ===================================================================
    #include <stdint.h>
    #include <ds80c390.h>

    #define outputb(port, value)    (*((__xdata uint8_t *)(port)) = value)
    #define inputb(port)            (*((__xdata uint8_t *)(port)))

    #define MAIN_REG0        0x0000
    #define MAIN_REG1        0x0001
    #define MAIN_REG2        0x0002
    #define MAIN_REG3        0x0003

    // ---------------------------------------------------
    // 1. compile is ok, but cpu will not execute
    // ---------------------------------------------------
        while ((inputb(MAIN_REG3) & 0x10) == 0) {
            inputb(MAIN_REG0, 0x00);
            inputb(MAIN_REG1, 0x00);
            inputb(MAIN_REG2, 0x00);
        }
    // ---------------------------------------------------
    // 2. cannot compile
    // ---------------------------------------------------
        do {
            outputb(MAIN_REG0, 0x00);
            outputb(MAIN_REG1, 0x00);
            outputb(MAIN_REG2, 0x00);
        } while ((inputb(MAIN_REG3) & 0x10) == 0);

    ===================================================================
    In 2, I got a message while compiling.
    => Internal error: validateOpType failed in OP_SYMBOL(IC_RESULT (ic)) @ SDCCloop.c:1032: expected symbol, got value

    sincerely,
    Paul