Data & asynchronous transmission to use in wireless communications

pylon:
The receiving side has a photodetector that receives light

What hardware do you use there (links to datasheets)? Are you sure the hardware is able to receive with 200kHz and more?

The rise and fall time are typically 100ns which gives 10MHz.
BPW34S from Vishay: http://www.vishay.com/docs/81521/bpw34.pdf

pylon:
You changed the Manchester class to use direct port manipulation but you seemed to have fixed the TX pin to pin 8. BTW, these are not assembler commands that are just the register names you assign directly values to within C.

delayMicroseconds(HALF_BIT_INTERVAL);

but

//#define HALF_BIT_INTERVAL 1000 // microseconds

Seems you changed other things not mentioned here. I guess you should post the whole code you are using.

The class where i changed the TxPin was made so i could build a small routine where the user only had to insert the pin number and the program would adapt to the respective port. I would bypass the delays from digitalwrite and writing would be faster. Lets say it's a work in progress... :wink:

This is a comment that i forgot to clean "//#define HALF_BIT_INTERVAL 1000 // microseconds".
The real HALF_BIT_INTERVAL is defined on VLC.h: "unsigned int HALF_BIT_INTERVAL;"

On the VLC.cpp there is a function SetPW (HPW) where 'HPW' is half pulse width.
So, in the file, on the setup area, when i write: MANCHESTER.SetPW(2), i'm saying that my full period is 4us which means 250kHz.
If i want to write a '1' ('0')i have to send '01' (10') with identical duty-cycle. So, if i transform those bits back to NRZ i will get 125kHz. Hope this is clear..

pylon:
If you haven't changed the reception part too, it's executing the interrupt routine with 12.5kHz and this should be at least twice the half-bit frequency you set in the transmission part. There you set it to 500kHz (although you won't reach that but that's what the pulse length is) so you're sending 40 times as fast as your receiving. Did I miss something?

My bad for not explaining well what i did...

  1. I used the libraries MANCHESTER which are open-source to everyone and reached the same conclusion than you: i could transmit and receive at a maximum frequency of 12.5kHz with that library.
  2. Since i needed more Bandwidth i studied the library code and changed it so i could write to the port @ frequencies above 12.5kHz. I reached a point where i was happy with 250kHz. NOTE: i didn't tried or change the code on the receiver.
  3. But, analysing the signal through oscilloscope i realized that although the frequency was 250kHz the duty-cycle was not always perfect which could be a lot of trouble on the receiver.

So what i'm asking:
(a) I need to transmit a manchester coded signal above 200kHz and receive a NRZ signal with half transmit frequency. While it's transmitting or receiving the routines can not be interrupted. Can i do it with the method above (writing/reading directly to ports) or is there a better, more efficient way with a timer?

Thank you very much pylon.

Best Regards,
Fernando Oliveira