Changed to using the reset default clock divider of 6. More stable given variable voltage, also reduces power consumption of attiny404.

This commit is contained in:
jakeg00dwin 2024-07-10 09:40:56 -07:00
parent c2424c47a8
commit 0a2c8b1dab
5 changed files with 11 additions and 31 deletions

20
main.c
View File

@ -9,7 +9,9 @@
* extracted into separate source files and headers for configuration. * extracted into separate source files and headers for configuration.
*/ */
#define F_CPU 2000000UL //#define F_CPU 2000000UL
#define F_CPU 3333333UL
//These defines are mostly useful for when you want you editors LSP server to //These defines are mostly useful for when you want you editors LSP server to
//function correctly. //function correctly.
@ -46,7 +48,7 @@ static void CLK_DisablePrescaler(void)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
CLK_DisablePrescaler(); //CLK_DisablePrescaler();
while(true){ while(true){
for(int i = 0; i < GatePulsesQty; i++){ for(int i = 0; i < GatePulsesQty; i++){
ZCD_Poll(); ZCD_Poll();
@ -55,20 +57,6 @@ int main(int argc, char **argv)
TriacOut_SetAllHigh(); TriacOut_SetAllHigh();
TriacOut_PulsePins(GatePulses[i]); TriacOut_PulsePins(GatePulses[i]);
} }
//The G1-G3 pins are low at this point.
_delay_ms(2500);
ZCD_Poll();
TriacOut_SetupPins();
TriacOut_SetAllHigh();
Load_HandleLoadPortA(ADC_LOAD1, 1);
Load_HandleLoadPortB(ADC_LOAD2, 3);
Load_HandleLoadPortB(ADC_LOAD3, 2);
while(true){
; //Do nothing until new Power cycle/reset occurs
}
} }
} }

View File

@ -1,11 +1,11 @@
# #
#Tue Jul 09 19:36:46 PDT 2024 #Wed Jul 10 08:03:09 PDT 2024
attiny404.com-microchip-mplab-mdbcore-PK5Tool-PK5ToolImpl.md5=8ed9aa4326bfc0c1a849e697826741b7
attiny404.languagetoolchain.version=2.46 attiny404.languagetoolchain.version=2.46
attiny404.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=bf89cdcdd6c0a49174fe4b605ef2b42d attiny404.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=bf89cdcdd6c0a49174fe4b605ef2b42d
conf.ids=,attiny404 conf.ids=,attiny404
host.id=2ov5-ff4p-rv host.id=2ov5-ff4p-rv
configurations-xml=e56c7c9ee537971b71816dcaac78a7cf configurations-xml=a2902459fa41badc4b7c9fbc5e9c3988
attiny404.platformTool.md5=null
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=f612087c95360c842296d189edfe3321 com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=f612087c95360c842296d189edfe3321
attiny404.languagetoolchain.dir=/opt/microchip/xc8/v2.46/bin attiny404.languagetoolchain.dir=/opt/microchip/xc8/v2.46/bin
proj.dir=/home/ronin/Documents/projects/freelance/laith_naaman/fg004a_test.X proj.dir=/home/ronin/Documents/projects/freelance/laith_naaman/fg004a_test.X

View File

@ -212,8 +212,6 @@
<property key="memories.programmemory" value="true"/> <property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-7ff"/> <property key="memories.programmemory.ranges" value="0-7ff"/>
<property key="poweroptions.powerenable" value="true"/> <property key="poweroptions.powerenable" value="true"/>
<property key="programmerToGoFilePath"
value="C:/Users/Lenovo/MPLABXProjects/fg004a.X/debug/default/fg004a_ptg"/>
<property key="programmerToGoImageName" value="fg004a_ptg"/> <property key="programmerToGoImageName" value="fg004a_ptg"/>
<property key="programoptions.donoteraseauxmem" value="false"/> <property key="programoptions.donoteraseauxmem" value="false"/>
<property key="programoptions.eraseb4program" value="true"/> <property key="programoptions.eraseb4program" value="true"/>
@ -316,7 +314,7 @@
<targetDevice>ATtiny404</targetDevice> <targetDevice>ATtiny404</targetDevice>
<targetHeader></targetHeader> <targetHeader></targetHeader>
<targetPluginBoard></targetPluginBoard> <targetPluginBoard></targetPluginBoard>
<platformTool>PK5Tool</platformTool> <platformTool>noID</platformTool>
<languageToolchain>XC8</languageToolchain> <languageToolchain>XC8</languageToolchain>
<languageToolchainVersion>2.46</languageToolchainVersion> <languageToolchainVersion>2.46</languageToolchainVersion>
<platform>2</platform> <platform>2</platform>
@ -467,8 +465,6 @@
<property key="memories.programmemory" value="true"/> <property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-7ff"/> <property key="memories.programmemory.ranges" value="0-7ff"/>
<property key="poweroptions.powerenable" value="true"/> <property key="poweroptions.powerenable" value="true"/>
<property key="programmerToGoFilePath"
value="C:/Users/Lenovo/MPLABXProjects/fg004a.X/debug/default/fg004a_ptg"/>
<property key="programmerToGoImageName" value="fg004a_ptg"/> <property key="programmerToGoImageName" value="fg004a_ptg"/>
<property key="programoptions.donoteraseauxmem" value="false"/> <property key="programoptions.donoteraseauxmem" value="false"/>
<property key="programoptions.eraseb4program" value="true"/> <property key="programoptions.eraseb4program" value="true"/>

View File

@ -22,7 +22,7 @@
</runprofile> </runprofile>
</conf> </conf>
<conf name="attiny404" type="2"> <conf name="attiny404" type="2">
<platformToolSN>:=MPLABComm-USB-Microchip:=&lt;vid>04D8:=&lt;pid>9036:=&lt;rev>0100:=&lt;man>Microchip Technology Incorporated:=&lt;prod>MPLAB PICkit 5:=&lt;sn>020026702RYN031742:=&lt;drv>x:=&lt;xpt>b:=end</platformToolSN> <platformToolSN>noToolString</platformToolSN>
<languageToolchainDir>/opt/microchip/xc8/v2.46/bin</languageToolchainDir> <languageToolchainDir>/opt/microchip/xc8/v2.46/bin</languageToolchainDir>
<mdbdebugger version="1"> <mdbdebugger version="1">
<placeholder1>place holder 1</placeholder1> <placeholder1>place holder 1</placeholder1>

View File

@ -3,12 +3,8 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group> <group>
<file>file:/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/main.c</file> <file>file:/home/ronin/Documents/projects/freelance/laith_naaman/fg004a_test.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_test.X/config.h</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> </group>
</open-files> </open-files>
</project-private> </project-private>