方法C:
#define bwMCDR2_ADDRESS 4
#define bsMCDR2_ADDRESS 17
int BIT_MASK (int_bf)
{
return ((IU<<(bw##_bf))-1)<<(bs##_bf);
}
void SET_BITS(int_dst,int_bf,int_val)
{
_dst=((_dst) & ~ (BIT_MASK(_bf)))I\ (((_val)<<<(bs##_bf))&(BIT_MASK(_bf)))
}
SET_BITS(MCDR2,MCDR2_ADDRESS,RegisterNumber);
方法D:
#define bwMCDR2_ADDRESS 4
#define bsMCDR2_ADDRESS 17
#define bmMCDR2_ADDRESS BIT_MASK (MCDR2_ADDRESS)
#define BIT_MASK(_bf)(((1U<<(bw##_bf))-1)<< (bs##_bf)
#define SET_BITS(_dst,_bf,_val)\ ((_dst)=((_dst)&~(BIT_MASK(_bf)))I (((_val)<<(bs##_bf))&(BIT_MASK(_bf))))
SET_BITS(MCDR2,MCDR2_ADDRESS,RegisterNumber);
这两个程序不太看懂啊。能解释一下下吗?
----------------解决方案--------------------------------------------------------
与硬件有关的东西吧,请把协议看懂再看代码!!
----------------解决方案--------------------------------------------------------