We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
This is how you can do it in assembly language:
#include <xc878.h> ULSHR: MOV A,R0 JZ RETURN ANL A,#1FH ORL A,#20H MOV MDU_MD0,R7 MOV MDU_MD1,R6 MOV MDU_MD2,R5 MOV MDU_MD3,R4 MOV MDU_MDUCON,A LCALL ?C?WAIT18 ;WAIT 18 CYCLES MOV R7,MDU_MD0 MOV R6,MDU_MD1 MOV R5,MDU_MD2 MOV R4,MDU_MD3 RETURN: RET
Note that this code is not tested, you should verify (using the datasheet) that it is working with the MDU of the XC878.