I put this sketch beginning together looking to conspire a way to enable communication/communicating with devices such as the PT2270/PT2260
https://dl.dropboxusercontent.com/u/10184778/PT2260R4_Princeton_Technology_Corp.pdf etc...
The interrupt driven sync-timer seem like place to begin.
/* 64 microsecond prescaled-clock MEGA2560 interrupt */
// NOTE MEGA2560 is target board,, it compiles. Based on datasheet code examples...
// Looking to develop either 2 or 2.5 interrupts per 9600 baud databit.
// Parameter framework ready for possible use. Would like to focus on 9600 baud
// prototype planning to extend toward the PT 12-bit implementation using soft modem
// with interrupt-driven delays.
#include <avr/io.h>
//typedef struct TIMER2_scaler_param {
// uint8_t de;
// int fl;
//}
//parameter;
//parameter TIMER2_scaler_param;
void setup(void)
{
// TCCR0B = (1<<CS02)|(0<<CS00); //Timer clock = system clock/256 16us
TCCR0B = (1<<CS02)|(1<<CS00); //Timer clock = system clock/1024 64us
TIFR0 = 1<<TOV0; //Clear TOV0
// clear pending interrupts
TIMSK0 = 1<<TOIE0; //Enable Timer0
//Overflow Interrupt
DDRB = 0x02; //Set PORTB1 as
//output
}
void init_Ex3(void)
{
ASSR = 1<<AS2; // Enable asynchronous mode
// Clear timer on compare match
// Timer Clock = system clock / 1024
// SET clear timer on compare mode WGM=1
TCCR2B = (1<<WGM22)|(1<<CS22)|(0<<CS21)|(1<<CS20);
TIFR0= 1<<OCF0B; // Clear OCF2/ Clear
// pending interrupts
TIMSK2= 1<<OCIE0B; // Enable Timer2 Output
// Compare Match Interrupt
OCR2B= 32; // Set Output Compare
// Value to 32
DDRB= 0xFF; // Set Port B as output
while (ASSR&(1<<OCR2BUB))
; // Wait for registers to update
}
// void interrupt [TIMER0_OVF0_vect] ;
void ISR_TOV0()
{
PORTB = ~PORTB; // Toggle pins on Port B
}
void loop(){
}