1wire.writebit
From Pinguino-Wiki
Contents |
Name
- 1wire.writebit
Description
Write a bit to the one-wire bus.
- Since Beta 9.5
Syntax
void 1wire.writebit(u8 DQpin, u8 val)
- Parameters
- DQpin = pin one-wire data (DQ) line (=one-wire bus) connected to
- val = value to be written ( 0 or 1 )
- Returns/Output;
- [None]
Example
void OneWireWrite(u8 DQpin, u8 val) { u8 i, temp; for (i=0; i<8; i++) // writes byte, one bit at a time { temp = val >> i; // shifts val right 'i' spaces temp &= 0x01; // copy that bit to temp 1wire.writebit(DQpin, temp); // write bit ont one-wire bus } }

