This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MDU unit

hello ,
i am having some problems with the multiplication division unit of the xc878 infineon microcontroller.
i am trying to do a shift operation. the number to be shifted is a 32 bit. lets say i want to do this: 0x00FB00FF >> 16. i would require the MD0,MD1,MD2,MD3 registers. now my problem. i can load the MD0 and MD1 registers but i dont know how to load the MD2 and MD3 registers. please kindly help out.
stephen

Parents
  • hello everyone,

    thanks for your quick reply. i was wondering if it is possible to do that in C too. i am not familiar with Assembler.
    here is what i did i C. The function Shift_MDU gets two Parameters. param_5 is a 32bit
    number and param_6 is the number of shift to be performed. MDU_MD01 and MDU_MD23 are 16bit
    Registers. when i assign the 32 bit varaible(param_5) to the MDU_MD01, it automatically reads the 16 lower bits. now
    i cant seem to be able to read the other 16 high bits into the MDU_MD23 Register.

    int Shift_MDU(long int param_5, int param_6)

    {

    SYSCON0 |= 0x01;

    MDU_MD01 = param_5; MDU_MD23 = param_5; // dont know how to load this. MDU_MDUCON = 0x13; MDU_MD4 = 0x20 | param_6;
    // MDU_MD23=(param_5 & 0xFFFF0000)>> 16; // this is what should be loaded in the MD23 register while(MDU_BSY==1); erg_shift = (MDU_MR01); SYSCON0 &= ~(ubyte)0x01;

    return erg_shift;

    }

Reply
  • hello everyone,

    thanks for your quick reply. i was wondering if it is possible to do that in C too. i am not familiar with Assembler.
    here is what i did i C. The function Shift_MDU gets two Parameters. param_5 is a 32bit
    number and param_6 is the number of shift to be performed. MDU_MD01 and MDU_MD23 are 16bit
    Registers. when i assign the 32 bit varaible(param_5) to the MDU_MD01, it automatically reads the 16 lower bits. now
    i cant seem to be able to read the other 16 high bits into the MDU_MD23 Register.

    int Shift_MDU(long int param_5, int param_6)

    {

    SYSCON0 |= 0x01;

    MDU_MD01 = param_5; MDU_MD23 = param_5; // dont know how to load this. MDU_MDUCON = 0x13; MDU_MD4 = 0x20 | param_6;
    // MDU_MD23=(param_5 & 0xFFFF0000)>> 16; // this is what should be loaded in the MD23 register while(MDU_BSY==1); erg_shift = (MDU_MR01); SYSCON0 &= ~(ubyte)0x01;

    return erg_shift;

    }

Children