Updated to disable the main clock's pre-scaler. Allows it to run at full 20MHz
This commit is contained in:
parent
eba8344e36
commit
04a4bc4dea
10
main.c
10
main.c
|
@ -26,6 +26,7 @@
|
|||
#include "ADC.h"
|
||||
#include "TriacOut.h"
|
||||
#include "load.h"
|
||||
#include <avr/cpufunc.h> /* Required header file */
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
|
@ -35,8 +36,17 @@
|
|||
void (*Delay_MicroSeconds)(double us) = _delay_us;
|
||||
//void (*Delay_MicroSeconds)(double us) = _delay_ms;
|
||||
|
||||
static void CLK_DisablePrescaler(void)
|
||||
{
|
||||
//CCP = CCP_IOREG_gc; /* Write the needed signature to CCP*/
|
||||
ccp_write_io((void *) & (CLKCTRL.MCLKCTRLA), 0x00); //select internal 20MHz clock.
|
||||
ccp_write_io((void *) & (CLKCTRL.MCLKCTRLB), 0x00); //Disable the pre-scaler.
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
CLK_DisablePrescaler();
|
||||
while(true){
|
||||
for(int i = 0; i < GatePulsesQty; i++){
|
||||
ZCD_Poll();
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
<file>file:/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/main.c</file>
|
||||
<file>file:/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/load.c</file>
|
||||
<file>file:/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/load.h</file>
|
||||
<file>file:/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/config.h</file>
|
||||
<file>file:/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/RegEdit.c</file>
|
||||
<file>file:/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/ADC.c</file>
|
||||
</group>
|
||||
</open-files>
|
||||
</project-private>
|
||||
|
|
Loading…
Reference in New Issue