Hey I have created a single line high speed serial communications interface. This post is for those that want more information.
The system is very simple, to keep it compact. First a Start bit is transmitted along the line followed by 8 data bits. The HIGH state of the transmission line indicates a 1 and the LOW state indicates a 0. There are two options for the serial transmission. Single line or double line. Double line is more similar to an SPI interface because it is full duplex. Single line mode is half duplex. With single line mode the controller will sit in recieve mode until the write pin is brought high. At that point it will jump into transmit mode for the duration of transmission and then return to recieve mode.
Pseudocode for using these devices:
void transmit(uint8_t x) {
write(regSend, x);
portTriggerPin(write);
}
uint8_t recieve (uint8_t * x) {
*x = portTriggerPin(read);
if (portTestPin(recieve)) {
return 0;
} else {
return 1;
}
}
Example Master:
int main() {
uint8_t recieved;
while (1) {
transmit(0x4a);
while (recieve(&recieved));
printf("Recieved: %d", recieved);
}
return 0;
}
Example Slave:
int main() {
uint8_t recieved;
while (1) {
while(recieve(&recieved));
if (recieved == 0x4a) {
transmit(0x10);
} else {
transmit(0x01);
}
}
}
Limitations:
Hey!!!!! I connected mine directly to your line and guess what? My receiver reads your signals perfectly! It follows the TPTS!!! When you built yours, did you pay close attention to getting exactly 1bit/8 frames?
This should really be a thing- I mean it's so simple to understand, and yours is an even better example of how small it can be. Anyone with a bit of digital knowledge could attach it to their creations. I would love to see this take on a bigger presence in the game.
Although, I would prefer if my secondary address byte were included in the standard for networking... <3
Just think of it as sending 16 bits, my devices use no gap between bytes.