Pages

Thursday, December 30, 2010

How to generate an IR beacon frequency with a microprocessor

Received by email from JL Blankenship

// F_CPU tells util/delay.h our clock frequency
//#define F_CPU 8000000UL // Orangutan frequency (8MHz)
#define F_CPU 20000000UL // Baby Orangutan frequency (20MHz)
#include
#include
uint16_t i;
void delayms( uint16_t millis ) {
while ( millis ) {
_delay_ms( 1 );
millis--;
}
}

int main( void ) {
DDRD |= 1 << DDD0; // set LED pin PD1 to output
DDRD &= ~(1 << DDD2); // set D2 to input
while ( 1 )
{
for(i=1;i<556;i++) // 10ms of 56K signal
{
PORTD &= ~( 1 << PORTD0 ); // LED off
_delay_us(9); // delay 9 microsec
PORTD |= 1 << PORTD0; // LED on
_delay_us(9); // delay 9 microsec
}
if (PIND & (1< _delay_us(100); // beacon 1
else
_delay_us(200); // beacon 2
}
return 0;
}

1 comment:

  1. Offline dollars in your move to online, to ensure that you can actually use all of the online customer service. Do you have in place of? You can quickly adjust the landing page and website copy? No sense, if you put in to send visitors to a site, sucking money from online advertising. If you are from offline to online money like two weeks to generate a 5:1 return, reducing the Prozac and think twice to come back. Leadgeneration

    ReplyDelete