ふらっとVisual C#,C♯,C#(初心者用) Part105
■ このスレッドは過去ログ倉庫に格納されています
0766デフォルトの名無しさん
2013/08/30(金) NY:AN:NY.AN例えばReadだったら↓みたいに、1ビットずつポート呼んでBYTEにしてるんだよ。だからハードのUART扱うのは別にあるって・・・
// confirm that this is a real start bit, not line noise
if (digitalRead(_receivePin) == LOW) {
// frame start indicated by a falling edge and low start bit
// jump to the middle of the low start bit
delayMicroseconds(bitDelay / 2 - clockCyclesToMicroseconds(50));
// offset of the bit in the byte: from 0 (LSB) to 7 (MSB)
for (int offset = 0; offset < 8; offset++) {
// jump to middle of next bit
delayMicroseconds(bitDelay);
// read bit
val |= digitalRead(_receivePin) << offset;
}
■ このスレッドは過去ログ倉庫に格納されています