Manchester encoding

I am learning about Manchester code. You think this quick and dirty approach would work? or do I need to do something more to speed it up? Is my approach super naive? I am trying to do this to use calibrate a device (opb9000). Note that I am content with just running this once by pushing the reset button. Like I said, quick and dirty.

int pin = 8; 

void setup() {
  // put your setup code here, to run once:
  pinMode(pin, OUTPUT);

  one();
  //delay(1);
  one();
  //delay(1);
  zero();
  //delay(1);
  zero();
  //delay(1);
  one();
  //delay(1);
  one();
   
}

void loop() {
  // put your main code here, to run repeatedly:

    

}

void zero()
{
  digitalWrite(pin, HIGH);
  //delay(1);
  digitalWrite(pin, LOW);
  //delay(1);
  
}

void one()
{
  digitalWrite(pin, LOW);
  //delay(1);
  digitalWrite(pin, HIGH);
  //  delay(1);
  
}

The beauty of Arduino is that you can try things and very quickly see if they work. Let us know if the test is successful.

so far... a no go. That said, it worked without calibration. I lucked out, I guess.

Manchester code is typically used for data transmission. You need an original value and a clock signal, then encode both into a transmission signal, then transmit and finally decode the signal at the receiver side. It's important that the clock signal is recovered properly by the receiver in asynchronous mode, using PLL or the like, or it has to be transmitted separately in synchronous mode (SPI, I2C...).

A relevant Atmel Application Note for Manchester coding/decoding:

Note that the arduino DUE provides an biphase Manchester II format within the USART features.

DrDiettrich:
Manchester code is typically used for data transmission. You need an original value and a clock signal, then encode both into a transmission signal, then transmit and finally decode the signal at the receiver side. It's important that the clock signal is recovered properly by the receiver in asynchronous mode, using PLL or the like, or it has to be transmitted separately in synchronous mode (SPI, I2C...).

DrDiettrich:
Manchester code is typically used for data transmission. You need an original value and a clock signal, then encode both into a transmission signal, then transmit and finally decode the signal at the receiver side. It's important that the clock signal is recovered properly by the receiver in asynchronous mode, using PLL or the like, or it has to be transmitted separately in synchronous mode (SPI, I2C...).

Technically, I do not think you need a clock. You just need to send it in a timed consistent fashion.

in a timed consistent fashion

Which requires a clock, somewhere.

ard_newbie:
A relevant Atmel Application Note for Manchester coding/decoding:

http://ww1.microchip.com/downloads/en/AppNotes/Atmel-9164-Manchester-Coding-Basics_Application-Note.pdf

Note that the arduino DUE provides an biphase Manchester II format within the USART features.

what? It has it built in? Hmmm…you think an stm32 would have that built in? Probably the wring forum to ask about that :slight_smile:

My code does not seem to work. It send it, but I do not get the logic low back. Either I am doing the calibration wrong, or the coding is not correct.