/*************************************************************************/ #include #include #include #include /*************************************************************************/ /* Global variables */ /*************************************************************************/ /*************************************************************************/ /* flash[0] maps to OCR0 register */ /* flash[1] maps to TCCR0 register */ unsigned char flash[2]; /* delay maps to OCR1A register*/ unsigned int delay; /* current is a 8 bit variable to control external DAC through SPI */ unsigned char current_sld, imax_sld, current_led, imax_led; /*select output SLD or LED */ unsigned int outputcurrent; /* TriggeringMode controls triggering mode */ enum {EXT_DIGITAL, EXT_ANALOG, INTERNAL} TriggeringMode; /* Frequency variable */ unsigned char Frequency; unsigned char sndDelaylow,sndDelayhigh, sndFlash1, sndFlash2; /*************************************************************************/ void configure_USART(unsigned int baudrate) { // Set the baud rate UBRRH = (unsigned char) (baudrate>>8); UBRRL = (unsigned char) baudrate; // Enable USART receiver and transmitter UCSRB = (1<>8); EEPROM_write(3,delay); EEPROM_write(7,sndDelaylow); EEPROM_write(8,sndDelayhigh); asm("sei"); } /*************************************************************************/ void setCurrentSLD(void) { asm("cli"); current_sld=USART_receiveByte(); PORTB=(1<=2*TriggerOutputHighTime) count=0; else count++; if(positive_edge) { /* Load On-Compare Timer1 Register */ OCR1A=delay; /* Reset Timer1 Counter */ TCNT1=0; /* enable Timer1-On-Compare1A and Timer2-On-Compare interrupts*/ TIMSK=(1<=50) { /* Disable itself */ GICR=(0<=25) { /* Disable itself */ GICR=(0<=15) { /* Disable itself */ GICR=(0<=5) { /* Disable itself */ GICR=(0<=3) { /* Disable itself */ GICR=(0<=2) { /* Disable itself */ GICR=(0<=1) { /* Disable itself */ GICR=(0<=100) { /* Disable itself */ GICR=(0<=50) { /* Disable itself */ GICR=(0<=30) { /* Disable itself */ GICR=(0<=10) { /* Disable itself */ GICR=(0<=6) { /* Disable itself */ GICR=(0<=4) { /* Disable itself */ GICR=(0<=2) { /* Disable itself */ GICR=(0<