Ver 0.14
o Added compile option to place 601Hz signal on PD3 to use for timing calibration o Deleted watchdog ISR. o Minor cleanuppull/14/head^2
rodzic
2f99dc4fdc
commit
d0f7726b16
|
@ -214,7 +214,7 @@ void doSynchronization(void);
|
||||||
|
|
||||||
/* Set compare match register for 1hz increments
|
/* Set compare match register for 1hz increments
|
||||||
************************************************************
|
************************************************************
|
||||||
** USE THIS TO FIX BOARD PROCESSOR CLOCK ERROR
|
** USE THIS TO CALIBRATE FOR BOARD PROCESSOR CLOCK ERROR
|
||||||
************************************************************/
|
************************************************************/
|
||||||
/* first testing found bad drift relative to a gps stable clock (iphone timer) is was 10 seconds in about 50 minutes
|
/* first testing found bad drift relative to a gps stable clock (iphone timer) is was 10 seconds in about 50 minutes
|
||||||
* Today I measured the Arduino nano 16 Mhz clock and it was 16.050 MHz. Yes 50 Khz high!!
|
* Today I measured the Arduino nano 16 Mhz clock and it was 16.050 MHz. Yes 50 Khz high!!
|
||||||
|
@ -237,6 +237,9 @@ void doSynchronization(void);
|
||||||
TCCR2A = 0;
|
TCCR2A = 0;
|
||||||
TCCR2B = 0;
|
TCCR2B = 0;
|
||||||
TCCR2A |= (1 << WGM21); /* set Clear Timer on Compare Match (CTC) mode with OCR2A setting the top */
|
TCCR2A |= (1 << WGM21); /* set Clear Timer on Compare Match (CTC) mode with OCR2A setting the top */
|
||||||
|
#if CAL_SIGNAL_ON_PD3
|
||||||
|
TCCR2A |= (1 << COM2B0); /* Toggle OC2B (PD3) on compare match */
|
||||||
|
#endif /* CAL_SIGNAL_ON_PD3 */
|
||||||
TCCR2B |= (1 << CS22) | (1 << CS21) | (1 << CS20); /* 1024 Prescaler */
|
TCCR2B |= (1 << CS22) | (1 << CS21) | (1 << CS20); /* 1024 Prescaler */
|
||||||
OCR2A = 0x0C; /* set frequency to ~300 Hz (0x0c) */
|
OCR2A = 0x0C; /* set frequency to ~300 Hz (0x0c) */
|
||||||
/* Use system clock for Timer/Counter2 */
|
/* Use system clock for Timer/Counter2 */
|
||||||
|
@ -415,35 +418,6 @@ ISR(PCINT2_vect)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* Watchdog Timeout ISR
|
|
||||||
*
|
|
||||||
* The Watchdog timer helps prevent lockups due to hardware problems.
|
|
||||||
* It is especially helpful in this application for preventing I2C bus
|
|
||||||
* errors from locking up the foreground process.
|
|
||||||
************************************************************************/
|
|
||||||
ISR(WDT_vect)
|
|
||||||
{
|
|
||||||
static uint8_t limit = 10;
|
|
||||||
|
|
||||||
/* g_i2c_not_timed_out = FALSE; / * unstick I2C * / */
|
|
||||||
|
|
||||||
/* Don't allow an unlimited number of WD interrupts to occur without enabling
|
|
||||||
* hardware resets. But a limited number might be required during hardware
|
|
||||||
* initialization. */
|
|
||||||
/* if(!g_enableHardwareWDResets && limit)
|
|
||||||
* {
|
|
||||||
* WDTCSR |= (1 << WDIE); / * this prevents hardware resets from occurring * /
|
|
||||||
* } */
|
|
||||||
|
|
||||||
if(limit)
|
|
||||||
{
|
|
||||||
limit--;
|
|
||||||
/* g_last_error_code = ERROR_CODE_WD_TIMEOUT; */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* USART Rx Interrupt ISR
|
* USART Rx Interrupt ISR
|
||||||
*
|
*
|
||||||
|
@ -683,6 +657,7 @@ ISR(USART_UDRE_vect)
|
||||||
}
|
}
|
||||||
} /* End of UART Tx ISR */
|
} /* End of UART Tx ISR */
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Timer/Counter2 Compare Match B ISR
|
* Timer/Counter2 Compare Match B ISR
|
||||||
*
|
*
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
// #define COMPILE_FOR_ATMELSTUDIO7
|
// #define COMPILE_FOR_ATMELSTUDIO7
|
||||||
#define HARDWARE_EXTERNAL_DIP_PULLUPS_INSTALLED FALSE
|
#define HARDWARE_EXTERNAL_DIP_PULLUPS_INSTALLED FALSE
|
||||||
|
#define CAL_SIGNAL_ON_PD3 FALSE
|
||||||
|
|
||||||
#ifdef COMPILE_FOR_ATMELSTUDIO7
|
#ifdef COMPILE_FOR_ATMELSTUDIO7
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
|
@ -61,7 +62,7 @@
|
||||||
|
|
||||||
/******************************************************
|
/******************************************************
|
||||||
* Set the text that gets displayed to the user */
|
* Set the text that gets displayed to the user */
|
||||||
#define SW_REVISION "0.13"
|
#define SW_REVISION "0.14"
|
||||||
|
|
||||||
//#define TRANQUILIZE_WATCHDOG
|
//#define TRANQUILIZE_WATCHDOG
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ static const char textHelp[][23] = { "\nCommands:\n",
|
||||||
" RST - Reset\n",
|
" RST - Reset\n",
|
||||||
" SPD - ID code speed\n",
|
" SPD - ID code speed\n",
|
||||||
" STA - Start tones\n",
|
" STA - Start tones\n",
|
||||||
" SYN - Sync on/off\n",
|
|
||||||
" TEM - Temperature\n",
|
" TEM - Temperature\n",
|
||||||
" VER - S/W version\n" };
|
" VER - S/W version\n" };
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue