View Single Post
Old Dec 22, 2009, 02:16 PM
MelihK is offline
Find More Posts by MelihK
MelihK's Avatar
United Kingdom, England, Canterbury
Joined May 2008
1,371 Posts
Quote:
Originally Posted by HappyKillmore View Post
I'm hoping Remzibi! Not sure what kind of hardware mods you must do to make this work.
You dont need any hardware for AFSK modulation over your OSD.
I guess Remzibi using Atmega32 Processor and it is not problem for this processors.
I write small how to for all OSD developers.

Small How to for Atmega Users

Using PWM generator for creating 2100Hz Carrier Waves:

Code:
TCCR1B   =   0x00;   //stop timer
TCNT1H   =   0;
TCNT1L   =   0;
ICR1   =   ((Xtalfrequency/8) / 2100);   //2100hz carrier generator value 878 for 14.7Mhz
OCR1B   =   ((Xtalfrequency/8) / 2100)/2;   // ICR1 / 2 for %50 PWM waves
TCCR1A   =   0x22;   
TCCR1B   =   0x1A; //start timer
This code generates 2100hz audible waves from CPU's second(B) PWM port.

You can send the bytes any time in your main code flow because AFSK protocol following waves not time sensitive protocol.

Generating Bytes over AFSK protocol

Code:
modem_bit = 0;
while (modem_bit<18)	//wait for all bit waves
	{
		 
	if ((modem_bit%2==0) && ((PINB & (1 << 2))) ) // wait for 1 on PWM output. 
	  {
	  if (modem_bit==0)  // start bit
		 {
		 TCNT1H = 1;   // this values creates small delay for increasing the wave width
		 TCNT1L = 180; // and AFSK decoder can detect this big waves to 1, other small(2100hz) waves 0
		 }
		
	   if (modem_bit>1)
		 {
		 if (modem[modem_byte] & (1<<((modem_bit-2)/2))) // if bit of bte is 1, change the wave width for 1 on AFSK
		   {
		   TCNT1H = 1;   // this values creates small delay for increasing the wave width
		   TCNT1L = 180; // and AFSK decoder can detect this big waves to 1, other small(2100hz) waves 0
		   }
		 }
		 
	  modem_bit++;
	  }

	if ((modem_bit%2==1) && (!(PINB & (1 << 2)))) // wait for 0 on PWM output  
	  {   
	  modem_bit++;
	  }
	}

I hope this GCC code will enough for all Atmel users. You can send any value over AFSK protocol over this system.

Notice for Coders: I'm sharing this code for using it with my shared Audio Telemetry Modem Protocol and creating a software pool for all FPV community with Software developers. Please(and please again) dont use it for making non compatible products on our FPV market.
MelihK is offline Find More Posts by MelihK
Site Sponsor
Reply With Quote