Microcontroller › AVR › Make a half duplex IR data modem – using obstruction sensors › I am planning to make modem
I am planning to make modem prototype using 2 obstacle sensors. One I will be using as receiver and other one as transmitter
PORTA- ADC
Transmitter code-
DDRA|=0xff;
while(1)
{
sbi(PORTA,0);
_delay_ms(1000);
cdbi(PORTA,0);
_delay_ms(1000);
}
RECEIVER
int main(void)
{
int c=0;
uart_init(UART_BAUD_SELECT(9600,F_CPU));
sei();
uart_puts(“initialized”);
DDRA|=0x00;
while(1)
{
c=bit_is_clear(PINA,0);
if(c==1)
{
uart_putc(‘A’);
uart_puts(“hello”);
}
else
{
uart_putc(‘B’);
}
}
}
Is it right?