Coding Question: Making a ShiftIn
hey folks.
how go coding a"shiftin" function? have "clock in" , "data in", , want print results serial port.
thanks in advance!
how go coding a"shiftin" function? have "clock in" , "data in", , want print results serial port.
thanks in advance!

well, didn't around heres 1 wrote project of mine.
int shiftin() {
int cwt;
cwt=0;
bitmask=128;
while (bitmask >= 1) {
digitalwrite(shtclk, high);
cwt = cwt + bitmask * digitalread(shtdata);
digitalwrite(shtclk, low);
bitmask=bitmask/2;
}
return(cwt);
}
that msb first, other end changes data on rising edge of clock.
int shiftin() {
int cwt;
cwt=0;
bitmask=128;
while (bitmask >= 1) {
digitalwrite(shtclk, high);
cwt = cwt + bitmask * digitalread(shtdata);
digitalwrite(shtclk, low);
bitmask=bitmask/2;
}
return(cwt);
}
that msb first, other end changes data on rising edge of clock.
Arduino Forum > Forum 2005-2010 (read only) > Software > Interfacing > Coding Question: Making a ShiftIn
arduino
Comments
Post a Comment