日期:2014-05-16  浏览次数:20761 次

不明白这种函数意思
int set_JD(int cdqd, int cdhd, int ctjd, int cwjd)
{
unsigned char data = 0x00;

if (ctjd)
data |= 0x80;
if (cwjd)
data |= 0x40;
if (cdqd)
data |= 0x20;
if (cdhd)
data |= 0x10;

write_dev(ORDER_WORD_ZERO, &data, 1);

return 0;
}
 

请问这种函数到底要做什么?

------解决方案--------------------
无非就是根据情况配置一个寄存器 没什么啊
------解决方案--------------------
看样子是设置某个寄存器的位。
------解决方案--------------------
lz可能缺乏c语言位运算的经验 才有疑惑
网上有很多 寄存器特定位 置一 置零的例子