added servo version initial
This commit is contained in:
parent
c75afc0f18
commit
3f14db0941
|
@ -0,0 +1 @@
|
||||||
|
bikegenerator
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||||
|
<resourceExtensions />
|
||||||
|
<wildcardResourcePatterns>
|
||||||
|
<entry name="!?*.java" />
|
||||||
|
<entry name="!?*.form" />
|
||||||
|
<entry name="!?*.class" />
|
||||||
|
<entry name="!?*.groovy" />
|
||||||
|
<entry name="!?*.scala" />
|
||||||
|
<entry name="!?*.flex" />
|
||||||
|
<entry name="!?*.kt" />
|
||||||
|
<entry name="!?*.clj" />
|
||||||
|
</wildcardResourcePatterns>
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile default="true" name="Default" enabled="false">
|
||||||
|
<processorPath useClasspath="true" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<component name="CopyrightManager">
|
||||||
|
<settings default="">
|
||||||
|
<module2copyright />
|
||||||
|
</settings>
|
||||||
|
</component>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||||
|
</project>
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CppTools.Loader" reportImplicitCastToBool="false" reportNameReferencedOnce="false" warnedAboutFileOutOfSourceRoot="true" version="3" currentProject="$PROJECT_DIR$/displayboard/Makefile" additionalPreprocessorDefs="" compilerSelect="GCC" javaIncludes="false">
|
||||||
|
<system-include-dir path="/usr/lib/avr/include" />
|
||||||
|
</component>
|
||||||
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
|
<file url="file://$PROJECT_DIR$" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="Cpp SDK" project-jdk-type="CppSdk">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/displayboard/displayboard.iml" filepath="$PROJECT_DIR$/displayboard/displayboard.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/powerboard/powerboard.iml" filepath="$PROJECT_DIR$/powerboard/powerboard.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/powerboard_v2/powerboard_v2.iml" filepath="$PROJECT_DIR$/powerboard_v2/powerboard_v2.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<component name="DependencyValidationManager">
|
||||||
|
<state>
|
||||||
|
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||||
|
</state>
|
||||||
|
</component>
|
|
@ -0,0 +1,125 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
|
@ -0,0 +1,651 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="9fad4545-a424-4a82-86dc-76602cf3eef3" name="Default" comment="">
|
||||||
|
<change type="DELETED" beforePath="$PROJECT_DIR$/powerboard_v2/powerboard.iml" afterPath="" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/powerboard_v2/src/main.c" afterPath="$PROJECT_DIR$/powerboard_v2/src/main.c" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/powerboard_v2/src/main.h" afterPath="$PROJECT_DIR$/powerboard_v2/src/main.h" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/modules.xml" afterPath="$PROJECT_DIR$/.idea/modules.xml" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||||
|
</list>
|
||||||
|
<ignored path="bikegenerator.iws" />
|
||||||
|
<ignored path=".idea/workspace.xml" />
|
||||||
|
<file path="/Makefile" changelist="9fad4545-a424-4a82-86dc-76602cf3eef3" time="1371032328243" ignored="false" />
|
||||||
|
<file path="/Dummy.txt" changelist="9fad4545-a424-4a82-86dc-76602cf3eef3" time="1392331539190" ignored="false" />
|
||||||
|
<file path="/main.c" changelist="9fad4545-a424-4a82-86dc-76602cf3eef3" time="1371265283096" ignored="false" />
|
||||||
|
<file path="/uart.c" changelist="9fad4545-a424-4a82-86dc-76602cf3eef3" time="1371164805619" ignored="false" />
|
||||||
|
<file path="/a.java" changelist="9fad4545-a424-4a82-86dc-76602cf3eef3" time="1371206947114" ignored="false" />
|
||||||
|
<file path="/utils.c" changelist="9fad4545-a424-4a82-86dc-76602cf3eef3" time="1371240856046" ignored="false" />
|
||||||
|
<file path="$PROJECT_DIR$/../../../../crestyle/kunden/kermax/coding/tv_geo/atlassian-ide-plugin.xml" changelist="9fad4545-a424-4a82-86dc-76602cf3eef3" time="1392332770185" ignored="false" />
|
||||||
|
<option name="TRACKING_ENABLED" value="true" />
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
||||||
|
<component name="CreatePatchCommitExecutor">
|
||||||
|
<option name="PATCH_PATH" value="" />
|
||||||
|
</component>
|
||||||
|
<component name="DaemonCodeAnalyzer">
|
||||||
|
<disable_hints />
|
||||||
|
</component>
|
||||||
|
<component name="DebuggerManager">
|
||||||
|
<ui_properties default_suspend_policy="SuspendAll" default_condition_enabled="true" />
|
||||||
|
<breakpoint_any default_suspend_policy="SuspendAll" default_condition_enabled="true">
|
||||||
|
<breakpoint>
|
||||||
|
<option name="NOTIFY_CAUGHT" value="true" />
|
||||||
|
<option name="NOTIFY_UNCAUGHT" value="true" />
|
||||||
|
<option name="ENABLED" value="false" />
|
||||||
|
<option name="LOG_ENABLED" value="false" />
|
||||||
|
<option name="LOG_EXPRESSION_ENABLED" value="false" />
|
||||||
|
<option name="REMOVE_AFTER_HIT" value="false" />
|
||||||
|
<option name="SUSPEND_POLICY" value="SuspendAll" />
|
||||||
|
<option name="SUSPEND" value="true" />
|
||||||
|
<option name="COUNT_FILTER_ENABLED" value="false" />
|
||||||
|
<option name="COUNT_FILTER" value="0" />
|
||||||
|
<option name="CONDITION_ENABLED" value="true" />
|
||||||
|
<option name="CLASS_FILTERS_ENABLED" value="false" />
|
||||||
|
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
|
||||||
|
<option name="CONDITION" value="" />
|
||||||
|
<option name="LOG_MESSAGE" value="" />
|
||||||
|
</breakpoint>
|
||||||
|
<breakpoint>
|
||||||
|
<option name="NOTIFY_CAUGHT" value="true" />
|
||||||
|
<option name="NOTIFY_UNCAUGHT" value="true" />
|
||||||
|
<option name="ENABLED" value="false" />
|
||||||
|
<option name="LOG_ENABLED" value="false" />
|
||||||
|
<option name="LOG_EXPRESSION_ENABLED" value="false" />
|
||||||
|
<option name="REMOVE_AFTER_HIT" value="false" />
|
||||||
|
<option name="SUSPEND_POLICY" value="SuspendAll" />
|
||||||
|
<option name="SUSPEND" value="true" />
|
||||||
|
<option name="COUNT_FILTER_ENABLED" value="false" />
|
||||||
|
<option name="COUNT_FILTER" value="0" />
|
||||||
|
<option name="CONDITION_ENABLED" value="true" />
|
||||||
|
<option name="CLASS_FILTERS_ENABLED" value="false" />
|
||||||
|
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
|
||||||
|
<option name="CONDITION" value="" />
|
||||||
|
<option name="LOG_MESSAGE" value="" />
|
||||||
|
</breakpoint>
|
||||||
|
</breakpoint_any>
|
||||||
|
<breakpoint_rules />
|
||||||
|
<ui_properties />
|
||||||
|
</component>
|
||||||
|
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
|
||||||
|
<component name="FavoritesManager">
|
||||||
|
<favorites_list name="bikegenerator" />
|
||||||
|
</component>
|
||||||
|
<component name="FindManager">
|
||||||
|
<FindUsagesManager>
|
||||||
|
<setting name="OPEN_NEW_TAB" value="false" />
|
||||||
|
</FindUsagesManager>
|
||||||
|
</component>
|
||||||
|
<component name="Git.Settings">
|
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." />
|
||||||
|
</component>
|
||||||
|
<component name="GitLogSettings">
|
||||||
|
<option name="myDateState">
|
||||||
|
<MyDateState />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="IdeDocumentHistory">
|
||||||
|
<option name="changedFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/powerboard/src/adc.c" />
|
||||||
|
<option value="$PROJECT_DIR$/powerboard/src/uart.h" />
|
||||||
|
<option value="$PROJECT_DIR$/displayboard/src/utils.h" />
|
||||||
|
<option value="$PROJECT_DIR$/displayboard/Makefile" />
|
||||||
|
<option value="$PROJECT_DIR$/displayboard/src/main.h" />
|
||||||
|
<option value="$PROJECT_DIR$/displayboard/src/uart.h" />
|
||||||
|
<option value="$PROJECT_DIR$/powerboard/src/main.h" />
|
||||||
|
<option value="$PROJECT_DIR$/powerboard/Makefile" />
|
||||||
|
<option value="$PROJECT_DIR$/displayboard/src/uart.c" />
|
||||||
|
<option value="$PROJECT_DIR$/powerboard/src/utils.c" />
|
||||||
|
<option value="$PROJECT_DIR$/powerboard/src/utils.h" />
|
||||||
|
<option value="$PROJECT_DIR$/powerboard/src/main.c" />
|
||||||
|
<option value="$PROJECT_DIR$/displayboard/src/main.c" />
|
||||||
|
<option value="/usr/lib/avr/include/avr/sfr_defs.h" />
|
||||||
|
<option value="$PROJECT_DIR$/powerboard_v2/src/main.c" />
|
||||||
|
<option value="/usr/lib/avr/include/stdint.h" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectFrameBounds">
|
||||||
|
<option name="x" value="1596" />
|
||||||
|
<option name="width" value="1928" />
|
||||||
|
<option name="height" value="1176" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectInspectionProfilesVisibleTreeState">
|
||||||
|
<entry key="Project Default">
|
||||||
|
<profile-state>
|
||||||
|
<expanded-state>
|
||||||
|
<State>
|
||||||
|
<id />
|
||||||
|
</State>
|
||||||
|
<State>
|
||||||
|
<id>CDI(Contexts and Dependency Injection) issues</id>
|
||||||
|
</State>
|
||||||
|
<State>
|
||||||
|
<id>GeneralJavaScript</id>
|
||||||
|
</State>
|
||||||
|
<State>
|
||||||
|
<id>JavaScript</id>
|
||||||
|
</State>
|
||||||
|
<State>
|
||||||
|
<id>Spring Model</id>
|
||||||
|
</State>
|
||||||
|
<State>
|
||||||
|
<id>Spring SecuritySpring Model</id>
|
||||||
|
</State>
|
||||||
|
</expanded-state>
|
||||||
|
<selected-state>
|
||||||
|
<State>
|
||||||
|
<id>Abstraction issues</id>
|
||||||
|
</State>
|
||||||
|
</selected-state>
|
||||||
|
</profile-state>
|
||||||
|
</entry>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
||||||
|
<OptionsSetting value="true" id="Add" />
|
||||||
|
<OptionsSetting value="true" id="Remove" />
|
||||||
|
<OptionsSetting value="true" id="Checkout" />
|
||||||
|
<OptionsSetting value="false" id="Update" />
|
||||||
|
<OptionsSetting value="true" id="Status" />
|
||||||
|
<OptionsSetting value="true" id="Edit" />
|
||||||
|
<ConfirmationsSetting value="0" id="Add" />
|
||||||
|
<ConfirmationsSetting value="0" id="Remove" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectReloadState">
|
||||||
|
<option name="STATE" value="0" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectView">
|
||||||
|
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
|
||||||
|
<flattenPackages />
|
||||||
|
<showMembers />
|
||||||
|
<showModules />
|
||||||
|
<showLibraryContents />
|
||||||
|
<hideEmptyPackages />
|
||||||
|
<abbreviatePackageNames />
|
||||||
|
<autoscrollToSource />
|
||||||
|
<autoscrollFromSource />
|
||||||
|
<sortByType />
|
||||||
|
</navigator>
|
||||||
|
<panes>
|
||||||
|
<pane id="ProjectPane">
|
||||||
|
<subPane>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="bikegenerator" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="bikegenerator" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="powerboard_v2" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="bikegenerator" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="powerboard_v2" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="src" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="bikegenerator" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="displayboard" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="bikegenerator" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="displayboard" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="src" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
</subPane>
|
||||||
|
</pane>
|
||||||
|
<pane id="Scope" />
|
||||||
|
<pane id="PackagesPane" />
|
||||||
|
</panes>
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent">
|
||||||
|
<property name="project.structure.last.edited" value="Modules" />
|
||||||
|
<property name="GoToFile.includeJavaFiles" value="false" />
|
||||||
|
<property name="project.structure.proportion" value="0.0" />
|
||||||
|
<property name="options.splitter.main.proportions" value="0.3" />
|
||||||
|
<property name="MemberChooser.sorted" value="false" />
|
||||||
|
<property name="recentsLimit" value="5" />
|
||||||
|
<property name="options.lastSelected" value="File.Encoding" />
|
||||||
|
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||||
|
<property name="project.structure.side.proportion" value="0.2" />
|
||||||
|
<property name="MemberChooser.copyJavadoc" value="false" />
|
||||||
|
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
|
||||||
|
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||||
|
<property name="restartRequiresConfirmation" value="true" />
|
||||||
|
<property name="MemberChooser.showClasses" value="true" />
|
||||||
|
<property name="GoToClass.includeLibraries" value="false" />
|
||||||
|
<property name="options.searchVisible" value="true" />
|
||||||
|
<property name="options.splitter.details.proportions" value="0.2" />
|
||||||
|
</component>
|
||||||
|
<component name="RecentsManager">
|
||||||
|
<key name="CopyFile.RECENT_KEYS">
|
||||||
|
<recent name="$PROJECT_DIR$/displayboard" />
|
||||||
|
</key>
|
||||||
|
<key name="MoveFile.RECENT_KEYS">
|
||||||
|
<recent name="$PROJECT_DIR$/powerboard/src" />
|
||||||
|
</key>
|
||||||
|
</component>
|
||||||
|
<component name="RunManager">
|
||||||
|
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
|
||||||
|
<module name="" />
|
||||||
|
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" />
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="Remote" factoryName="Remote">
|
||||||
|
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||||
|
<option name="SERVER_MODE" value="false" />
|
||||||
|
<option name="SHMEM_ADDRESS" value="javadebug" />
|
||||||
|
<option name="HOST" value="localhost" />
|
||||||
|
<option name="PORT" value="5005" />
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="TestNG" factoryName="TestNG">
|
||||||
|
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||||
|
<module name="" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
|
<option name="SUITE_NAME" />
|
||||||
|
<option name="PACKAGE_NAME" />
|
||||||
|
<option name="MAIN_CLASS_NAME" />
|
||||||
|
<option name="METHOD_NAME" />
|
||||||
|
<option name="GROUP_NAME" />
|
||||||
|
<option name="TEST_OBJECT" value="CLASS" />
|
||||||
|
<option name="VM_PARAMETERS" value="-ea" />
|
||||||
|
<option name="PARAMETERS" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="OUTPUT_DIRECTORY" />
|
||||||
|
<option name="ANNOTATION_TYPE" />
|
||||||
|
<option name="ENV_VARIABLES" />
|
||||||
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
|
<option name="TEST_SEARCH_SCOPE">
|
||||||
|
<value defaultName="moduleWithDependencies" />
|
||||||
|
</option>
|
||||||
|
<option name="USE_DEFAULT_REPORTERS" value="false" />
|
||||||
|
<option name="PROPERTIES_FILE" />
|
||||||
|
<envs />
|
||||||
|
<properties />
|
||||||
|
<listeners />
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="Applet" factoryName="Applet">
|
||||||
|
<module name="" />
|
||||||
|
<option name="MAIN_CLASS_NAME" />
|
||||||
|
<option name="HTML_FILE_NAME" />
|
||||||
|
<option name="HTML_USED" value="false" />
|
||||||
|
<option name="WIDTH" value="400" />
|
||||||
|
<option name="HEIGHT" value="300" />
|
||||||
|
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
|
||||||
|
<option name="VM_PARAMETERS" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="Application" factoryName="Application">
|
||||||
|
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||||
|
<option name="MAIN_CLASS_NAME" />
|
||||||
|
<option name="VM_PARAMETERS" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
|
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||||
|
<option name="ENV_VARIABLES" />
|
||||||
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
|
<module name="" />
|
||||||
|
<envs />
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="CppRunConfigurationType" factoryName="Cpp">
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="JUnit" factoryName="JUnit">
|
||||||
|
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||||
|
<module name="" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
|
<option name="PACKAGE_NAME" />
|
||||||
|
<option name="MAIN_CLASS_NAME" />
|
||||||
|
<option name="METHOD_NAME" />
|
||||||
|
<option name="TEST_OBJECT" value="class" />
|
||||||
|
<option name="VM_PARAMETERS" value="-ea" />
|
||||||
|
<option name="PARAMETERS" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="ENV_VARIABLES" />
|
||||||
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
|
<option name="TEST_SEARCH_SCOPE">
|
||||||
|
<value defaultName="moduleWithDependencies" />
|
||||||
|
</option>
|
||||||
|
<envs />
|
||||||
|
<patterns />
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
|
<list size="0" />
|
||||||
|
<configuration name="<template>" type="WebApp" default="true" selected="false">
|
||||||
|
<Host>localhost</Host>
|
||||||
|
<Port>5050</Port>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
|
<component name="ShelveChangesManager" show_recycled="false" />
|
||||||
|
<component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false" SSL_PROTOCOLS="all">
|
||||||
|
<option name="USER" value="" />
|
||||||
|
<option name="PASSWORD" value="" />
|
||||||
|
<option name="mySSHConnectionTimeout" value="30000" />
|
||||||
|
<option name="mySSHReadTimeout" value="30000" />
|
||||||
|
<option name="LAST_MERGED_REVISION" />
|
||||||
|
<option name="MERGE_DRY_RUN" value="false" />
|
||||||
|
<option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
|
||||||
|
<option name="UPDATE_LOCK_ON_DEMAND" value="false" />
|
||||||
|
<option name="IGNORE_SPACES_IN_MERGE" value="false" />
|
||||||
|
<option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
|
||||||
|
<option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
|
||||||
|
<option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
|
||||||
|
<option name="FORCE_UPDATE" value="false" />
|
||||||
|
<option name="IGNORE_EXTERNALS" value="false" />
|
||||||
|
<myIsUseDefaultProxy>false</myIsUseDefaultProxy>
|
||||||
|
</component>
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="9fad4545-a424-4a82-86dc-76602cf3eef3" name="Default" comment="" />
|
||||||
|
<created>1370952913198</created>
|
||||||
|
<updated>1370952913198</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00001" summary="- added 3rd party uart lib - added measurements for voltage and current">
|
||||||
|
<created>1370989849092</created>
|
||||||
|
<updated>1370989849092</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00002" summary="added first draft of overvoltage protection by using dump load">
|
||||||
|
<created>1370994654693</created>
|
||||||
|
<updated>1370994654693</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00003" summary="optimisations in adc code">
|
||||||
|
<created>1371043815539</created>
|
||||||
|
<updated>1371043815539</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00004" summary="working, refactured a bit, optimised for size">
|
||||||
|
<created>1371043908804</created>
|
||||||
|
<updated>1371043908804</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00005" summary="bugfixes, live check on avr working for now">
|
||||||
|
<created>1371075233272</created>
|
||||||
|
<updated>1371075233272</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00006" summary="changed resistor values for 7-Seg removed lm371 due to lack of voltage">
|
||||||
|
<created>1371166480748</created>
|
||||||
|
<updated>1371166480748</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00007" summary="changed counter (bugfix) changed baudrate to 19200">
|
||||||
|
<created>1371166541841</created>
|
||||||
|
<updated>1371166541841</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00008" summary="made a first version with 7-seg number output">
|
||||||
|
<created>1371166559819</created>
|
||||||
|
<updated>1371166559819</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00009" summary="minor changes, made counters 8bit">
|
||||||
|
<created>1371206855146</created>
|
||||||
|
<updated>1371206855146</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00010" summary="changed power to 16bit added output of relais states">
|
||||||
|
<created>1371214968413</created>
|
||||||
|
<updated>1371214968413</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00011" summary="removed unnecessary uart1 code">
|
||||||
|
<created>1371215016953</created>
|
||||||
|
<updated>1371215016953</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00012" summary="began working on actual code for parsing values from uart not working yet!">
|
||||||
|
<created>1371215050508</created>
|
||||||
|
<updated>1371215050508</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00013" summary="changed currents to unsigned int and checked while getting these values.">
|
||||||
|
<created>1371242761894</created>
|
||||||
|
<updated>1371242761894</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00014" summary="first working version, just sevensegments, still without leds">
|
||||||
|
<created>1371244728060</created>
|
||||||
|
<updated>1371244728060</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="15" />
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
<component name="ToolWindowManager">
|
||||||
|
<frame x="1596" y="0" width="1928" height="1176" extended-state="6" />
|
||||||
|
<editor active="true" />
|
||||||
|
<layout>
|
||||||
|
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3243626" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Atlassian " active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32893288" sideWeight="0.5" order="8" side_tool="true" content_ui="tabs" />
|
||||||
|
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||||
|
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="CDI" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.2497332" sideWeight="0.67563736" order="0" side_tool="false" content_ui="combo" />
|
||||||
|
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32893288" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
||||||
|
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||||
|
</layout>
|
||||||
|
</component>
|
||||||
|
<component name="VcsContentAnnotationSettings">
|
||||||
|
<option name="myLimit" value="2678400000" />
|
||||||
|
</component>
|
||||||
|
<component name="VcsManagerConfiguration">
|
||||||
|
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
|
||||||
|
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||||
|
<option name="CHECK_NEW_TODO" value="false" />
|
||||||
|
<option name="myTodoPanelSettings">
|
||||||
|
<value>
|
||||||
|
<are-packages-shown value="false" />
|
||||||
|
<are-modules-shown value="false" />
|
||||||
|
<flatten-packages value="false" />
|
||||||
|
<is-autoscroll-to-source value="false" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
|
||||||
|
<option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
|
||||||
|
<option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
|
||||||
|
<option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
|
||||||
|
<option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
|
||||||
|
<option name="DEFAULT_PATCH_EXTENSION" value="patch" />
|
||||||
|
<option name="SHORT_DIFF_HORIZONTALLY" value="true" />
|
||||||
|
<option name="SHORT_DIFF_EXTRA_LINES" value="2" />
|
||||||
|
<option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
|
||||||
|
<option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
|
||||||
|
<option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
|
||||||
|
<option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
|
||||||
|
<option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" />
|
||||||
|
<option name="SHOW_DIRTY_RECURSIVELY" value="false" />
|
||||||
|
<option name="LIMIT_HISTORY" value="true" />
|
||||||
|
<option name="MAXIMUM_HISTORY_ROWS" value="1000" />
|
||||||
|
<option name="UPDATE_FILTER_SCOPE_NAME" />
|
||||||
|
<option name="USE_COMMIT_MESSAGE_MARGIN" value="false" />
|
||||||
|
<option name="COMMIT_MESSAGE_MARGIN_SIZE" value="72" />
|
||||||
|
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="false" />
|
||||||
|
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
|
||||||
|
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="first working version, just sevensegments, still without leds" />
|
||||||
|
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
|
||||||
|
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||||
|
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
|
||||||
|
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
|
||||||
|
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
|
||||||
|
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
|
||||||
|
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
|
||||||
|
<option name="ACTIVE_VCS_NAME" />
|
||||||
|
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
|
||||||
|
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
|
||||||
|
<option name="UPDATE_FILTER_BY_SCOPE" value="false" />
|
||||||
|
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
|
||||||
|
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
|
||||||
|
<MESSAGE value="- added 3rd party uart lib - added measurements for voltage and current" />
|
||||||
|
<MESSAGE value="added first draft of overvoltage protection by using dump load" />
|
||||||
|
<MESSAGE value="optimisations in adc code" />
|
||||||
|
<MESSAGE value="working, refactured a bit, optimised for size" />
|
||||||
|
<MESSAGE value="bugfixes, live check on avr working for now" />
|
||||||
|
<MESSAGE value="changed resistor values for 7-Seg removed lm371 due to lack of voltage" />
|
||||||
|
<MESSAGE value="changed counter (bugfix) changed baudrate to 19200" />
|
||||||
|
<MESSAGE value="made a first version with 7-seg number output" />
|
||||||
|
<MESSAGE value="minor changes, made counters 8bit" />
|
||||||
|
<MESSAGE value="changed power to 16bit added output of relais states" />
|
||||||
|
<MESSAGE value="removed unnecessary uart1 code" />
|
||||||
|
<MESSAGE value="began working on actual code for parsing values from uart not working yet!" />
|
||||||
|
<MESSAGE value="changed currents to unsigned int and checked while getting these values." />
|
||||||
|
<MESSAGE value="first working version, just sevensegments, still without leds" />
|
||||||
|
</component>
|
||||||
|
<component name="XDebuggerManager">
|
||||||
|
<breakpoint-manager />
|
||||||
|
</component>
|
||||||
|
<component name="antWorkspaceConfiguration">
|
||||||
|
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
|
||||||
|
<option name="FILTER_TARGETS" value="false" />
|
||||||
|
</component>
|
||||||
|
<component name="atlassian-ide-plugin-workspace">
|
||||||
|
<option name="bambooConfiguration">
|
||||||
|
<BambooWorkspaceConfiguration>
|
||||||
|
<option name="view">
|
||||||
|
<BambooViewConfigurationBean />
|
||||||
|
</option>
|
||||||
|
</BambooWorkspaceConfiguration>
|
||||||
|
</option>
|
||||||
|
<option name="defaultCredentials">
|
||||||
|
<UserCfgBean />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="atlassian-ide-plugin-workspace-issues">
|
||||||
|
<option name="view">
|
||||||
|
<JiraViewConfigurationBean>
|
||||||
|
<option name="viewFilterId" value="" />
|
||||||
|
</JiraViewConfigurationBean>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="masterDetails">
|
||||||
|
<states>
|
||||||
|
<state key="ArtifactsStructureConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<artifact-editor />
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="FacetStructureConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<last-edited>Detection</last-edited>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="GlobalLibrariesConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<last-edited>Node.js v0.8.17 Core Modules</last-edited>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="JdkListConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<last-edited>Cpp SDK</last-edited>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="ModuleStructureConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<last-edited>displayboard</last-edited>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
<option value="0.5" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
<state key="ProjectLibrariesConfigurable.UI">
|
||||||
|
<settings>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
</states>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<atlassian-ide-plugin>
|
||||||
|
<project-configuration id="1">
|
||||||
|
<servers id="2" />
|
||||||
|
<default-jira-server id="3">a36e3af5-abd2-4783-a6a6-3383b8cb560f</default-jira-server>
|
||||||
|
</project-configuration>
|
||||||
|
</atlassian-ide-plugin>
|
|
@ -0,0 +1,276 @@
|
||||||
|
# On command line:
|
||||||
|
#
|
||||||
|
# make all = Make software.
|
||||||
|
#
|
||||||
|
# make clean = Clean out built project files.
|
||||||
|
#
|
||||||
|
# make program = Download the hex file to the device, using avrdude. Please
|
||||||
|
# customize the avrdude settings below first!
|
||||||
|
#
|
||||||
|
# To rebuild project do "make clean" then "make all".
|
||||||
|
#
|
||||||
|
|
||||||
|
MCU = atmega32
|
||||||
|
F_CPU = 8000000
|
||||||
|
|
||||||
|
# Output format. (can be srec, ihex, binary)
|
||||||
|
FORMAT = ihex
|
||||||
|
|
||||||
|
# Target file name (without extension).
|
||||||
|
TARGET = main
|
||||||
|
|
||||||
|
SRC = src/$(TARGET).c src/utils.c src/uart.c
|
||||||
|
|
||||||
|
|
||||||
|
# Optimization level, can be [0, 1, 2, 3, s].
|
||||||
|
# 0 = turn off optimization. s = optimize for size.
|
||||||
|
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
||||||
|
OPT = s
|
||||||
|
|
||||||
|
|
||||||
|
# List any extra directories to look for include files here.
|
||||||
|
# Each directory must be seperated by a space.
|
||||||
|
EXTRAINCDIRS = src/
|
||||||
|
|
||||||
|
|
||||||
|
# Compiler flag to set the C Standard level.
|
||||||
|
# c89 - "ANSI" C
|
||||||
|
# gnu89 - c89 plus GCC extensions
|
||||||
|
# c99 - ISO C99 standard (not yet fully implemented)
|
||||||
|
# gnu99 - c99 plus GCC extensions
|
||||||
|
CSTANDARD = -std=gnu99
|
||||||
|
|
||||||
|
# Place -D or -U options here
|
||||||
|
CDEFS =
|
||||||
|
|
||||||
|
# Place -I options here
|
||||||
|
CINCS =
|
||||||
|
|
||||||
|
|
||||||
|
# Compiler flags.
|
||||||
|
# -O*: optimization level
|
||||||
|
# -f...: tuning, see GCC manual and avr-libc documentation
|
||||||
|
# -Wall...: warning level
|
||||||
|
# -Wa,...: tell GCC to pass this to the assembler.
|
||||||
|
# -adhlns...: create assembler listing
|
||||||
|
CFLAGS += $(CDEFS) $(CINCS)
|
||||||
|
CFLAGS += -O$(OPT)
|
||||||
|
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
|
||||||
|
CFLAGS += -Wall -Wstrict-prototypes
|
||||||
|
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
|
||||||
|
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||||
|
CFLAGS += $(CSTANDARD)
|
||||||
|
CFLAGS += -DF_CPU=$(F_CPU) #-DDEBUG
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# External memory options
|
||||||
|
|
||||||
|
|
||||||
|
# Linker flags.
|
||||||
|
# -Wl,...: tell GCC to pass this to linker.
|
||||||
|
# -Map: create map file
|
||||||
|
# --cref: add cross reference to map file
|
||||||
|
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
||||||
|
|
||||||
|
|
||||||
|
# Programming support using avrdude. Settings and variables.
|
||||||
|
AVRDUDE_PROGRAMMER = usbasp
|
||||||
|
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
|
||||||
|
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
|
||||||
|
|
||||||
|
AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Define programs and commands.
|
||||||
|
SHELL = sh
|
||||||
|
CC = avr-gcc
|
||||||
|
OBJCOPY = avr-objcopy
|
||||||
|
OBJDUMP = avr-objdump
|
||||||
|
SIZE = avr-size
|
||||||
|
NM = avr-nm
|
||||||
|
AVRDUDE = avrdude
|
||||||
|
REMOVE = rm -f
|
||||||
|
COPY = cp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Define Messages
|
||||||
|
# English
|
||||||
|
MSG_ERRORS_NONE = Errors: none
|
||||||
|
MSG_BEGIN = -------- begin --------
|
||||||
|
MSG_END = -------- end --------
|
||||||
|
MSG_SIZE_BEFORE = Size before:
|
||||||
|
MSG_SIZE_AFTER = Size after:
|
||||||
|
MSG_COFF = Converting to AVR COFF:
|
||||||
|
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
|
||||||
|
MSG_FLASH = Creating load file for Flash:
|
||||||
|
MSG_EEPROM = Creating load file for EEPROM:
|
||||||
|
MSG_EXTENDED_LISTING = Creating Extended Listing:
|
||||||
|
MSG_SYMBOL_TABLE = Creating Symbol Table:
|
||||||
|
MSG_LINKING = Linking:
|
||||||
|
MSG_COMPILING = Compiling:
|
||||||
|
MSG_ASSEMBLING = Assembling:
|
||||||
|
MSG_CLEANING = Cleaning project:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Define all object files.
|
||||||
|
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
|
||||||
|
|
||||||
|
# Define all listing files.
|
||||||
|
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst)
|
||||||
|
|
||||||
|
|
||||||
|
# Compiler flags to generate dependency files.
|
||||||
|
### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
|
||||||
|
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
|
||||||
|
|
||||||
|
# Combine all necessary flags and optional flags.
|
||||||
|
# Add target processor to flags.
|
||||||
|
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
# Default target.
|
||||||
|
all: begin gccversion sizebefore build sizeafter finished end
|
||||||
|
|
||||||
|
build: elf hex eep lss sym
|
||||||
|
|
||||||
|
elf: $(TARGET).elf
|
||||||
|
hex: $(TARGET).hex
|
||||||
|
eep: $(TARGET).eep
|
||||||
|
lss: $(TARGET).lss
|
||||||
|
sym: $(TARGET).sym
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Eye candy.
|
||||||
|
# AVR Studio 3.x does not check make's exit code but relies on
|
||||||
|
# the following magic strings to be generated by the compile job.
|
||||||
|
begin:
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_BEGIN)
|
||||||
|
|
||||||
|
finished:
|
||||||
|
@echo $(MSG_ERRORS_NONE)
|
||||||
|
|
||||||
|
end:
|
||||||
|
@echo $(MSG_END)
|
||||||
|
@echo
|
||||||
|
|
||||||
|
|
||||||
|
# Display size of file.
|
||||||
|
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
|
||||||
|
ELFSIZE = $(SIZE) -A $(TARGET).elf
|
||||||
|
sizebefore:
|
||||||
|
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
|
||||||
|
|
||||||
|
sizeafter:
|
||||||
|
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Display compiler version information.
|
||||||
|
gccversion :
|
||||||
|
@$(CC) --version
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Program the device.
|
||||||
|
program: $(TARGET).hex $(TARGET).eep
|
||||||
|
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
|
||||||
|
|
||||||
|
|
||||||
|
# Create final output files (.hex, .eep) from ELF output file.
|
||||||
|
%.hex: %.elf
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_FLASH) $@
|
||||||
|
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
|
||||||
|
|
||||||
|
%.eep: %.elf
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_EEPROM) $@
|
||||||
|
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
||||||
|
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
|
||||||
|
|
||||||
|
# Create extended listing file from ELF output file.
|
||||||
|
%.lss: %.elf
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_EXTENDED_LISTING) $@
|
||||||
|
$(OBJDUMP) -h -S $< > $@
|
||||||
|
|
||||||
|
# Create a symbol table from ELF output file.
|
||||||
|
%.sym: %.elf
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_SYMBOL_TABLE) $@
|
||||||
|
$(NM) -n $< > $@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Link: create ELF output file from object files.
|
||||||
|
.SECONDARY : $(TARGET).elf
|
||||||
|
.PRECIOUS : $(OBJ)
|
||||||
|
%.elf: $(OBJ)
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_LINKING) $@
|
||||||
|
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
# Compile: create object files from C source files.
|
||||||
|
%.o : %.c
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_COMPILING) $<
|
||||||
|
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
|
# Compile: create assembler files from C source files.
|
||||||
|
%.s : %.c
|
||||||
|
$(CC) -S $(ALL_CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
|
# Assemble: create object files from assembler source files.
|
||||||
|
%.o : %.S
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_ASSEMBLING) $<
|
||||||
|
$(CC) -c $(ALL_ASFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Target: clean project.
|
||||||
|
clean: begin clean_list finished end
|
||||||
|
|
||||||
|
clean_list :
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_CLEANING)
|
||||||
|
$(REMOVE) $(TARGET).hex
|
||||||
|
$(REMOVE) $(TARGET).eep
|
||||||
|
$(REMOVE) $(TARGET).obj
|
||||||
|
$(REMOVE) $(TARGET).cof
|
||||||
|
$(REMOVE) $(TARGET).elf
|
||||||
|
$(REMOVE) $(TARGET).map
|
||||||
|
$(REMOVE) $(TARGET).obj
|
||||||
|
$(REMOVE) $(TARGET).a90
|
||||||
|
$(REMOVE) $(TARGET).sym
|
||||||
|
$(REMOVE) $(TARGET).lnk
|
||||||
|
$(REMOVE) $(TARGET).lss
|
||||||
|
$(REMOVE) $(OBJ)
|
||||||
|
$(REMOVE) $(LST)
|
||||||
|
$(REMOVE) $(SRC:.c=.s)
|
||||||
|
$(REMOVE) $(SRC:.c=.d)
|
||||||
|
$(REMOVE) .dep/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Include the dependency files.
|
||||||
|
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
|
||||||
|
|
||||||
|
|
||||||
|
# Listing of phony targets.
|
||||||
|
.PHONY : all begin finish end sizebefore sizeafter gccversion \
|
||||||
|
build elf hex eep lss sym coff extcoff \
|
||||||
|
clean clean_list program
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="C++" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="jdk" jdkName="Cpp SDK" jdkType="CppSdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,254 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "utils.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "uart.h"
|
||||||
|
|
||||||
|
#define BUFSIZE 40
|
||||||
|
#define CURRENT_MAX 30000 // 30 Ampere is max
|
||||||
|
|
||||||
|
volatile uint16_t syscounter = 0;
|
||||||
|
volatile uint8_t digitbuffer[6] = { 0,0,0,0,0,0 };
|
||||||
|
volatile uint8_t leddigitbuffer[4] = { 0,0,0,0 };
|
||||||
|
uint8_t digit = 0;
|
||||||
|
uint8_t leddigit = 0;
|
||||||
|
|
||||||
|
// values send over uart from powerboard
|
||||||
|
uint16_t voltage = 0;
|
||||||
|
int16_t current_in = 0;
|
||||||
|
int16_t current_out = 0;
|
||||||
|
uint8_t dumpsw = 0; //TODO: make bitfield
|
||||||
|
uint8_t loadsw = 0; //TODO: make bitfield
|
||||||
|
uint8_t gensw = 0; //TODO: make bitfield
|
||||||
|
uint16_t display = 0;
|
||||||
|
|
||||||
|
uint16_t power_gen = 0;
|
||||||
|
uint16_t power_load = 0;
|
||||||
|
|
||||||
|
unsigned char data_count = 0;
|
||||||
|
unsigned char data_in[BUFSIZE];
|
||||||
|
char command_in[BUFSIZE];
|
||||||
|
|
||||||
|
const uint8_t segment_translate[10] = {
|
||||||
|
63, 6, 91, 79, 102, 109, 125, 7, 127, 111
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t smallbar_translate[9] = {
|
||||||
|
0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t bigbar_translate[15][2] = {
|
||||||
|
{ 0x00, 0xc0},
|
||||||
|
{ 0x00, 0x60},
|
||||||
|
{ 0x00, 0x30},
|
||||||
|
{ 0x00, 0x18},
|
||||||
|
{ 0x00, 0x0c},
|
||||||
|
{ 0x00, 0x06},
|
||||||
|
{ 0x00, 0x03},
|
||||||
|
{ 0x01, 0x01},
|
||||||
|
{ 0x03, 0x00},
|
||||||
|
{ 0x06, 0x00},
|
||||||
|
{ 0x0c, 0x00},
|
||||||
|
{ 0x18, 0x00},
|
||||||
|
{ 0x30, 0x00},
|
||||||
|
{ 0x60, 0x00},
|
||||||
|
{ 0xc0, 0x00}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//static void timer_init(void) {
|
||||||
|
// clock is 8MHz
|
||||||
|
//TCCR1B |= _BV(WGM12) | _BV(CS11) | _BV(CS10) ; // CTC Mode for Timer 1 (16Bit) with prescale of 64
|
||||||
|
//OCR1A = 250; // 500Hz
|
||||||
|
//TIMSK = _BV(OCIE1A);
|
||||||
|
//sei(); // enable interrupts
|
||||||
|
//}
|
||||||
|
// Timer init
|
||||||
|
ISR( TIMER1_COMPA_vect ) // Interruptbehandlungsroutine
|
||||||
|
{
|
||||||
|
OCR1A = 2500-OCR1A; // Das Servosignal wird aus der Differenz von
|
||||||
|
// Periodenlänge (2500*0,008ms=20ms) und letztem
|
||||||
|
// Vergleichswert (OCR1A) gebildet
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ports_init(void) {
|
||||||
|
// make column / digit driver pins to output
|
||||||
|
DDRB = 0b11111100;
|
||||||
|
PORTB = (1<<PB1) | (1<<PB0); // Pullup für PB0 und PB1
|
||||||
|
|
||||||
|
TCCR1A = (1<<COM1A0); // Togglen bei Compare Match
|
||||||
|
TCCR1B = (1<<WGM12) | (1<<CS11); // CTC-Mode; Prescaler 8
|
||||||
|
TIMSK = (1<<OCIE1A); // Timer-Compare Interrupt an
|
||||||
|
// make data ports to output
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void process_command() {
|
||||||
|
if(strstr(command_in,"A") != NULL) {
|
||||||
|
// we have an A and B (from check in work_uart()
|
||||||
|
// so our message should be complete and consist of:
|
||||||
|
// A$voltage,$current_in,$current_out,$power_in,$power_out,loadsw,dumpsw,gensw\n
|
||||||
|
|
||||||
|
//A12.5,65464,00000,00000,00000,1,0,1B
|
||||||
|
|
||||||
|
char *token;
|
||||||
|
uint8_t tokencounter = 0;
|
||||||
|
|
||||||
|
char *start = strrchr(command_in, 'A');
|
||||||
|
|
||||||
|
// remove first (B is ignored by atoi)
|
||||||
|
start++;
|
||||||
|
|
||||||
|
token = strtok(start, ",");
|
||||||
|
|
||||||
|
while( token ) {
|
||||||
|
switch(tokencounter) {
|
||||||
|
case 0:
|
||||||
|
voltage = atoi(token);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
current_in = atoi(token);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
current_out = atoi(token);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
power_gen = atoi(token);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
power_load = atoi(token);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
if(atoi(token) == 1) loadsw = 1;
|
||||||
|
else loadsw = 0;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
if(atoi(token) == 1) dumpsw = 1;
|
||||||
|
else dumpsw = 0;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
if(atoi(token) == 1) gensw = 1;
|
||||||
|
else gensw = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tokencounter++;
|
||||||
|
token = strtok(NULL, ",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void work_uart(){
|
||||||
|
unsigned int c = uart_getc();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !(c & UART_NO_DATA) ) {
|
||||||
|
data_in[data_count] = c;
|
||||||
|
|
||||||
|
if (data_in[data_count] == 'B') {
|
||||||
|
data_count = 0;
|
||||||
|
|
||||||
|
memcpy(command_in, data_in, BUFSIZE);
|
||||||
|
memset(data_in, 0, BUFSIZE);
|
||||||
|
|
||||||
|
process_command();
|
||||||
|
} else {
|
||||||
|
data_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void set_servo(uint16_t value){
|
||||||
|
|
||||||
|
/// magic need to happen hear
|
||||||
|
display = value;
|
||||||
|
/// magic end
|
||||||
|
OCR1A = display;
|
||||||
|
sei();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void demo_display(void) {
|
||||||
|
|
||||||
|
for(uint8_t i = 0; i< 16;i++) {
|
||||||
|
leddigitbuffer[0] = bigbar_translate[i][0];
|
||||||
|
leddigitbuffer[1] = bigbar_translate[i][1];
|
||||||
|
wait(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(uint8_t i = 0; i< 9;i++) {
|
||||||
|
leddigitbuffer[2] = smallbar_translate[i];
|
||||||
|
wait(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(uint8_t i = 0; i< 9;i++) {
|
||||||
|
leddigitbuffer[3] = smallbar_translate[i];
|
||||||
|
wait(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(uint8_t j = 0; j< 3;j++) {
|
||||||
|
for(uint8_t i = 0; i< 6; i++) {
|
||||||
|
digitbuffer[i] = 0xff;
|
||||||
|
}
|
||||||
|
wait(20);
|
||||||
|
for(uint8_t i = 0; i< 6; i++) {
|
||||||
|
digitbuffer[i] = 0x00;
|
||||||
|
}
|
||||||
|
wait(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(uint8_t i = 0; i< 3;i++) {
|
||||||
|
leddigitbuffer[i] = 0x00;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
ports_init();
|
||||||
|
timer_init();
|
||||||
|
uart_init(UART_BAUD_SELECT(19200,F_CPU));
|
||||||
|
memset(data_in, 0, BUFSIZE);
|
||||||
|
|
||||||
|
|
||||||
|
demo_display();
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
|
||||||
|
work_uart();
|
||||||
|
|
||||||
|
if(syscounter >= 100) {
|
||||||
|
uart_putc('a'); // send a to receive values
|
||||||
|
set_servo(power_gen)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
syscounter = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// system timer
|
||||||
|
SIGNAL(TIMER1_COMPA_vect) {
|
||||||
|
syscounter++;
|
||||||
|
|
||||||
|
// output to sevensegment and leds
|
||||||
|
// make this here to reduce display flicker
|
||||||
|
digit++;
|
||||||
|
if(digit >5) digit = 0;
|
||||||
|
leddigit++;
|
||||||
|
if(leddigit >3) leddigit = 0;
|
||||||
|
|
||||||
|
SEVENSEG_PORT = digitbuffer[digit];
|
||||||
|
SEVENSEGDIG_PORT = _BV(digit+DIG0);
|
||||||
|
|
||||||
|
LED_PORT = leddigitbuffer[leddigit];
|
||||||
|
LEDDIG_PORT = _BV(leddigit);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef _main_h
|
||||||
|
#define _main_h
|
||||||
|
|
||||||
|
#define SEVENSEG_PORT PORTA
|
||||||
|
#define SEVENSEG_DDR DDRA
|
||||||
|
|
||||||
|
#define LED_PORT PORTC
|
||||||
|
#define LED_DDR DDRC
|
||||||
|
|
||||||
|
#define DIG0 PD2
|
||||||
|
#define DIG1 PD3
|
||||||
|
#define DIG2 PD4
|
||||||
|
#define DIG3 PD5
|
||||||
|
#define DIG4 PD6
|
||||||
|
#define DIG5 PD7
|
||||||
|
#define LEDS_MID1 PB0
|
||||||
|
#define LEDS_MID2 PB1
|
||||||
|
#define LEDS_LOAD PB2
|
||||||
|
#define LEDS_GEN PB3
|
||||||
|
|
||||||
|
#define SEVENSEGDIG_PORT PORTD
|
||||||
|
#define SEVENSEGDIG_DDR DDRD
|
||||||
|
|
||||||
|
#define LEDDIG_PORT PORTB
|
||||||
|
#define LEDDIG_DDR DDRB
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,479 @@
|
||||||
|
/*************************************************************************
|
||||||
|
Title: Interrupt UART library with receive/transmit circular buffers
|
||||||
|
Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
|
||||||
|
File: $Id: uart.c,v 1.10 2013/06/02 07:27:04 peter Exp $
|
||||||
|
Software: AVR-GCC 4.1, AVR Libc 1.4.6 or higher
|
||||||
|
Hardware: any AVR with built-in UART,
|
||||||
|
License: GNU General Public License
|
||||||
|
|
||||||
|
DESCRIPTION:
|
||||||
|
An interrupt is generated when the UART has finished transmitting or
|
||||||
|
receiving a byte. The interrupt handling routines use circular buffers
|
||||||
|
for buffering received and transmitted data.
|
||||||
|
|
||||||
|
The UART_RX_BUFFER_SIZE and UART_TX_BUFFER_SIZE variables define
|
||||||
|
the buffer size in bytes. Note that these variables must be a
|
||||||
|
power of 2.
|
||||||
|
|
||||||
|
USAGE:
|
||||||
|
Refere to the header file uart.h for a description of the routines.
|
||||||
|
See also example test_uart.c.
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
Based on Atmel Application Note AVR306
|
||||||
|
|
||||||
|
LICENSE:
|
||||||
|
Copyright (C) 2006 Peter Fleury
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
*************************************************************************/
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#include "uart.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* constants and macros
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* size of RX/TX buffers */
|
||||||
|
#define UART_RX_BUFFER_MASK ( UART_RX_BUFFER_SIZE - 1)
|
||||||
|
#define UART_TX_BUFFER_MASK ( UART_TX_BUFFER_SIZE - 1)
|
||||||
|
|
||||||
|
#if ( UART_RX_BUFFER_SIZE & UART_RX_BUFFER_MASK )
|
||||||
|
#error RX buffer size is not a power of 2
|
||||||
|
#endif
|
||||||
|
#if ( UART_TX_BUFFER_SIZE & UART_TX_BUFFER_MASK )
|
||||||
|
#error TX buffer size is not a power of 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__AVR_AT90S2313__) \
|
||||||
|
|| defined(__AVR_AT90S4414__) || defined(__AVR_AT90S4434__) \
|
||||||
|
|| defined(__AVR_AT90S8515__) || defined(__AVR_AT90S8535__) \
|
||||||
|
|| defined(__AVR_ATmega103__)
|
||||||
|
/* old AVR classic or ATmega103 with one UART */
|
||||||
|
#define AT90_UART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT UART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT UART_UDRE_vect
|
||||||
|
#define UART0_STATUS USR
|
||||||
|
#define UART0_CONTROL UCR
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_AT90S2333__) || defined(__AVR_AT90S4433__)
|
||||||
|
/* old AVR classic with one UART */
|
||||||
|
#define AT90_UART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT UART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT UART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega8__) || defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) \
|
||||||
|
|| defined(__AVR_ATmega323__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART_RXC_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined (__AVR_ATmega8515__) || defined(__AVR_ATmega8535__)
|
||||||
|
#define ATMEGA_USART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega163__)
|
||||||
|
/* ATmega163 with one UART */
|
||||||
|
#define ATMEGA_UART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT UART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT UART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega162__)
|
||||||
|
/* ATmega with two USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define ATMEGA_USART1
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RXC_vect
|
||||||
|
#define UART1_RECEIVE_INTERRUPT USART1_RXC_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#define UART1_STATUS UCSR1A
|
||||||
|
#define UART1_CONTROL UCSR1B
|
||||||
|
#define UART1_DATA UDR1
|
||||||
|
#define UART1_UDRIE UDRIE1
|
||||||
|
#elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__)
|
||||||
|
/* ATmega with two USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define ATMEGA_USART1
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART1_RECEIVE_INTERRUPT USART1_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#define UART1_STATUS UCSR1A
|
||||||
|
#define UART1_CONTROL UCSR1B
|
||||||
|
#define UART1_DATA UDR1
|
||||||
|
#define UART1_UDRIE UDRIE1
|
||||||
|
#elif defined(__AVR_ATmega161__)
|
||||||
|
/* ATmega with UART */
|
||||||
|
#error "AVR ATmega161 currently not supported by this libaray !"
|
||||||
|
#elif defined(__AVR_ATmega169__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega48__) || defined(__AVR_ATmega88__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega48P__) || defined(__AVR_ATmega88P__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__) \
|
||||||
|
|| defined(__AVR_ATmega3250__) || defined(__AVR_ATmega3290__) ||defined(__AVR_ATmega6450__) || defined(__AVR_ATmega6490__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#elif defined(__AVR_ATtiny2313__)
|
||||||
|
#define ATMEGA_USART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega329__) || \
|
||||||
|
defined(__AVR_ATmega649__) || \
|
||||||
|
defined(__AVR_ATmega325__) || \
|
||||||
|
defined(__AVR_ATmega645__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#elif defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega640__)
|
||||||
|
/* ATmega with two USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define ATMEGA_USART1
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART1_RECEIVE_INTERRUPT USART1_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#define UART1_STATUS UCSR1A
|
||||||
|
#define UART1_CONTROL UCSR1B
|
||||||
|
#define UART1_DATA UDR1
|
||||||
|
#define UART1_UDRIE UDRIE1
|
||||||
|
#elif defined(__AVR_ATmega644__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#elif defined(__AVR_ATmega164P__) || defined(__AVR_ATmega324P__) || defined(__AVR_ATmega644P__)
|
||||||
|
/* ATmega with two USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define ATMEGA_USART1
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART1_RECEIVE_INTERRUPT USART1_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#define UART1_STATUS UCSR1A
|
||||||
|
#define UART1_CONTROL UCSR1B
|
||||||
|
#define UART1_DATA UDR1
|
||||||
|
#define UART1_UDRIE UDRIE1
|
||||||
|
#else
|
||||||
|
#error "no UART definition for MCU available"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* module global variables
|
||||||
|
*/
|
||||||
|
static volatile unsigned char UART_TxBuf[UART_TX_BUFFER_SIZE];
|
||||||
|
static volatile unsigned char UART_RxBuf[UART_RX_BUFFER_SIZE];
|
||||||
|
static volatile unsigned char UART_TxHead;
|
||||||
|
static volatile unsigned char UART_TxTail;
|
||||||
|
static volatile unsigned char UART_RxHead;
|
||||||
|
static volatile unsigned char UART_RxTail;
|
||||||
|
static volatile unsigned char UART_LastRxError;
|
||||||
|
|
||||||
|
#if defined( ATMEGA_USART1 )
|
||||||
|
static volatile unsigned char UART1_TxBuf[UART_TX_BUFFER_SIZE];
|
||||||
|
static volatile unsigned char UART1_RxBuf[UART_RX_BUFFER_SIZE];
|
||||||
|
static volatile unsigned char UART1_TxHead;
|
||||||
|
static volatile unsigned char UART1_TxTail;
|
||||||
|
static volatile unsigned char UART1_RxHead;
|
||||||
|
static volatile unsigned char UART1_RxTail;
|
||||||
|
static volatile unsigned char UART1_LastRxError;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ISR (UART0_RECEIVE_INTERRUPT)
|
||||||
|
/*************************************************************************
|
||||||
|
Function: UART Receive Complete interrupt
|
||||||
|
Purpose: called when the UART has received a character
|
||||||
|
**************************************************************************/
|
||||||
|
{
|
||||||
|
unsigned char tmphead;
|
||||||
|
unsigned char data;
|
||||||
|
unsigned char usr;
|
||||||
|
unsigned char lastRxError;
|
||||||
|
|
||||||
|
|
||||||
|
/* read UART status register and UART data register */
|
||||||
|
usr = UART0_STATUS;
|
||||||
|
data = UART0_DATA;
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#if defined( AT90_UART )
|
||||||
|
lastRxError = (usr & (_BV(FE)|_BV(DOR)) );
|
||||||
|
#elif defined( ATMEGA_USART )
|
||||||
|
lastRxError = (usr & (_BV(FE)|_BV(DOR)) );
|
||||||
|
#elif defined( ATMEGA_USART0 )
|
||||||
|
lastRxError = (usr & (_BV(FE0)|_BV(DOR0)) );
|
||||||
|
#elif defined ( ATMEGA_UART )
|
||||||
|
lastRxError = (usr & (_BV(FE)|_BV(DOR)) );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* calculate buffer index */
|
||||||
|
tmphead = ( UART_RxHead + 1) & UART_RX_BUFFER_MASK;
|
||||||
|
|
||||||
|
if ( tmphead == UART_RxTail ) {
|
||||||
|
/* error: receive buffer overflow */
|
||||||
|
lastRxError = UART_BUFFER_OVERFLOW >> 8;
|
||||||
|
}else{
|
||||||
|
/* store new index */
|
||||||
|
UART_RxHead = tmphead;
|
||||||
|
/* store received data in buffer */
|
||||||
|
UART_RxBuf[tmphead] = data;
|
||||||
|
}
|
||||||
|
UART_LastRxError |= lastRxError;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ISR (UART0_TRANSMIT_INTERRUPT)
|
||||||
|
/*************************************************************************
|
||||||
|
Function: UART Data Register Empty interrupt
|
||||||
|
Purpose: called when the UART is ready to transmit the next byte
|
||||||
|
**************************************************************************/
|
||||||
|
{
|
||||||
|
unsigned char tmptail;
|
||||||
|
|
||||||
|
|
||||||
|
if ( UART_TxHead != UART_TxTail) {
|
||||||
|
/* calculate and store new buffer index */
|
||||||
|
tmptail = (UART_TxTail + 1) & UART_TX_BUFFER_MASK;
|
||||||
|
UART_TxTail = tmptail;
|
||||||
|
/* get one byte from buffer and write it to UART */
|
||||||
|
UART0_DATA = UART_TxBuf[tmptail]; /* start transmission */
|
||||||
|
}else{
|
||||||
|
/* tx buffer empty, disable UDRE interrupt */
|
||||||
|
UART0_CONTROL &= ~_BV(UART0_UDRIE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_init()
|
||||||
|
Purpose: initialize UART and set baudrate
|
||||||
|
Input: baudrate using macro UART_BAUD_SELECT()
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart_init(unsigned int baudrate)
|
||||||
|
{
|
||||||
|
UART_TxHead = 0;
|
||||||
|
UART_TxTail = 0;
|
||||||
|
UART_RxHead = 0;
|
||||||
|
UART_RxTail = 0;
|
||||||
|
|
||||||
|
#if defined( AT90_UART )
|
||||||
|
/* set baud rate */
|
||||||
|
UBRR = (unsigned char)baudrate;
|
||||||
|
|
||||||
|
/* enable UART receiver and transmmitter and receive complete interrupt */
|
||||||
|
UART0_CONTROL = _BV(RXCIE)|_BV(RXEN)|_BV(TXEN);
|
||||||
|
|
||||||
|
#elif defined (ATMEGA_USART)
|
||||||
|
/* Set baud rate */
|
||||||
|
if ( baudrate & 0x8000 )
|
||||||
|
{
|
||||||
|
UART0_STATUS = (1<<U2X); //Enable 2x speed
|
||||||
|
baudrate &= ~0x8000;
|
||||||
|
}
|
||||||
|
UBRRH = (unsigned char)(baudrate>>8);
|
||||||
|
UBRRL = (unsigned char) baudrate;
|
||||||
|
|
||||||
|
/* Enable USART receiver and transmitter and receive complete interrupt */
|
||||||
|
UART0_CONTROL = _BV(RXCIE)|(1<<RXEN)|(1<<TXEN);
|
||||||
|
|
||||||
|
/* Set frame format: asynchronous, 8data, no parity, 1stop bit */
|
||||||
|
#ifdef URSEL
|
||||||
|
UCSRC = (1<<URSEL)|(3<<UCSZ0);
|
||||||
|
#else
|
||||||
|
UCSRC = (3<<UCSZ0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined (ATMEGA_USART0 )
|
||||||
|
/* Set baud rate */
|
||||||
|
if ( baudrate & 0x8000 )
|
||||||
|
{
|
||||||
|
UART0_STATUS = (1<<U2X0); //Enable 2x speed
|
||||||
|
baudrate &= ~0x8000;
|
||||||
|
}
|
||||||
|
UBRR0H = (unsigned char)(baudrate>>8);
|
||||||
|
UBRR0L = (unsigned char) baudrate;
|
||||||
|
|
||||||
|
/* Enable USART receiver and transmitter and receive complete interrupt */
|
||||||
|
UART0_CONTROL = _BV(RXCIE0)|(1<<RXEN0)|(1<<TXEN0);
|
||||||
|
|
||||||
|
/* Set frame format: asynchronous, 8data, no parity, 1stop bit */
|
||||||
|
#ifdef URSEL0
|
||||||
|
UCSR0C = (1<<URSEL0)|(3<<UCSZ00);
|
||||||
|
#else
|
||||||
|
UCSR0C = (3<<UCSZ00);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined ( ATMEGA_UART )
|
||||||
|
/* set baud rate */
|
||||||
|
if ( baudrate & 0x8000 )
|
||||||
|
{
|
||||||
|
UART0_STATUS = (1<<U2X); //Enable 2x speed
|
||||||
|
baudrate &= ~0x8000;
|
||||||
|
}
|
||||||
|
UBRRHI = (unsigned char)(baudrate>>8);
|
||||||
|
UBRR = (unsigned char) baudrate;
|
||||||
|
|
||||||
|
/* Enable UART receiver and transmitter and receive complete interrupt */
|
||||||
|
UART0_CONTROL = _BV(RXCIE)|(1<<RXEN)|(1<<TXEN);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}/* uart_init */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_getc()
|
||||||
|
Purpose: return byte from ringbuffer
|
||||||
|
Returns: lower byte: received byte from ringbuffer
|
||||||
|
higher byte: last receive error
|
||||||
|
**************************************************************************/
|
||||||
|
unsigned int uart_getc(void)
|
||||||
|
{
|
||||||
|
unsigned char tmptail;
|
||||||
|
unsigned char data;
|
||||||
|
|
||||||
|
|
||||||
|
if ( UART_RxHead == UART_RxTail ) {
|
||||||
|
return UART_NO_DATA; /* no data available */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* calculate /store buffer index */
|
||||||
|
tmptail = (UART_RxTail + 1) & UART_RX_BUFFER_MASK;
|
||||||
|
UART_RxTail = tmptail;
|
||||||
|
|
||||||
|
/* get data from receive buffer */
|
||||||
|
data = UART_RxBuf[tmptail];
|
||||||
|
|
||||||
|
data = (UART_LastRxError << 8) + data;
|
||||||
|
UART_LastRxError = 0;
|
||||||
|
return data;
|
||||||
|
|
||||||
|
}/* uart_getc */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_putc()
|
||||||
|
Purpose: write byte to ringbuffer for transmitting via UART
|
||||||
|
Input: byte to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart_putc(unsigned char data)
|
||||||
|
{
|
||||||
|
unsigned char tmphead;
|
||||||
|
|
||||||
|
|
||||||
|
tmphead = (UART_TxHead + 1) & UART_TX_BUFFER_MASK;
|
||||||
|
|
||||||
|
while ( tmphead == UART_TxTail ){
|
||||||
|
;/* wait for free space in buffer */
|
||||||
|
}
|
||||||
|
|
||||||
|
UART_TxBuf[tmphead] = data;
|
||||||
|
UART_TxHead = tmphead;
|
||||||
|
|
||||||
|
/* enable UDRE interrupt */
|
||||||
|
UART0_CONTROL |= _BV(UART0_UDRIE);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}/* uart_putc */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_puts()
|
||||||
|
Purpose: transmit string to UART
|
||||||
|
Input: string to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart_puts(const char *s )
|
||||||
|
{
|
||||||
|
while (*s)
|
||||||
|
uart_putc(*s++);
|
||||||
|
|
||||||
|
}/* uart_puts */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_puts_p()
|
||||||
|
Purpose: transmit string from program memory to UART
|
||||||
|
Input: program memory string to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart_puts_p(const char *progmem_s )
|
||||||
|
{
|
||||||
|
register char c;
|
||||||
|
|
||||||
|
while ( (c = pgm_read_byte(progmem_s++)) )
|
||||||
|
uart_putc(c);
|
||||||
|
|
||||||
|
}/* uart_puts_p */
|
||||||
|
|
|
@ -0,0 +1,180 @@
|
||||||
|
#ifndef UART_H
|
||||||
|
#define UART_H
|
||||||
|
/************************************************************************
|
||||||
|
Title: Interrupt UART library with receive/transmit circular buffers
|
||||||
|
Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
|
||||||
|
File: $Id: uart.h,v 1.12 2012/11/19 19:52:27 peter Exp $
|
||||||
|
Software: AVR-GCC 4.1, AVR Libc 1.4
|
||||||
|
Hardware: any AVR with built-in UART, tested on AT90S8515 & ATmega8 at 4 Mhz
|
||||||
|
License: GNU General Public License
|
||||||
|
Usage: see Doxygen manual
|
||||||
|
|
||||||
|
LICENSE:
|
||||||
|
Copyright (C) 2006 Peter Fleury
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup pfleury_uart UART Library
|
||||||
|
* @code #include <uart.h> @endcode
|
||||||
|
*
|
||||||
|
* @brief Interrupt UART library using the built-in UART with transmit and receive circular buffers.
|
||||||
|
*
|
||||||
|
* This library can be used to transmit and receive data through the built in UART.
|
||||||
|
*
|
||||||
|
* An interrupt is generated when the UART has finished transmitting or
|
||||||
|
* receiving a byte. The interrupt handling routines use circular buffers
|
||||||
|
* for buffering received and transmitted data.
|
||||||
|
*
|
||||||
|
* The UART_RX_BUFFER_SIZE and UART_TX_BUFFER_SIZE constants define
|
||||||
|
* the size of the circular buffers in bytes. Note that these constants must be a power of 2.
|
||||||
|
* You may need to adapt this constants to your target and your application by adding
|
||||||
|
* CDEFS += -DUART_RX_BUFFER_SIZE=nn -DUART_RX_BUFFER_SIZE=nn to your Makefile.
|
||||||
|
*
|
||||||
|
* @note Based on Atmel Application Note AVR306
|
||||||
|
* @author Peter Fleury pfleury@gmx.ch http://jump.to/fleury
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**@{*/
|
||||||
|
|
||||||
|
|
||||||
|
#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304
|
||||||
|
#error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** constants and macros
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @brief UART Baudrate Expression
|
||||||
|
* @param xtalcpu system clock in Mhz, e.g. 4000000UL for 4Mhz
|
||||||
|
* @param baudrate baudrate in bps, e.g. 1200, 2400, 9600
|
||||||
|
*/
|
||||||
|
#define UART_BAUD_SELECT(baudRate,xtalCpu) (((xtalCpu) + 8UL * (baudRate)) / (16UL * (baudRate)) -1UL)
|
||||||
|
|
||||||
|
/** @brief UART Baudrate Expression for ATmega double speed mode
|
||||||
|
* @param xtalcpu system clock in Mhz, e.g. 4000000UL for 4Mhz
|
||||||
|
* @param baudrate baudrate in bps, e.g. 1200, 2400, 9600
|
||||||
|
*/
|
||||||
|
#define UART_BAUD_SELECT_DOUBLE_SPEED(baudRate,xtalCpu) ( ((((xtalCpu) + 4UL * (baudRate)) / (8UL * (baudRate)) -1UL)) | 0x8000)
|
||||||
|
|
||||||
|
|
||||||
|
/** Size of the circular receive buffer, must be power of 2 */
|
||||||
|
#ifndef UART_RX_BUFFER_SIZE
|
||||||
|
#define UART_RX_BUFFER_SIZE 32
|
||||||
|
#endif
|
||||||
|
/** Size of the circular transmit buffer, must be power of 2 */
|
||||||
|
#ifndef UART_TX_BUFFER_SIZE
|
||||||
|
#define UART_TX_BUFFER_SIZE 32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* test if the size of the circular buffers fits into SRAM */
|
||||||
|
#if ( (UART_RX_BUFFER_SIZE+UART_TX_BUFFER_SIZE) >= (RAMEND-0x60 ) )
|
||||||
|
#error "size of UART_RX_BUFFER_SIZE + UART_TX_BUFFER_SIZE larger than size of SRAM"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** high byte error return code of uart_getc()
|
||||||
|
*/
|
||||||
|
#define UART_FRAME_ERROR 0x1000 /* Framing Error by UART */
|
||||||
|
#define UART_OVERRUN_ERROR 0x0800 /* Overrun condition by UART */
|
||||||
|
#define UART_PARITY_ERROR 0x0400 /* Parity Error by UART */
|
||||||
|
#define UART_BUFFER_OVERFLOW 0x0200 /* receive ringbuffer overflow */
|
||||||
|
#define UART_NO_DATA 0x0100 /* no receive data available */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** function prototypes
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Initialize UART and set baudrate
|
||||||
|
@param baudrate Specify baudrate using macro UART_BAUD_SELECT()
|
||||||
|
@return none
|
||||||
|
*/
|
||||||
|
extern void uart_init(unsigned int baudrate);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get received byte from ringbuffer
|
||||||
|
*
|
||||||
|
* Returns in the lower byte the received character and in the
|
||||||
|
* higher byte the last receive error.
|
||||||
|
* UART_NO_DATA is returned when no data is available.
|
||||||
|
*
|
||||||
|
* @param void
|
||||||
|
* @return lower byte: received byte from ringbuffer
|
||||||
|
* @return higher byte: last receive status
|
||||||
|
* - \b 0 successfully received data from UART
|
||||||
|
* - \b UART_NO_DATA
|
||||||
|
* <br>no receive data available
|
||||||
|
* - \b UART_BUFFER_OVERFLOW
|
||||||
|
* <br>Receive ringbuffer overflow.
|
||||||
|
* We are not reading the receive buffer fast enough,
|
||||||
|
* one or more received character have been dropped
|
||||||
|
* - \b UART_OVERRUN_ERROR
|
||||||
|
* <br>Overrun condition by UART.
|
||||||
|
* A character already present in the UART UDR register was
|
||||||
|
* not read by the interrupt handler before the next character arrived,
|
||||||
|
* one or more received characters have been dropped.
|
||||||
|
* - \b UART_FRAME_ERROR
|
||||||
|
* <br>Framing Error by UART
|
||||||
|
*/
|
||||||
|
extern unsigned int uart_getc(void);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Put byte to ringbuffer for transmitting via UART
|
||||||
|
* @param data byte to be transmitted
|
||||||
|
* @return none
|
||||||
|
*/
|
||||||
|
extern void uart_putc(unsigned char data);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Put string to ringbuffer for transmitting via UART
|
||||||
|
*
|
||||||
|
* The string is buffered by the uart library in a circular buffer
|
||||||
|
* and one character at a time is transmitted to the UART using interrupts.
|
||||||
|
* Blocks if it can not write the whole string into the circular buffer.
|
||||||
|
*
|
||||||
|
* @param s string to be transmitted
|
||||||
|
* @return none
|
||||||
|
*/
|
||||||
|
extern void uart_puts(const char *s );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Put string from program memory to ringbuffer for transmitting via UART.
|
||||||
|
*
|
||||||
|
* The string is buffered by the uart library in a circular buffer
|
||||||
|
* and one character at a time is transmitted to the UART using interrupts.
|
||||||
|
* Blocks if it can not write the whole string into the circular buffer.
|
||||||
|
*
|
||||||
|
* @param s program memory string to be transmitted
|
||||||
|
* @return none
|
||||||
|
* @see uart_puts_P
|
||||||
|
*/
|
||||||
|
extern void uart_puts_p(const char *s );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Macro to automatically put a string constant into program memory
|
||||||
|
*/
|
||||||
|
#define uart_puts_P(__s) uart_puts_p(PSTR(__s))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // UART_H
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include "uart.h"
|
||||||
|
|
||||||
|
void wait(uint8_t count) {
|
||||||
|
uint8_t i;
|
||||||
|
if(count == 0) count = 100;
|
||||||
|
for(i=0;i<count;i++) {
|
||||||
|
_delay_ms(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_print_voltage(uint16_t x) {
|
||||||
|
uart_putc(48 + (x / 10000));
|
||||||
|
uart_putc(48 + (x % 10000 /1000));
|
||||||
|
uart_putc('.');
|
||||||
|
uart_putc(48 + (x % 1000 / 100 ));
|
||||||
|
//uart_putc(48 + (x % 100 / 10 ));
|
||||||
|
//uart_putc(48 + (x % 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_print_int16(int16_t x) {
|
||||||
|
if(x <0) uart_putc('-');
|
||||||
|
uart_putc(48 + (x / 10000));
|
||||||
|
uart_putc(48 + (x % 10000 /1000));
|
||||||
|
uart_putc(48 + (x % 1000 / 100 ));
|
||||||
|
uart_putc(48 + (x % 100 / 10 ));
|
||||||
|
uart_putc(48 + (x % 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_print_uint16(uint16_t x) {
|
||||||
|
uart_putc(48 + (x / 10000));
|
||||||
|
uart_putc(48 + (x % 10000 /1000));
|
||||||
|
uart_putc(48 + (x % 1000 / 100 ));
|
||||||
|
uart_putc(48 + (x % 100 / 10 ));
|
||||||
|
uart_putc(48 + (x % 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef _utils_h
|
||||||
|
#define _utils_h
|
||||||
|
|
||||||
|
extern void wait(uint8_t count);
|
||||||
|
extern void uart_print_voltage(uint16_t);
|
||||||
|
extern void uart_print_int16(int16_t);
|
||||||
|
extern void uart_print_uint16(uint16_t);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,276 @@
|
||||||
|
# On command line:
|
||||||
|
#
|
||||||
|
# make all = Make software.
|
||||||
|
#
|
||||||
|
# make clean = Clean out built project files.
|
||||||
|
#
|
||||||
|
# make program = Download the hex file to the device, using avrdude. Please
|
||||||
|
# customize the avrdude settings below first!
|
||||||
|
#
|
||||||
|
# To rebuild project do "make clean" then "make all".
|
||||||
|
#
|
||||||
|
|
||||||
|
MCU = atmega8
|
||||||
|
F_CPU = 8000000
|
||||||
|
|
||||||
|
# Output format. (can be srec, ihex, binary)
|
||||||
|
FORMAT = ihex
|
||||||
|
|
||||||
|
# Target file name (without extension).
|
||||||
|
TARGET = main
|
||||||
|
|
||||||
|
SRC = src/$(TARGET).c src/adc.c src/utils.c src/uart.c
|
||||||
|
|
||||||
|
|
||||||
|
# Optimization level, can be [0, 1, 2, 3, s].
|
||||||
|
# 0 = turn off optimization. s = optimize for size.
|
||||||
|
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
||||||
|
OPT = s
|
||||||
|
|
||||||
|
|
||||||
|
# List any extra directories to look for include files here.
|
||||||
|
# Each directory must be seperated by a space.
|
||||||
|
EXTRAINCDIRS = src/
|
||||||
|
|
||||||
|
|
||||||
|
# Compiler flag to set the C Standard level.
|
||||||
|
# c89 - "ANSI" C
|
||||||
|
# gnu89 - c89 plus GCC extensions
|
||||||
|
# c99 - ISO C99 standard (not yet fully implemented)
|
||||||
|
# gnu99 - c99 plus GCC extensions
|
||||||
|
CSTANDARD = -std=gnu99
|
||||||
|
|
||||||
|
# Place -D or -U options here
|
||||||
|
CDEFS =
|
||||||
|
|
||||||
|
# Place -I options here
|
||||||
|
CINCS =
|
||||||
|
|
||||||
|
|
||||||
|
# Compiler flags.
|
||||||
|
# -O*: optimization level
|
||||||
|
# -f...: tuning, see GCC manual and avr-libc documentation
|
||||||
|
# -Wall...: warning level
|
||||||
|
# -Wa,...: tell GCC to pass this to the assembler.
|
||||||
|
# -adhlns...: create assembler listing
|
||||||
|
CFLAGS += $(CDEFS) $(CINCS)
|
||||||
|
CFLAGS += -O$(OPT)
|
||||||
|
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
|
||||||
|
CFLAGS += -Wall -Wstrict-prototypes
|
||||||
|
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
|
||||||
|
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||||
|
CFLAGS += $(CSTANDARD)
|
||||||
|
CFLAGS += -DF_CPU=$(F_CPU) #-DDEBUG
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# External memory options
|
||||||
|
|
||||||
|
|
||||||
|
# Linker flags.
|
||||||
|
# -Wl,...: tell GCC to pass this to linker.
|
||||||
|
# -Map: create map file
|
||||||
|
# --cref: add cross reference to map file
|
||||||
|
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
||||||
|
|
||||||
|
|
||||||
|
# Programming support using avrdude. Settings and variables.
|
||||||
|
AVRDUDE_PROGRAMMER = usbasp
|
||||||
|
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
|
||||||
|
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
|
||||||
|
|
||||||
|
AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Define programs and commands.
|
||||||
|
SHELL = sh
|
||||||
|
CC = avr-gcc
|
||||||
|
OBJCOPY = avr-objcopy
|
||||||
|
OBJDUMP = avr-objdump
|
||||||
|
SIZE = avr-size
|
||||||
|
NM = avr-nm
|
||||||
|
AVRDUDE = avrdude
|
||||||
|
REMOVE = rm -f
|
||||||
|
COPY = cp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Define Messages
|
||||||
|
# English
|
||||||
|
MSG_ERRORS_NONE = Errors: none
|
||||||
|
MSG_BEGIN = -------- begin --------
|
||||||
|
MSG_END = -------- end --------
|
||||||
|
MSG_SIZE_BEFORE = Size before:
|
||||||
|
MSG_SIZE_AFTER = Size after:
|
||||||
|
MSG_COFF = Converting to AVR COFF:
|
||||||
|
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
|
||||||
|
MSG_FLASH = Creating load file for Flash:
|
||||||
|
MSG_EEPROM = Creating load file for EEPROM:
|
||||||
|
MSG_EXTENDED_LISTING = Creating Extended Listing:
|
||||||
|
MSG_SYMBOL_TABLE = Creating Symbol Table:
|
||||||
|
MSG_LINKING = Linking:
|
||||||
|
MSG_COMPILING = Compiling:
|
||||||
|
MSG_ASSEMBLING = Assembling:
|
||||||
|
MSG_CLEANING = Cleaning project:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Define all object files.
|
||||||
|
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
|
||||||
|
|
||||||
|
# Define all listing files.
|
||||||
|
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst)
|
||||||
|
|
||||||
|
|
||||||
|
# Compiler flags to generate dependency files.
|
||||||
|
### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
|
||||||
|
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
|
||||||
|
|
||||||
|
# Combine all necessary flags and optional flags.
|
||||||
|
# Add target processor to flags.
|
||||||
|
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
# Default target.
|
||||||
|
all: begin gccversion sizebefore build sizeafter finished end
|
||||||
|
|
||||||
|
build: elf hex eep lss sym
|
||||||
|
|
||||||
|
elf: $(TARGET).elf
|
||||||
|
hex: $(TARGET).hex
|
||||||
|
eep: $(TARGET).eep
|
||||||
|
lss: $(TARGET).lss
|
||||||
|
sym: $(TARGET).sym
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Eye candy.
|
||||||
|
# AVR Studio 3.x does not check make's exit code but relies on
|
||||||
|
# the following magic strings to be generated by the compile job.
|
||||||
|
begin:
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_BEGIN)
|
||||||
|
|
||||||
|
finished:
|
||||||
|
@echo $(MSG_ERRORS_NONE)
|
||||||
|
|
||||||
|
end:
|
||||||
|
@echo $(MSG_END)
|
||||||
|
@echo
|
||||||
|
|
||||||
|
|
||||||
|
# Display size of file.
|
||||||
|
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
|
||||||
|
ELFSIZE = $(SIZE) -A $(TARGET).elf
|
||||||
|
sizebefore:
|
||||||
|
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
|
||||||
|
|
||||||
|
sizeafter:
|
||||||
|
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Display compiler version information.
|
||||||
|
gccversion :
|
||||||
|
@$(CC) --version
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Program the device.
|
||||||
|
program: $(TARGET).hex $(TARGET).eep
|
||||||
|
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
|
||||||
|
|
||||||
|
|
||||||
|
# Create final output files (.hex, .eep) from ELF output file.
|
||||||
|
%.hex: %.elf
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_FLASH) $@
|
||||||
|
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
|
||||||
|
|
||||||
|
%.eep: %.elf
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_EEPROM) $@
|
||||||
|
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
||||||
|
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
|
||||||
|
|
||||||
|
# Create extended listing file from ELF output file.
|
||||||
|
%.lss: %.elf
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_EXTENDED_LISTING) $@
|
||||||
|
$(OBJDUMP) -h -S $< > $@
|
||||||
|
|
||||||
|
# Create a symbol table from ELF output file.
|
||||||
|
%.sym: %.elf
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_SYMBOL_TABLE) $@
|
||||||
|
$(NM) -n $< > $@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Link: create ELF output file from object files.
|
||||||
|
.SECONDARY : $(TARGET).elf
|
||||||
|
.PRECIOUS : $(OBJ)
|
||||||
|
%.elf: $(OBJ)
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_LINKING) $@
|
||||||
|
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
# Compile: create object files from C source files.
|
||||||
|
%.o : %.c
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_COMPILING) $<
|
||||||
|
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
|
# Compile: create assembler files from C source files.
|
||||||
|
%.s : %.c
|
||||||
|
$(CC) -S $(ALL_CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
|
# Assemble: create object files from assembler source files.
|
||||||
|
%.o : %.S
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_ASSEMBLING) $<
|
||||||
|
$(CC) -c $(ALL_ASFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Target: clean project.
|
||||||
|
clean: begin clean_list finished end
|
||||||
|
|
||||||
|
clean_list :
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_CLEANING)
|
||||||
|
$(REMOVE) $(TARGET).hex
|
||||||
|
$(REMOVE) $(TARGET).eep
|
||||||
|
$(REMOVE) $(TARGET).obj
|
||||||
|
$(REMOVE) $(TARGET).cof
|
||||||
|
$(REMOVE) $(TARGET).elf
|
||||||
|
$(REMOVE) $(TARGET).map
|
||||||
|
$(REMOVE) $(TARGET).obj
|
||||||
|
$(REMOVE) $(TARGET).a90
|
||||||
|
$(REMOVE) $(TARGET).sym
|
||||||
|
$(REMOVE) $(TARGET).lnk
|
||||||
|
$(REMOVE) $(TARGET).lss
|
||||||
|
$(REMOVE) $(OBJ)
|
||||||
|
$(REMOVE) $(LST)
|
||||||
|
$(REMOVE) $(SRC:.c=.s)
|
||||||
|
$(REMOVE) $(SRC:.c=.d)
|
||||||
|
$(REMOVE) .dep/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Include the dependency files.
|
||||||
|
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
|
||||||
|
|
||||||
|
|
||||||
|
# Listing of phony targets.
|
||||||
|
.PHONY : all begin finish end sizebefore sizeafter gccversion \
|
||||||
|
build elf hex eep lss sym coff extcoff \
|
||||||
|
clean clean_list program
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="C++" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="jdk" jdkName="Cpp SDK" jdkType="CppSdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
#include <avr/io.h>
|
||||||
|
|
||||||
|
|
||||||
|
void adc_init(void) {
|
||||||
|
uint16_t dummyResult;
|
||||||
|
// AVCC with external capacitor at AREF pin
|
||||||
|
ADMUX = _BV(REFS0);
|
||||||
|
|
||||||
|
// set frequency prescaler to 8
|
||||||
|
ADCSRA = _BV(ADPS1) | _BV(ADPS0);
|
||||||
|
|
||||||
|
// enable ADC
|
||||||
|
ADCSRA |= _BV(ADEN);
|
||||||
|
|
||||||
|
// make a dummy read out
|
||||||
|
ADCSRA |= _BV(ADSC);
|
||||||
|
while (ADCSRA & _BV(ADSC) ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// we have to read, otherwise the next result is not available
|
||||||
|
dummyResult = ADCW;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t adc_read_single(uint8_t channel) {
|
||||||
|
ADMUX = (ADMUX & ~(0x1F)) | (channel & 0x1F);
|
||||||
|
ADCSRA |= _BV(ADSC);
|
||||||
|
while (ADCSRA & (1<<ADSC) ) {
|
||||||
|
}
|
||||||
|
return ADCW;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t adc_read_avg(const uint8_t channel, const uint8_t nsamples) {
|
||||||
|
uint16_t sum = 0;
|
||||||
|
uint8_t count = nsamples % 60;
|
||||||
|
|
||||||
|
for (uint8_t i=0; i<count;++i ) {
|
||||||
|
sum += adc_read_single(channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (sum / count);
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef _adc_h
|
||||||
|
#define _adc_h
|
||||||
|
|
||||||
|
extern void adc_init(void);
|
||||||
|
extern uint16_t adc_read_single(uint8_t);
|
||||||
|
extern uint16_t adc_read_avg(uint8_t, uint8_t);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,232 @@
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#include "utils.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "adc.h"
|
||||||
|
#include "uart.h"
|
||||||
|
|
||||||
|
volatile uint16_t syscounter = 0;
|
||||||
|
uint16_t voltage = 0;
|
||||||
|
uint16_t current_in = 0;
|
||||||
|
uint16_t current_out = 0;
|
||||||
|
|
||||||
|
uint8_t overvoltage_counter1 = 0;
|
||||||
|
uint8_t overvoltage_off_counter1 = 0;
|
||||||
|
uint8_t overvoltage_counter2 = 0;
|
||||||
|
uint8_t overvoltage_off_counter2 = 0;
|
||||||
|
uint8_t undervoltage_counter = 0;
|
||||||
|
uint8_t undervoltage_off_counter = 0;
|
||||||
|
|
||||||
|
|
||||||
|
static void timer_init(void) {
|
||||||
|
// clock is 8MHz
|
||||||
|
TCCR1B |= _BV(WGM12) | _BV(CS11) | _BV(CS10) ; // CTC Mode for Timer 1 (16Bit) with prescale of 64
|
||||||
|
OCR1A = 1250; // 100Hz
|
||||||
|
TIMSK = _BV(OCIE1A);
|
||||||
|
sei(); // enable interrupts
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ports_init(void) {
|
||||||
|
DDR_SW |= _BV(LOADSW) | _BV(GENSW) | _BV(DUMPSW);
|
||||||
|
PORT_SW &= ~(_BV(LOADSW) | _BV(GENSW) | _BV(DUMPSW));
|
||||||
|
}
|
||||||
|
|
||||||
|
void measure(void) {
|
||||||
|
static int16_t temp;
|
||||||
|
|
||||||
|
voltage = adc_read_avg(AD_V, 4);
|
||||||
|
voltage *= VOLTAGE_PER_TICK;
|
||||||
|
|
||||||
|
temp = adc_read_avg(AD_I_GEN, 4);
|
||||||
|
temp -= CURRENT_OFFSET;
|
||||||
|
if(temp < 0) temp = 0;
|
||||||
|
current_in = temp * CURRENT_PER_TICK;
|
||||||
|
|
||||||
|
temp = adc_read_avg(AD_I_LOAD, 4);
|
||||||
|
temp -= CURRENT_OFFSET;
|
||||||
|
if(temp < 0) temp = 0;
|
||||||
|
current_out = temp * CURRENT_PER_TICK;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t get_power(uint16_t voltage, int16_t currents) {
|
||||||
|
return (voltage/100 * (currents/100)) / 100 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pretty_print_all_values(void) {
|
||||||
|
uart_puts_P("Voltage: ");
|
||||||
|
uart_print_uint16(voltage);
|
||||||
|
uart_puts_P("mV\r\n");
|
||||||
|
|
||||||
|
uart_puts_P("Load: ");
|
||||||
|
uart_print_uint16(current_out);
|
||||||
|
uart_puts_P("mA ");
|
||||||
|
uart_print_uint16( get_power(voltage, current_out));
|
||||||
|
uart_puts_P("W\r\n");
|
||||||
|
|
||||||
|
uart_puts_P("Generator: ");
|
||||||
|
uart_print_uint16(current_in);
|
||||||
|
uart_puts_P("mA ");
|
||||||
|
uart_print_uint16(get_power(voltage, current_in));
|
||||||
|
uart_puts_P("W\r\n");
|
||||||
|
|
||||||
|
uart_puts_P("switches (load, dump, gen): ");
|
||||||
|
uart_putc(48 + (IS_LOAD_ON >> LOADSW));
|
||||||
|
uart_putc(',');
|
||||||
|
uart_putc(48 + (IS_DUMP_ON >> DUMPSW));
|
||||||
|
uart_putc(',');
|
||||||
|
uart_putc(48 + (IS_GEN_ON >> GENSW));
|
||||||
|
uart_puts_P("\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void handle_over_and_undervoltage(void) {
|
||||||
|
if(voltage > OVERVOLTAGE1) {
|
||||||
|
overvoltage_off_counter1 = 0;
|
||||||
|
if(overvoltage_counter1<OVERVOLTAGE_TIMEOUT1) overvoltage_counter1++;
|
||||||
|
} else {
|
||||||
|
overvoltage_counter1 = 0;
|
||||||
|
if(overvoltage_off_counter1<OVERVOLTAGEOFF_TIMEOUT1) overvoltage_off_counter1++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(voltage > OVERVOLTAGE2) {
|
||||||
|
overvoltage_off_counter2 = 0;
|
||||||
|
if(overvoltage_counter2<OVERVOLTAGE_TIMEOUT2) overvoltage_counter2++;
|
||||||
|
} else {
|
||||||
|
overvoltage_counter2 = 0;
|
||||||
|
if(overvoltage_off_counter2<OVERVOLTAGEOFF_TIMEOUT2) overvoltage_off_counter2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(voltage < UNDERVOLTAGE) {
|
||||||
|
undervoltage_off_counter = 0;
|
||||||
|
if(undervoltage_counter<UNDERVOLTAGE_TIMEOUT) undervoltage_counter++;
|
||||||
|
} else {
|
||||||
|
undervoltage_counter = 0;
|
||||||
|
if(undervoltage_off_counter<UNDERVOLTAGEOFF_TIMEOUT) undervoltage_off_counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(overvoltage_counter1 >= OVERVOLTAGE_TIMEOUT1) {
|
||||||
|
overvoltage_off_counter1 = 0;
|
||||||
|
DUMP_ON;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(overvoltage_off_counter1 >= OVERVOLTAGEOFF_TIMEOUT1) {
|
||||||
|
overvoltage_counter1 = 0;
|
||||||
|
DUMP_OFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(overvoltage_counter2 >= OVERVOLTAGE_TIMEOUT2) {
|
||||||
|
overvoltage_off_counter2 = 0;
|
||||||
|
GEN_OFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(overvoltage_off_counter2 >= OVERVOLTAGEOFF_TIMEOUT2) {
|
||||||
|
overvoltage_counter2 = 0;
|
||||||
|
GEN_ON;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(undervoltage_counter >= UNDERVOLTAGE_TIMEOUT) {
|
||||||
|
undervoltage_off_counter = 0;
|
||||||
|
overvoltage_off_counter1 = OVERVOLTAGEOFF_TIMEOUT1;
|
||||||
|
LOAD_OFF;
|
||||||
|
DUMP_OFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(undervoltage_off_counter >= UNDERVOLTAGEOFF_TIMEOUT) {
|
||||||
|
undervoltage_counter = 0;
|
||||||
|
LOAD_ON;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
uart_puts_P("ov1=");
|
||||||
|
uart_print_uint8(overvoltage_counter1);
|
||||||
|
uart_puts_P(" ovo1=");
|
||||||
|
uart_print_uint8 (overvoltage_off_counter1);
|
||||||
|
uart_puts_P("\r\n");
|
||||||
|
|
||||||
|
uart_puts_P("ov2=");
|
||||||
|
uart_print_uint8(overvoltage_counter2);
|
||||||
|
uart_puts_P(" ovo2=");
|
||||||
|
uart_print_uint8 (overvoltage_off_counter2);
|
||||||
|
uart_puts_P("\r\n");
|
||||||
|
|
||||||
|
uart_puts_P("uv =");
|
||||||
|
uart_print_uint8(undervoltage_counter);
|
||||||
|
uart_puts_P(" uvo =");
|
||||||
|
uart_print_uint8(undervoltage_off_counter);
|
||||||
|
uart_puts_P("\r\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void work_uart(void) {
|
||||||
|
uint16_t uart_char = uart_getc();
|
||||||
|
|
||||||
|
if(uart_char != UART_NO_DATA) {
|
||||||
|
switch(uart_char & 0xff) {
|
||||||
|
case 'p':
|
||||||
|
pretty_print_all_values();
|
||||||
|
break;
|
||||||
|
case 'a':
|
||||||
|
uart_putc('A');
|
||||||
|
uart_print_uint16(voltage);
|
||||||
|
uart_putc(',');
|
||||||
|
uart_print_uint16(current_in);
|
||||||
|
uart_putc(',');
|
||||||
|
uart_print_uint16(current_out);
|
||||||
|
uart_putc(',');
|
||||||
|
uart_print_uint16(get_power(voltage, current_in));
|
||||||
|
uart_putc(',');
|
||||||
|
uart_print_uint16(get_power(voltage, current_out));
|
||||||
|
uart_putc(',');
|
||||||
|
uart_putc(48 + (IS_LOAD_ON >> LOADSW));
|
||||||
|
uart_putc(',');
|
||||||
|
uart_putc(48 + (IS_DUMP_ON >> DUMPSW));
|
||||||
|
uart_putc(',');
|
||||||
|
uart_putc(48 + (IS_GEN_ON >> GENSW));
|
||||||
|
uart_putc('B');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
ports_init();
|
||||||
|
adc_init();
|
||||||
|
timer_init();
|
||||||
|
uart_init(UART_BAUD_SELECT(19200,F_CPU));
|
||||||
|
|
||||||
|
LOAD_OFF;
|
||||||
|
GEN_ON;
|
||||||
|
DUMP_OFF;
|
||||||
|
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
|
||||||
|
if(syscounter >= 100) {
|
||||||
|
syscounter = 0;
|
||||||
|
|
||||||
|
measure();
|
||||||
|
|
||||||
|
//pretty_print_all_values();
|
||||||
|
|
||||||
|
handle_over_and_undervoltage();
|
||||||
|
}
|
||||||
|
|
||||||
|
work_uart();
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// system timer
|
||||||
|
SIGNAL(TIMER1_COMPA_vect) {
|
||||||
|
syscounter++;
|
||||||
|
syscounter %= 60000;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
#ifndef _main_h
|
||||||
|
#define _main_h
|
||||||
|
|
||||||
|
#define AD_I_LOAD 0
|
||||||
|
#define AD_I_GEN 1
|
||||||
|
#define AD_V 2
|
||||||
|
|
||||||
|
#define LOADSW PB0
|
||||||
|
#define GENSW PB1
|
||||||
|
#define DUMPSW PB2
|
||||||
|
#define PORT_SW PORTB
|
||||||
|
#define DDR_SW DDRB
|
||||||
|
#define PIN_SW PINB
|
||||||
|
|
||||||
|
#define LOAD_ON PORT_SW |= _BV(LOADSW)
|
||||||
|
#define LOAD_OFF PORT_SW &= ~_BV(LOADSW)
|
||||||
|
#define GEN_ON PORT_SW |= _BV(GENSW)
|
||||||
|
#define GEN_OFF PORT_SW &= ~_BV(GENSW)
|
||||||
|
#define DUMP_ON PORT_SW |= _BV(DUMPSW)
|
||||||
|
#define DUMP_OFF PORT_SW &= ~_BV(DUMPSW)
|
||||||
|
|
||||||
|
#define IS_LOAD_ON (PIN_SW & _BV(LOADSW))
|
||||||
|
#define IS_DUMP_ON (PIN_SW & _BV(DUMPSW))
|
||||||
|
#define IS_GEN_ON (PIN_SW & _BV(GENSW))
|
||||||
|
|
||||||
|
#define UNDERVOLTAGE 11200
|
||||||
|
#define OVERVOLTAGE1 15000
|
||||||
|
#define OVERVOLTAGE2 16500
|
||||||
|
#define OVERVOLTAGE_TIMEOUT1 8
|
||||||
|
#define OVERVOLTAGEOFF_TIMEOUT1 1
|
||||||
|
#define OVERVOLTAGE_TIMEOUT2 6
|
||||||
|
#define OVERVOLTAGEOFF_TIMEOUT2 3
|
||||||
|
#define UNDERVOLTAGE_TIMEOUT 5
|
||||||
|
#define UNDERVOLTAGEOFF_TIMEOUT 2
|
||||||
|
|
||||||
|
#define CURRENT_OFFSET 511
|
||||||
|
#define CURRENT_PER_TICK 72
|
||||||
|
#define VOLTAGE_PER_TICK 15.5
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,663 @@
|
||||||
|
/*************************************************************************
|
||||||
|
Title: Interrupt UART library with receive/transmit circular buffers
|
||||||
|
Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
|
||||||
|
File: $Id: uart.c,v 1.10 2013/06/02 07:27:04 peter Exp $
|
||||||
|
Software: AVR-GCC 4.1, AVR Libc 1.4.6 or higher
|
||||||
|
Hardware: any AVR with built-in UART,
|
||||||
|
License: GNU General Public License
|
||||||
|
|
||||||
|
DESCRIPTION:
|
||||||
|
An interrupt is generated when the UART has finished transmitting or
|
||||||
|
receiving a byte. The interrupt handling routines use circular buffers
|
||||||
|
for buffering received and transmitted data.
|
||||||
|
|
||||||
|
The UART_RX_BUFFER_SIZE and UART_TX_BUFFER_SIZE variables define
|
||||||
|
the buffer size in bytes. Note that these variables must be a
|
||||||
|
power of 2.
|
||||||
|
|
||||||
|
USAGE:
|
||||||
|
Refere to the header file uart.h for a description of the routines.
|
||||||
|
See also example test_uart.c.
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
Based on Atmel Application Note AVR306
|
||||||
|
|
||||||
|
LICENSE:
|
||||||
|
Copyright (C) 2006 Peter Fleury
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
*************************************************************************/
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#include "uart.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* constants and macros
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* size of RX/TX buffers */
|
||||||
|
#define UART_RX_BUFFER_MASK ( UART_RX_BUFFER_SIZE - 1)
|
||||||
|
#define UART_TX_BUFFER_MASK ( UART_TX_BUFFER_SIZE - 1)
|
||||||
|
|
||||||
|
#if ( UART_RX_BUFFER_SIZE & UART_RX_BUFFER_MASK )
|
||||||
|
#error RX buffer size is not a power of 2
|
||||||
|
#endif
|
||||||
|
#if ( UART_TX_BUFFER_SIZE & UART_TX_BUFFER_MASK )
|
||||||
|
#error TX buffer size is not a power of 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__AVR_AT90S2313__) \
|
||||||
|
|| defined(__AVR_AT90S4414__) || defined(__AVR_AT90S4434__) \
|
||||||
|
|| defined(__AVR_AT90S8515__) || defined(__AVR_AT90S8535__) \
|
||||||
|
|| defined(__AVR_ATmega103__)
|
||||||
|
/* old AVR classic or ATmega103 with one UART */
|
||||||
|
#define AT90_UART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT UART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT UART_UDRE_vect
|
||||||
|
#define UART0_STATUS USR
|
||||||
|
#define UART0_CONTROL UCR
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_AT90S2333__) || defined(__AVR_AT90S4433__)
|
||||||
|
/* old AVR classic with one UART */
|
||||||
|
#define AT90_UART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT UART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT UART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega8__) || defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) \
|
||||||
|
|| defined(__AVR_ATmega323__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART_RXC_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined (__AVR_ATmega8515__) || defined(__AVR_ATmega8535__)
|
||||||
|
#define ATMEGA_USART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega163__)
|
||||||
|
/* ATmega163 with one UART */
|
||||||
|
#define ATMEGA_UART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT UART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT UART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega162__)
|
||||||
|
/* ATmega with two USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define ATMEGA_USART1
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RXC_vect
|
||||||
|
#define UART1_RECEIVE_INTERRUPT USART1_RXC_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#define UART1_STATUS UCSR1A
|
||||||
|
#define UART1_CONTROL UCSR1B
|
||||||
|
#define UART1_DATA UDR1
|
||||||
|
#define UART1_UDRIE UDRIE1
|
||||||
|
#elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__)
|
||||||
|
/* ATmega with two USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define ATMEGA_USART1
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART1_RECEIVE_INTERRUPT USART1_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#define UART1_STATUS UCSR1A
|
||||||
|
#define UART1_CONTROL UCSR1B
|
||||||
|
#define UART1_DATA UDR1
|
||||||
|
#define UART1_UDRIE UDRIE1
|
||||||
|
#elif defined(__AVR_ATmega161__)
|
||||||
|
/* ATmega with UART */
|
||||||
|
#error "AVR ATmega161 currently not supported by this libaray !"
|
||||||
|
#elif defined(__AVR_ATmega169__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega48__) || defined(__AVR_ATmega88__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega48P__) || defined(__AVR_ATmega88P__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__) \
|
||||||
|
|| defined(__AVR_ATmega3250__) || defined(__AVR_ATmega3290__) ||defined(__AVR_ATmega6450__) || defined(__AVR_ATmega6490__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#elif defined(__AVR_ATtiny2313__)
|
||||||
|
#define ATMEGA_USART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega329__) || \
|
||||||
|
defined(__AVR_ATmega649__) || \
|
||||||
|
defined(__AVR_ATmega325__) || \
|
||||||
|
defined(__AVR_ATmega645__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#elif defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega640__)
|
||||||
|
/* ATmega with two USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define ATMEGA_USART1
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART1_RECEIVE_INTERRUPT USART1_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#define UART1_STATUS UCSR1A
|
||||||
|
#define UART1_CONTROL UCSR1B
|
||||||
|
#define UART1_DATA UDR1
|
||||||
|
#define UART1_UDRIE UDRIE1
|
||||||
|
#elif defined(__AVR_ATmega644__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#elif defined(__AVR_ATmega164P__) || defined(__AVR_ATmega324P__) || defined(__AVR_ATmega644P__)
|
||||||
|
/* ATmega with two USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define ATMEGA_USART1
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART1_RECEIVE_INTERRUPT USART1_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#define UART1_STATUS UCSR1A
|
||||||
|
#define UART1_CONTROL UCSR1B
|
||||||
|
#define UART1_DATA UDR1
|
||||||
|
#define UART1_UDRIE UDRIE1
|
||||||
|
#else
|
||||||
|
#error "no UART definition for MCU available"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* module global variables
|
||||||
|
*/
|
||||||
|
static volatile unsigned char UART_TxBuf[UART_TX_BUFFER_SIZE];
|
||||||
|
static volatile unsigned char UART_RxBuf[UART_RX_BUFFER_SIZE];
|
||||||
|
static volatile unsigned char UART_TxHead;
|
||||||
|
static volatile unsigned char UART_TxTail;
|
||||||
|
static volatile unsigned char UART_RxHead;
|
||||||
|
static volatile unsigned char UART_RxTail;
|
||||||
|
static volatile unsigned char UART_LastRxError;
|
||||||
|
|
||||||
|
#if defined( ATMEGA_USART1 )
|
||||||
|
static volatile unsigned char UART1_TxBuf[UART_TX_BUFFER_SIZE];
|
||||||
|
static volatile unsigned char UART1_RxBuf[UART_RX_BUFFER_SIZE];
|
||||||
|
static volatile unsigned char UART1_TxHead;
|
||||||
|
static volatile unsigned char UART1_TxTail;
|
||||||
|
static volatile unsigned char UART1_RxHead;
|
||||||
|
static volatile unsigned char UART1_RxTail;
|
||||||
|
static volatile unsigned char UART1_LastRxError;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ISR (UART0_RECEIVE_INTERRUPT)
|
||||||
|
/*************************************************************************
|
||||||
|
Function: UART Receive Complete interrupt
|
||||||
|
Purpose: called when the UART has received a character
|
||||||
|
**************************************************************************/
|
||||||
|
{
|
||||||
|
unsigned char tmphead;
|
||||||
|
unsigned char data;
|
||||||
|
unsigned char usr;
|
||||||
|
unsigned char lastRxError;
|
||||||
|
|
||||||
|
|
||||||
|
/* read UART status register and UART data register */
|
||||||
|
usr = UART0_STATUS;
|
||||||
|
data = UART0_DATA;
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#if defined( AT90_UART )
|
||||||
|
lastRxError = (usr & (_BV(FE)|_BV(DOR)) );
|
||||||
|
#elif defined( ATMEGA_USART )
|
||||||
|
lastRxError = (usr & (_BV(FE)|_BV(DOR)) );
|
||||||
|
#elif defined( ATMEGA_USART0 )
|
||||||
|
lastRxError = (usr & (_BV(FE0)|_BV(DOR0)) );
|
||||||
|
#elif defined ( ATMEGA_UART )
|
||||||
|
lastRxError = (usr & (_BV(FE)|_BV(DOR)) );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* calculate buffer index */
|
||||||
|
tmphead = ( UART_RxHead + 1) & UART_RX_BUFFER_MASK;
|
||||||
|
|
||||||
|
if ( tmphead == UART_RxTail ) {
|
||||||
|
/* error: receive buffer overflow */
|
||||||
|
lastRxError = UART_BUFFER_OVERFLOW >> 8;
|
||||||
|
}else{
|
||||||
|
/* store new index */
|
||||||
|
UART_RxHead = tmphead;
|
||||||
|
/* store received data in buffer */
|
||||||
|
UART_RxBuf[tmphead] = data;
|
||||||
|
}
|
||||||
|
UART_LastRxError |= lastRxError;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ISR (UART0_TRANSMIT_INTERRUPT)
|
||||||
|
/*************************************************************************
|
||||||
|
Function: UART Data Register Empty interrupt
|
||||||
|
Purpose: called when the UART is ready to transmit the next byte
|
||||||
|
**************************************************************************/
|
||||||
|
{
|
||||||
|
unsigned char tmptail;
|
||||||
|
|
||||||
|
|
||||||
|
if ( UART_TxHead != UART_TxTail) {
|
||||||
|
/* calculate and store new buffer index */
|
||||||
|
tmptail = (UART_TxTail + 1) & UART_TX_BUFFER_MASK;
|
||||||
|
UART_TxTail = tmptail;
|
||||||
|
/* get one byte from buffer and write it to UART */
|
||||||
|
UART0_DATA = UART_TxBuf[tmptail]; /* start transmission */
|
||||||
|
}else{
|
||||||
|
/* tx buffer empty, disable UDRE interrupt */
|
||||||
|
UART0_CONTROL &= ~_BV(UART0_UDRIE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_init()
|
||||||
|
Purpose: initialize UART and set baudrate
|
||||||
|
Input: baudrate using macro UART_BAUD_SELECT()
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart_init(unsigned int baudrate)
|
||||||
|
{
|
||||||
|
UART_TxHead = 0;
|
||||||
|
UART_TxTail = 0;
|
||||||
|
UART_RxHead = 0;
|
||||||
|
UART_RxTail = 0;
|
||||||
|
|
||||||
|
#if defined( AT90_UART )
|
||||||
|
/* set baud rate */
|
||||||
|
UBRR = (unsigned char)baudrate;
|
||||||
|
|
||||||
|
/* enable UART receiver and transmmitter and receive complete interrupt */
|
||||||
|
UART0_CONTROL = _BV(RXCIE)|_BV(RXEN)|_BV(TXEN);
|
||||||
|
|
||||||
|
#elif defined (ATMEGA_USART)
|
||||||
|
/* Set baud rate */
|
||||||
|
if ( baudrate & 0x8000 )
|
||||||
|
{
|
||||||
|
UART0_STATUS = (1<<U2X); //Enable 2x speed
|
||||||
|
baudrate &= ~0x8000;
|
||||||
|
}
|
||||||
|
UBRRH = (unsigned char)(baudrate>>8);
|
||||||
|
UBRRL = (unsigned char) baudrate;
|
||||||
|
|
||||||
|
/* Enable USART receiver and transmitter and receive complete interrupt */
|
||||||
|
UART0_CONTROL = _BV(RXCIE)|(1<<RXEN)|(1<<TXEN);
|
||||||
|
|
||||||
|
/* Set frame format: asynchronous, 8data, no parity, 1stop bit */
|
||||||
|
#ifdef URSEL
|
||||||
|
UCSRC = (1<<URSEL)|(3<<UCSZ0);
|
||||||
|
#else
|
||||||
|
UCSRC = (3<<UCSZ0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined (ATMEGA_USART0 )
|
||||||
|
/* Set baud rate */
|
||||||
|
if ( baudrate & 0x8000 )
|
||||||
|
{
|
||||||
|
UART0_STATUS = (1<<U2X0); //Enable 2x speed
|
||||||
|
baudrate &= ~0x8000;
|
||||||
|
}
|
||||||
|
UBRR0H = (unsigned char)(baudrate>>8);
|
||||||
|
UBRR0L = (unsigned char) baudrate;
|
||||||
|
|
||||||
|
/* Enable USART receiver and transmitter and receive complete interrupt */
|
||||||
|
UART0_CONTROL = _BV(RXCIE0)|(1<<RXEN0)|(1<<TXEN0);
|
||||||
|
|
||||||
|
/* Set frame format: asynchronous, 8data, no parity, 1stop bit */
|
||||||
|
#ifdef URSEL0
|
||||||
|
UCSR0C = (1<<URSEL0)|(3<<UCSZ00);
|
||||||
|
#else
|
||||||
|
UCSR0C = (3<<UCSZ00);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined ( ATMEGA_UART )
|
||||||
|
/* set baud rate */
|
||||||
|
if ( baudrate & 0x8000 )
|
||||||
|
{
|
||||||
|
UART0_STATUS = (1<<U2X); //Enable 2x speed
|
||||||
|
baudrate &= ~0x8000;
|
||||||
|
}
|
||||||
|
UBRRHI = (unsigned char)(baudrate>>8);
|
||||||
|
UBRR = (unsigned char) baudrate;
|
||||||
|
|
||||||
|
/* Enable UART receiver and transmitter and receive complete interrupt */
|
||||||
|
UART0_CONTROL = _BV(RXCIE)|(1<<RXEN)|(1<<TXEN);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}/* uart_init */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_getc()
|
||||||
|
Purpose: return byte from ringbuffer
|
||||||
|
Returns: lower byte: received byte from ringbuffer
|
||||||
|
higher byte: last receive error
|
||||||
|
**************************************************************************/
|
||||||
|
unsigned int uart_getc(void)
|
||||||
|
{
|
||||||
|
unsigned char tmptail;
|
||||||
|
unsigned char data;
|
||||||
|
|
||||||
|
|
||||||
|
if ( UART_RxHead == UART_RxTail ) {
|
||||||
|
return UART_NO_DATA; /* no data available */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* calculate /store buffer index */
|
||||||
|
tmptail = (UART_RxTail + 1) & UART_RX_BUFFER_MASK;
|
||||||
|
UART_RxTail = tmptail;
|
||||||
|
|
||||||
|
/* get data from receive buffer */
|
||||||
|
data = UART_RxBuf[tmptail];
|
||||||
|
|
||||||
|
data = (UART_LastRxError << 8) + data;
|
||||||
|
UART_LastRxError = 0;
|
||||||
|
return data;
|
||||||
|
|
||||||
|
}/* uart_getc */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_putc()
|
||||||
|
Purpose: write byte to ringbuffer for transmitting via UART
|
||||||
|
Input: byte to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart_putc(unsigned char data)
|
||||||
|
{
|
||||||
|
unsigned char tmphead;
|
||||||
|
|
||||||
|
|
||||||
|
tmphead = (UART_TxHead + 1) & UART_TX_BUFFER_MASK;
|
||||||
|
|
||||||
|
while ( tmphead == UART_TxTail ){
|
||||||
|
;/* wait for free space in buffer */
|
||||||
|
}
|
||||||
|
|
||||||
|
UART_TxBuf[tmphead] = data;
|
||||||
|
UART_TxHead = tmphead;
|
||||||
|
|
||||||
|
/* enable UDRE interrupt */
|
||||||
|
UART0_CONTROL |= _BV(UART0_UDRIE);
|
||||||
|
|
||||||
|
}/* uart_putc */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_puts()
|
||||||
|
Purpose: transmit string to UART
|
||||||
|
Input: string to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart_puts(const char *s )
|
||||||
|
{
|
||||||
|
while (*s)
|
||||||
|
uart_putc(*s++);
|
||||||
|
|
||||||
|
}/* uart_puts */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_puts_p()
|
||||||
|
Purpose: transmit string from program memory to UART
|
||||||
|
Input: program memory string to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart_puts_p(const char *progmem_s )
|
||||||
|
{
|
||||||
|
register char c;
|
||||||
|
|
||||||
|
while ( (c = pgm_read_byte(progmem_s++)) )
|
||||||
|
uart_putc(c);
|
||||||
|
|
||||||
|
}/* uart_puts_p */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* these functions are only for ATmegas with two USART
|
||||||
|
*/
|
||||||
|
#if defined( ATMEGA_USART1 )
|
||||||
|
|
||||||
|
ISR(UART1_RECEIVE_INTERRUPT)
|
||||||
|
/*************************************************************************
|
||||||
|
Function: UART1 Receive Complete interrupt
|
||||||
|
Purpose: called when the UART1 has received a character
|
||||||
|
**************************************************************************/
|
||||||
|
{
|
||||||
|
unsigned char tmphead;
|
||||||
|
unsigned char data;
|
||||||
|
unsigned char usr;
|
||||||
|
unsigned char lastRxError;
|
||||||
|
|
||||||
|
|
||||||
|
/* read UART status register and UART data register */
|
||||||
|
usr = UART1_STATUS;
|
||||||
|
data = UART1_DATA;
|
||||||
|
|
||||||
|
/* */
|
||||||
|
lastRxError = (usr & (_BV(FE1)|_BV(DOR1)) );
|
||||||
|
|
||||||
|
/* calculate buffer index */
|
||||||
|
tmphead = ( UART1_RxHead + 1) & UART_RX_BUFFER_MASK;
|
||||||
|
|
||||||
|
if ( tmphead == UART1_RxTail ) {
|
||||||
|
/* error: receive buffer overflow */
|
||||||
|
lastRxError = UART_BUFFER_OVERFLOW >> 8;
|
||||||
|
}else{
|
||||||
|
/* store new index */
|
||||||
|
UART1_RxHead = tmphead;
|
||||||
|
/* store received data in buffer */
|
||||||
|
UART1_RxBuf[tmphead] = data;
|
||||||
|
}
|
||||||
|
UART1_LastRxError |= lastRxError;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ISR(UART1_TRANSMIT_INTERRUPT)
|
||||||
|
/*************************************************************************
|
||||||
|
Function: UART1 Data Register Empty interrupt
|
||||||
|
Purpose: called when the UART1 is ready to transmit the next byte
|
||||||
|
**************************************************************************/
|
||||||
|
{
|
||||||
|
unsigned char tmptail;
|
||||||
|
|
||||||
|
|
||||||
|
if ( UART1_TxHead != UART1_TxTail) {
|
||||||
|
/* calculate and store new buffer index */
|
||||||
|
tmptail = (UART1_TxTail + 1) & UART_TX_BUFFER_MASK;
|
||||||
|
UART1_TxTail = tmptail;
|
||||||
|
/* get one byte from buffer and write it to UART */
|
||||||
|
UART1_DATA = UART1_TxBuf[tmptail]; /* start transmission */
|
||||||
|
}else{
|
||||||
|
/* tx buffer empty, disable UDRE interrupt */
|
||||||
|
UART1_CONTROL &= ~_BV(UART1_UDRIE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart1_init()
|
||||||
|
Purpose: initialize UART1 and set baudrate
|
||||||
|
Input: baudrate using macro UART_BAUD_SELECT()
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart1_init(unsigned int baudrate)
|
||||||
|
{
|
||||||
|
UART1_TxHead = 0;
|
||||||
|
UART1_TxTail = 0;
|
||||||
|
UART1_RxHead = 0;
|
||||||
|
UART1_RxTail = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/* Set baud rate */
|
||||||
|
if ( baudrate & 0x8000 )
|
||||||
|
{
|
||||||
|
UART1_STATUS = (1<<U2X1); //Enable 2x speed
|
||||||
|
baudrate &= ~0x8000;
|
||||||
|
}
|
||||||
|
UBRR1H = (unsigned char)(baudrate>>8);
|
||||||
|
UBRR1L = (unsigned char) baudrate;
|
||||||
|
|
||||||
|
/* Enable USART receiver and transmitter and receive complete interrupt */
|
||||||
|
UART1_CONTROL = _BV(RXCIE1)|(1<<RXEN1)|(1<<TXEN1);
|
||||||
|
|
||||||
|
/* Set frame format: asynchronous, 8data, no parity, 1stop bit */
|
||||||
|
#ifdef URSEL1
|
||||||
|
UCSR1C = (1<<URSEL1)|(3<<UCSZ10);
|
||||||
|
#else
|
||||||
|
UCSR1C = (3<<UCSZ10);
|
||||||
|
#endif
|
||||||
|
}/* uart_init */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart1_getc()
|
||||||
|
Purpose: return byte from ringbuffer
|
||||||
|
Returns: lower byte: received byte from ringbuffer
|
||||||
|
higher byte: last receive error
|
||||||
|
**************************************************************************/
|
||||||
|
unsigned int uart1_getc(void)
|
||||||
|
{
|
||||||
|
unsigned char tmptail;
|
||||||
|
unsigned char data;
|
||||||
|
|
||||||
|
|
||||||
|
if ( UART1_RxHead == UART1_RxTail ) {
|
||||||
|
return UART_NO_DATA; /* no data available */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* calculate /store buffer index */
|
||||||
|
tmptail = (UART1_RxTail + 1) & UART_RX_BUFFER_MASK;
|
||||||
|
UART1_RxTail = tmptail;
|
||||||
|
|
||||||
|
/* get data from receive buffer */
|
||||||
|
data = UART1_RxBuf[tmptail];
|
||||||
|
|
||||||
|
data = (UART1_LastRxError << 8) + data;
|
||||||
|
UART1_LastRxError = 0;
|
||||||
|
return data;
|
||||||
|
|
||||||
|
}/* uart1_getc */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart1_putc()
|
||||||
|
Purpose: write byte to ringbuffer for transmitting via UART
|
||||||
|
Input: byte to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart1_putc(unsigned char data)
|
||||||
|
{
|
||||||
|
unsigned char tmphead;
|
||||||
|
|
||||||
|
|
||||||
|
tmphead = (UART1_TxHead + 1) & UART_TX_BUFFER_MASK;
|
||||||
|
|
||||||
|
while ( tmphead == UART1_TxTail ){
|
||||||
|
;/* wait for free space in buffer */
|
||||||
|
}
|
||||||
|
|
||||||
|
UART1_TxBuf[tmphead] = data;
|
||||||
|
UART1_TxHead = tmphead;
|
||||||
|
|
||||||
|
/* enable UDRE interrupt */
|
||||||
|
UART1_CONTROL |= _BV(UART1_UDRIE);
|
||||||
|
|
||||||
|
}/* uart1_putc */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart1_puts()
|
||||||
|
Purpose: transmit string to UART1
|
||||||
|
Input: string to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart1_puts(const char *s )
|
||||||
|
{
|
||||||
|
while (*s)
|
||||||
|
uart1_putc(*s++);
|
||||||
|
|
||||||
|
}/* uart1_puts */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart1_puts_p()
|
||||||
|
Purpose: transmit string from program memory to UART1
|
||||||
|
Input: program memory string to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart1_puts_p(const char *progmem_s )
|
||||||
|
{
|
||||||
|
register char c;
|
||||||
|
|
||||||
|
while ( (c = pgm_read_byte(progmem_s++)) )
|
||||||
|
uart1_putc(c);
|
||||||
|
|
||||||
|
}/* uart1_puts_p */
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,180 @@
|
||||||
|
#ifndef UART_H
|
||||||
|
#define UART_H
|
||||||
|
/************************************************************************
|
||||||
|
Title: Interrupt UART library with receive/transmit circular buffers
|
||||||
|
Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
|
||||||
|
File: $Id: uart.h,v 1.12 2012/11/19 19:52:27 peter Exp $
|
||||||
|
Software: AVR-GCC 4.1, AVR Libc 1.4
|
||||||
|
Hardware: any AVR with built-in UART, tested on AT90S8515 & ATmega8 at 4 Mhz
|
||||||
|
License: GNU General Public License
|
||||||
|
Usage: see Doxygen manual
|
||||||
|
|
||||||
|
LICENSE:
|
||||||
|
Copyright (C) 2006 Peter Fleury
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup pfleury_uart UART Library
|
||||||
|
* @code #include <uart.h> @endcode
|
||||||
|
*
|
||||||
|
* @brief Interrupt UART library using the built-in UART with transmit and receive circular buffers.
|
||||||
|
*
|
||||||
|
* This library can be used to transmit and receive data through the built in UART.
|
||||||
|
*
|
||||||
|
* An interrupt is generated when the UART has finished transmitting or
|
||||||
|
* receiving a byte. The interrupt handling routines use circular buffers
|
||||||
|
* for buffering received and transmitted data.
|
||||||
|
*
|
||||||
|
* The UART_RX_BUFFER_SIZE and UART_TX_BUFFER_SIZE constants define
|
||||||
|
* the size of the circular buffers in bytes. Note that these constants must be a power of 2.
|
||||||
|
* You may need to adapt this constants to your target and your application by adding
|
||||||
|
* CDEFS += -DUART_RX_BUFFER_SIZE=nn -DUART_RX_BUFFER_SIZE=nn to your Makefile.
|
||||||
|
*
|
||||||
|
* @note Based on Atmel Application Note AVR306
|
||||||
|
* @author Peter Fleury pfleury@gmx.ch http://jump.to/fleury
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**@{*/
|
||||||
|
|
||||||
|
|
||||||
|
#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304
|
||||||
|
#error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** constants and macros
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @brief UART Baudrate Expression
|
||||||
|
* @param xtalcpu system clock in Mhz, e.g. 4000000UL for 4Mhz
|
||||||
|
* @param baudrate baudrate in bps, e.g. 1200, 2400, 9600
|
||||||
|
*/
|
||||||
|
#define UART_BAUD_SELECT(baudRate,xtalCpu) (((xtalCpu) + 8UL * (baudRate)) / (16UL * (baudRate)) -1UL)
|
||||||
|
|
||||||
|
/** @brief UART Baudrate Expression for ATmega double speed mode
|
||||||
|
* @param xtalcpu system clock in Mhz, e.g. 4000000UL for 4Mhz
|
||||||
|
* @param baudrate baudrate in bps, e.g. 1200, 2400, 9600
|
||||||
|
*/
|
||||||
|
#define UART_BAUD_SELECT_DOUBLE_SPEED(baudRate,xtalCpu) ( ((((xtalCpu) + 4UL * (baudRate)) / (8UL * (baudRate)) -1UL)) | 0x8000)
|
||||||
|
|
||||||
|
|
||||||
|
/** Size of the circular receive buffer, must be power of 2 */
|
||||||
|
#ifndef UART_RX_BUFFER_SIZE
|
||||||
|
#define UART_RX_BUFFER_SIZE 32
|
||||||
|
#endif
|
||||||
|
/** Size of the circular transmit buffer, must be power of 2 */
|
||||||
|
#ifndef UART_TX_BUFFER_SIZE
|
||||||
|
#define UART_TX_BUFFER_SIZE 32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* test if the size of the circular buffers fits into SRAM */
|
||||||
|
#if ( (UART_RX_BUFFER_SIZE+UART_TX_BUFFER_SIZE) >= (RAMEND-0x60 ) )
|
||||||
|
#error "size of UART_RX_BUFFER_SIZE + UART_TX_BUFFER_SIZE larger than size of SRAM"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** high byte error return code of uart_getc()
|
||||||
|
*/
|
||||||
|
#define UART_FRAME_ERROR 0x1000 /* Framing Error by UART */
|
||||||
|
#define UART_OVERRUN_ERROR 0x0800 /* Overrun condition by UART */
|
||||||
|
#define UART_PARITY_ERROR 0x0400 /* Parity Error by UART */
|
||||||
|
#define UART_BUFFER_OVERFLOW 0x0200 /* receive ringbuffer overflow */
|
||||||
|
#define UART_NO_DATA 0x0100 /* no receive data available */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** function prototypes
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Initialize UART and set baudrate
|
||||||
|
@param baudrate Specify baudrate using macro UART_BAUD_SELECT()
|
||||||
|
@return none
|
||||||
|
*/
|
||||||
|
extern void uart_init(unsigned int baudrate);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get received byte from ringbuffer
|
||||||
|
*
|
||||||
|
* Returns in the lower byte the received character and in the
|
||||||
|
* higher byte the last receive error.
|
||||||
|
* UART_NO_DATA is returned when no data is available.
|
||||||
|
*
|
||||||
|
* @param void
|
||||||
|
* @return lower byte: received byte from ringbuffer
|
||||||
|
* @return higher byte: last receive status
|
||||||
|
* - \b 0 successfully received data from UART
|
||||||
|
* - \b UART_NO_DATA
|
||||||
|
* <br>no receive data available
|
||||||
|
* - \b UART_BUFFER_OVERFLOW
|
||||||
|
* <br>Receive ringbuffer overflow.
|
||||||
|
* We are not reading the receive buffer fast enough,
|
||||||
|
* one or more received character have been dropped
|
||||||
|
* - \b UART_OVERRUN_ERROR
|
||||||
|
* <br>Overrun condition by UART.
|
||||||
|
* A character already present in the UART UDR register was
|
||||||
|
* not read by the interrupt handler before the next character arrived,
|
||||||
|
* one or more received characters have been dropped.
|
||||||
|
* - \b UART_FRAME_ERROR
|
||||||
|
* <br>Framing Error by UART
|
||||||
|
*/
|
||||||
|
extern unsigned int uart_getc(void);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Put byte to ringbuffer for transmitting via UART
|
||||||
|
* @param data byte to be transmitted
|
||||||
|
* @return none
|
||||||
|
*/
|
||||||
|
extern void uart_putc(unsigned char data);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Put string to ringbuffer for transmitting via UART
|
||||||
|
*
|
||||||
|
* The string is buffered by the uart library in a circular buffer
|
||||||
|
* and one character at a time is transmitted to the UART using interrupts.
|
||||||
|
* Blocks if it can not write the whole string into the circular buffer.
|
||||||
|
*
|
||||||
|
* @param s string to be transmitted
|
||||||
|
* @return none
|
||||||
|
*/
|
||||||
|
extern void uart_puts(const char *s );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Put string from program memory to ringbuffer for transmitting via UART.
|
||||||
|
*
|
||||||
|
* The string is buffered by the uart library in a circular buffer
|
||||||
|
* and one character at a time is transmitted to the UART using interrupts.
|
||||||
|
* Blocks if it can not write the whole string into the circular buffer.
|
||||||
|
*
|
||||||
|
* @param s program memory string to be transmitted
|
||||||
|
* @return none
|
||||||
|
* @see uart_puts_P
|
||||||
|
*/
|
||||||
|
extern void uart_puts_p(const char *s );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Macro to automatically put a string constant into program memory
|
||||||
|
*/
|
||||||
|
#define uart_puts_P(__s) uart_puts_p(PSTR(__s))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // UART_H
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include "uart.h"
|
||||||
|
|
||||||
|
void wait(uint8_t count) {
|
||||||
|
uint8_t i;
|
||||||
|
if(count == 0) count = 100;
|
||||||
|
for(i=0;i<count;i++) {
|
||||||
|
_delay_ms(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_print_voltage(uint16_t x) {
|
||||||
|
uart_putc(48 + (x / 10000));
|
||||||
|
uart_putc(48 + (x % 10000 /1000));
|
||||||
|
uart_putc('.');
|
||||||
|
uart_putc(48 + (x % 1000 / 100 ));
|
||||||
|
//uart_putc(48 + (x % 100 / 10 ));
|
||||||
|
//uart_putc(48 + (x % 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_print_uint8(uint8_t x) {
|
||||||
|
uart_putc(48 + (x / 100 ));
|
||||||
|
uart_putc(48 + (x % 100 / 10 ));
|
||||||
|
uart_putc(48 + (x % 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_print_uint16(uint16_t x) {
|
||||||
|
uart_putc(48 + (x / 10000));
|
||||||
|
uart_putc(48 + (x % 10000 /1000));
|
||||||
|
uart_putc(48 + (x % 1000 / 100 ));
|
||||||
|
uart_putc(48 + (x % 100 / 10 ));
|
||||||
|
uart_putc(48 + (x % 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef _utils_h
|
||||||
|
#define _utils_h
|
||||||
|
|
||||||
|
extern void wait(uint8_t count);
|
||||||
|
extern void uart_print_voltage(uint16_t);
|
||||||
|
extern void uart_print_uint8_t(uint8_t);
|
||||||
|
extern void uart_print_uint16(uint16_t);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
src/adc.o: src/adc.c /usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/io.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/sfr_defs.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/inttypes.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/include/stdint.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/stdint.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/iom8.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/portpins.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/common.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/version.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/fuse.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/lock.h
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/io.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/sfr_defs.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/inttypes.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/include/stdint.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/stdint.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/iom8.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/portpins.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/common.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/version.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/fuse.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/lock.h:
|
|
@ -0,0 +1,52 @@
|
||||||
|
src/main.o: src/main.c \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/io.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/sfr_defs.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/inttypes.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/include/stdint.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/stdint.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/iom8.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/portpins.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/common.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/version.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/fuse.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/lock.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/interrupt.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/pgmspace.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/include/stddef.h src/utils.h src/main.h src/adc.h \
|
||||||
|
src/uart.h
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/io.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/sfr_defs.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/inttypes.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/include/stdint.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/stdint.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/iom8.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/portpins.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/common.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/version.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/fuse.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/lock.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/interrupt.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/pgmspace.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/include/stddef.h:
|
||||||
|
|
||||||
|
src/utils.h:
|
||||||
|
|
||||||
|
src/main.h:
|
||||||
|
|
||||||
|
src/adc.h:
|
||||||
|
|
||||||
|
src/uart.h:
|
|
@ -0,0 +1,45 @@
|
||||||
|
src/uart.o: src/uart.c \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/io.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/sfr_defs.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/inttypes.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/include/stdint.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/stdint.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/iom8.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/portpins.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/common.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/version.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/fuse.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/lock.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/interrupt.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/pgmspace.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/include/stddef.h src/uart.h
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/io.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/sfr_defs.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/inttypes.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/include/stdint.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/stdint.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/iom8.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/portpins.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/common.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/version.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/fuse.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/lock.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/interrupt.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/pgmspace.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/include/stddef.h:
|
||||||
|
|
||||||
|
src/uart.h:
|
|
@ -0,0 +1,45 @@
|
||||||
|
src/utils.o: src/utils.c \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/io.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/sfr_defs.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/inttypes.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/include/stdint.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/stdint.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/iom8.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/portpins.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/common.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/version.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/fuse.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/lock.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/util/delay.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/util/delay_basic.h \
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/math.h src/uart.h
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/io.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/sfr_defs.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/inttypes.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/include/stdint.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/stdint.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/iom8.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/portpins.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/common.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/version.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/fuse.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/lock.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/util/delay.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/util/delay_basic.h:
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/include/math.h:
|
||||||
|
|
||||||
|
src/uart.h:
|
|
@ -0,0 +1,276 @@
|
||||||
|
# On command line:
|
||||||
|
#
|
||||||
|
# make all = Make software.
|
||||||
|
#
|
||||||
|
# make clean = Clean out built project files.
|
||||||
|
#
|
||||||
|
# make program = Download the hex file to the device, using avrdude. Please
|
||||||
|
# customize the avrdude settings below first!
|
||||||
|
#
|
||||||
|
# To rebuild project do "make clean" then "make all".
|
||||||
|
#
|
||||||
|
|
||||||
|
MCU = atmega8
|
||||||
|
F_CPU = 8000000
|
||||||
|
|
||||||
|
# Output format. (can be srec, ihex, binary)
|
||||||
|
FORMAT = ihex
|
||||||
|
|
||||||
|
# Target file name (without extension).
|
||||||
|
TARGET = main
|
||||||
|
|
||||||
|
SRC = src/$(TARGET).c src/adc.c src/utils.c src/uart.c
|
||||||
|
|
||||||
|
|
||||||
|
# Optimization level, can be [0, 1, 2, 3, s].
|
||||||
|
# 0 = turn off optimization. s = optimize for size.
|
||||||
|
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
||||||
|
OPT = s
|
||||||
|
|
||||||
|
|
||||||
|
# List any extra directories to look for include files here.
|
||||||
|
# Each directory must be seperated by a space.
|
||||||
|
EXTRAINCDIRS = src/
|
||||||
|
|
||||||
|
|
||||||
|
# Compiler flag to set the C Standard level.
|
||||||
|
# c89 - "ANSI" C
|
||||||
|
# gnu89 - c89 plus GCC extensions
|
||||||
|
# c99 - ISO C99 standard (not yet fully implemented)
|
||||||
|
# gnu99 - c99 plus GCC extensions
|
||||||
|
CSTANDARD = -std=gnu99
|
||||||
|
|
||||||
|
# Place -D or -U options here
|
||||||
|
CDEFS =
|
||||||
|
|
||||||
|
# Place -I options here
|
||||||
|
CINCS =
|
||||||
|
|
||||||
|
|
||||||
|
# Compiler flags.
|
||||||
|
# -O*: optimization level
|
||||||
|
# -f...: tuning, see GCC manual and avr-libc documentation
|
||||||
|
# -Wall...: warning level
|
||||||
|
# -Wa,...: tell GCC to pass this to the assembler.
|
||||||
|
# -adhlns...: create assembler listing
|
||||||
|
CFLAGS += $(CDEFS) $(CINCS)
|
||||||
|
CFLAGS += -O$(OPT)
|
||||||
|
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
|
||||||
|
CFLAGS += -Wall -Wstrict-prototypes
|
||||||
|
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
|
||||||
|
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||||
|
CFLAGS += $(CSTANDARD)
|
||||||
|
CFLAGS += -DF_CPU=$(F_CPU) #-DDEBUG
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# External memory options
|
||||||
|
|
||||||
|
|
||||||
|
# Linker flags.
|
||||||
|
# -Wl,...: tell GCC to pass this to linker.
|
||||||
|
# -Map: create map file
|
||||||
|
# --cref: add cross reference to map file
|
||||||
|
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
||||||
|
|
||||||
|
|
||||||
|
# Programming support using avrdude. Settings and variables.
|
||||||
|
AVRDUDE_PROGRAMMER = usbasp
|
||||||
|
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
|
||||||
|
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
|
||||||
|
|
||||||
|
AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Define programs and commands.
|
||||||
|
SHELL = sh
|
||||||
|
CC = avr-gcc
|
||||||
|
OBJCOPY = avr-objcopy
|
||||||
|
OBJDUMP = avr-objdump
|
||||||
|
SIZE = avr-size
|
||||||
|
NM = avr-nm
|
||||||
|
AVRDUDE = avrdude
|
||||||
|
REMOVE = rm -f
|
||||||
|
COPY = cp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Define Messages
|
||||||
|
# English
|
||||||
|
MSG_ERRORS_NONE = Errors: none
|
||||||
|
MSG_BEGIN = -------- begin --------
|
||||||
|
MSG_END = -------- end --------
|
||||||
|
MSG_SIZE_BEFORE = Size before:
|
||||||
|
MSG_SIZE_AFTER = Size after:
|
||||||
|
MSG_COFF = Converting to AVR COFF:
|
||||||
|
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
|
||||||
|
MSG_FLASH = Creating load file for Flash:
|
||||||
|
MSG_EEPROM = Creating load file for EEPROM:
|
||||||
|
MSG_EXTENDED_LISTING = Creating Extended Listing:
|
||||||
|
MSG_SYMBOL_TABLE = Creating Symbol Table:
|
||||||
|
MSG_LINKING = Linking:
|
||||||
|
MSG_COMPILING = Compiling:
|
||||||
|
MSG_ASSEMBLING = Assembling:
|
||||||
|
MSG_CLEANING = Cleaning project:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Define all object files.
|
||||||
|
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
|
||||||
|
|
||||||
|
# Define all listing files.
|
||||||
|
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst)
|
||||||
|
|
||||||
|
|
||||||
|
# Compiler flags to generate dependency files.
|
||||||
|
### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
|
||||||
|
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
|
||||||
|
|
||||||
|
# Combine all necessary flags and optional flags.
|
||||||
|
# Add target processor to flags.
|
||||||
|
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
# Default target.
|
||||||
|
all: begin gccversion sizebefore build sizeafter finished end
|
||||||
|
|
||||||
|
build: elf hex eep lss sym
|
||||||
|
|
||||||
|
elf: $(TARGET).elf
|
||||||
|
hex: $(TARGET).hex
|
||||||
|
eep: $(TARGET).eep
|
||||||
|
lss: $(TARGET).lss
|
||||||
|
sym: $(TARGET).sym
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Eye candy.
|
||||||
|
# AVR Studio 3.x does not check make's exit code but relies on
|
||||||
|
# the following magic strings to be generated by the compile job.
|
||||||
|
begin:
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_BEGIN)
|
||||||
|
|
||||||
|
finished:
|
||||||
|
@echo $(MSG_ERRORS_NONE)
|
||||||
|
|
||||||
|
end:
|
||||||
|
@echo $(MSG_END)
|
||||||
|
@echo
|
||||||
|
|
||||||
|
|
||||||
|
# Display size of file.
|
||||||
|
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
|
||||||
|
ELFSIZE = $(SIZE) -A $(TARGET).elf
|
||||||
|
sizebefore:
|
||||||
|
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
|
||||||
|
|
||||||
|
sizeafter:
|
||||||
|
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Display compiler version information.
|
||||||
|
gccversion :
|
||||||
|
@$(CC) --version
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Program the device.
|
||||||
|
program: $(TARGET).hex $(TARGET).eep
|
||||||
|
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
|
||||||
|
|
||||||
|
|
||||||
|
# Create final output files (.hex, .eep) from ELF output file.
|
||||||
|
%.hex: %.elf
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_FLASH) $@
|
||||||
|
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
|
||||||
|
|
||||||
|
%.eep: %.elf
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_EEPROM) $@
|
||||||
|
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
||||||
|
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
|
||||||
|
|
||||||
|
# Create extended listing file from ELF output file.
|
||||||
|
%.lss: %.elf
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_EXTENDED_LISTING) $@
|
||||||
|
$(OBJDUMP) -h -S $< > $@
|
||||||
|
|
||||||
|
# Create a symbol table from ELF output file.
|
||||||
|
%.sym: %.elf
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_SYMBOL_TABLE) $@
|
||||||
|
$(NM) -n $< > $@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Link: create ELF output file from object files.
|
||||||
|
.SECONDARY : $(TARGET).elf
|
||||||
|
.PRECIOUS : $(OBJ)
|
||||||
|
%.elf: $(OBJ)
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_LINKING) $@
|
||||||
|
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
# Compile: create object files from C source files.
|
||||||
|
%.o : %.c
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_COMPILING) $<
|
||||||
|
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
|
# Compile: create assembler files from C source files.
|
||||||
|
%.s : %.c
|
||||||
|
$(CC) -S $(ALL_CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
|
# Assemble: create object files from assembler source files.
|
||||||
|
%.o : %.S
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_ASSEMBLING) $<
|
||||||
|
$(CC) -c $(ALL_ASFLAGS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Target: clean project.
|
||||||
|
clean: begin clean_list finished end
|
||||||
|
|
||||||
|
clean_list :
|
||||||
|
@echo
|
||||||
|
@echo $(MSG_CLEANING)
|
||||||
|
$(REMOVE) $(TARGET).hex
|
||||||
|
$(REMOVE) $(TARGET).eep
|
||||||
|
$(REMOVE) $(TARGET).obj
|
||||||
|
$(REMOVE) $(TARGET).cof
|
||||||
|
$(REMOVE) $(TARGET).elf
|
||||||
|
$(REMOVE) $(TARGET).map
|
||||||
|
$(REMOVE) $(TARGET).obj
|
||||||
|
$(REMOVE) $(TARGET).a90
|
||||||
|
$(REMOVE) $(TARGET).sym
|
||||||
|
$(REMOVE) $(TARGET).lnk
|
||||||
|
$(REMOVE) $(TARGET).lss
|
||||||
|
$(REMOVE) $(OBJ)
|
||||||
|
$(REMOVE) $(LST)
|
||||||
|
$(REMOVE) $(SRC:.c=.s)
|
||||||
|
$(REMOVE) $(SRC:.c=.d)
|
||||||
|
$(REMOVE) .dep/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Include the dependency files.
|
||||||
|
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
|
||||||
|
|
||||||
|
|
||||||
|
# Listing of phony targets.
|
||||||
|
.PHONY : all begin finish end sizebefore sizeafter gccversion \
|
||||||
|
build elf hex eep lss sym coff extcoff \
|
||||||
|
clean clean_list program
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
:00000001FF
|
Binary file not shown.
|
@ -0,0 +1,117 @@
|
||||||
|
:1000000044C053C052C051C050C04FC041C14DC088
|
||||||
|
:100010004CC04BC04AC03BC266C247C046C045C088
|
||||||
|
:1000200044C043C042C04261747465727920566F07
|
||||||
|
:100030006C746167653A202020006D560D0A0047F8
|
||||||
|
:10004000656E657261746F7220566F6C746167655E
|
||||||
|
:100050003A202020006D560D0A0047656E657261DA
|
||||||
|
:10006000746F723A20006D41202000570D0A007312
|
||||||
|
:100070007769746368657320286C6F61642C2067EE
|
||||||
|
:10008000656E293A20000D0A000011241FBECFE53D
|
||||||
|
:10009000D4E0DEBFCDBF10E0A0E6B0E001C01D920D
|
||||||
|
:1000A000A53BB107E1F79BD246C3AACFCF9364E04B
|
||||||
|
:1000B00082E044D1CFE09C01C29FC001C39F900D5C
|
||||||
|
:1000C00011248A5E9C4F90936B0080936A0064E0D9
|
||||||
|
:1000D00080E034D19C01C29FC001C39F900D1124C8
|
||||||
|
:1000E000909369008093680064E081E027D18F5F7E
|
||||||
|
:1000F000914097FD05C090936F0080936E0004C0FF
|
||||||
|
:1001000010926F0010926E0020916E0030916F007F
|
||||||
|
:1001100048E4429FC001439F900D112490936700D3
|
||||||
|
:1001200080936600CF910895CF93DF93EC01CB01CC
|
||||||
|
:1001300024E630E0B901ECD2FB01CE01B901D4D202
|
||||||
|
:10014000E69FC001E79F900DF69F900D1124B90125
|
||||||
|
:10015000CBD2CB01DF91CF91089586E290E032D2ED
|
||||||
|
:1001600080916A0090916B005DD18AE390E02AD281
|
||||||
|
:100170008FE390E027D2809168009091690052D17E
|
||||||
|
:1001800085E590E01FD28AE590E01CD28091660060
|
||||||
|
:100190009091670047D186E690E014D28091660086
|
||||||
|
:1001A0009091670024E630E0B901B2D2FB01809162
|
||||||
|
:1001B0006A0090916B00B90197D2E69FC001E79F5A
|
||||||
|
:1001C000900DF69F900D1124B9018ED2CB012AD14A
|
||||||
|
:1001D0008BE690E0F7D18FE690E0F4D186B38170A2
|
||||||
|
:1001E000805DD4D18CE2D2D186B386958170805D5A
|
||||||
|
:1001F000CDD186E890E0E6C180916A0090916B00D5
|
||||||
|
:10020000803C9B4250F410926200809163008530E4
|
||||||
|
:1002100068F48F5F8093630009C01092630080913F
|
||||||
|
:100220006200833018F48F5F8093620080916800D1
|
||||||
|
:1002300090916900893C924350F010926000809147
|
||||||
|
:100240006100833068F48F5F8093610009C0109271
|
||||||
|
:10025000610080916000811103C081E080936000A3
|
||||||
|
:1002600080916300853018F0109262000FC0809179
|
||||||
|
:100270006200833060F010926300809161008330EF
|
||||||
|
:1002800010F0C09A0895809160008111C09808957F
|
||||||
|
:100290001F920F920FB60F9211242F933F934F93FB
|
||||||
|
:1002A0005F936F937F938F939F9380916C00909156
|
||||||
|
:1002B0006D00019690936D0080936C0020916C000E
|
||||||
|
:1002C00030916D0081E090E020364AEE340710F462
|
||||||
|
:1002D00080E090E060E67AEE869FA001879F500D57
|
||||||
|
:1002E000969F500D1124C901841B950B90936D00AE
|
||||||
|
:1002F00080936C009F918F917F916F915F914F914F
|
||||||
|
:100300003F912F910F900FBE0F901F90189580E492
|
||||||
|
:1003100087B983E086B9379A369A3699FECF84B189
|
||||||
|
:1003200095B1089597B18F71907E892B87B9369AD0
|
||||||
|
:100330003699FECF24B135B1C9010895FF920F93CC
|
||||||
|
:100340001F93CF93DF93082F862F6CE3C1D1F92E33
|
||||||
|
:1003500010E0C0E0D0E005C0802FE4DFC80FD91F57
|
||||||
|
:100360001F5F1F11F9CF612FCE0170E0BDD1CB010E
|
||||||
|
:10037000DF91CF911F910F91FF900895811101C0DE
|
||||||
|
:1003800084E690E0EFE1FEE43197F1F700C0000071
|
||||||
|
:100390009F5F9813F7CF0895EF92FF920F931F93EB
|
||||||
|
:1003A000CF93DF938C0160E177E29ED17C01862FB1
|
||||||
|
:1003B000805DECD0C8EED3E0C701BE0195D1862F99
|
||||||
|
:1003C000805DE4D08EE2E2D0C801BE018DD164E64A
|
||||||
|
:1003D00070E08AD1862F805DDF91CF911F910F91C0
|
||||||
|
:1003E000FF90EF90D3C00F931F93CF93DF931F9293
|
||||||
|
:1003F000CDB7DEB7082F64E66BD1805D9983C6D098
|
||||||
|
:100400001AE09981892F612F63D1805DBFD0802F41
|
||||||
|
:10041000612F5ED1892F805D0F90DF91CF911F9169
|
||||||
|
:100420000F91B4C0EF92FF920F931F93CF93DF937E
|
||||||
|
:10043000EC0160E177E258D17C01862F805DA6D087
|
||||||
|
:1004400008EE13E0C701B8014FD1862F805D9ED022
|
||||||
|
:10045000CE01B80149D104E610E0B80145D1862F9C
|
||||||
|
:10046000805D94D0CE01B8013FD10AE010E0B80120
|
||||||
|
:100470003BD1862F805D8AD0CE01B80135D1805D19
|
||||||
|
:10048000DF91CF911F910F91FF90EF907FC01F924E
|
||||||
|
:100490000F920FB60F9211242F938F939F93EF9388
|
||||||
|
:1004A000FF938BB19CB18871E0917200EF5FEF71A7
|
||||||
|
:1004B00020917100E21739F0E0937200F0E0EB5800
|
||||||
|
:1004C000FF4F908301C082E090917000982B909331
|
||||||
|
:1004D0007000FF91EF919F918F912F910F900FBE20
|
||||||
|
:1004E0000F901F9018951F920F920FB60F92112424
|
||||||
|
:1004F0008F939F93EF93FF9390917400809173007B
|
||||||
|
:10050000981761F0E0917300EF5FEF71E093730073
|
||||||
|
:10051000F0E0EB56FF4F80818CB901C05598FF91F8
|
||||||
|
:10052000EF919F918F910F900FBE0F901F90189594
|
||||||
|
:100530001092740010927300109272001092710069
|
||||||
|
:1005400097FF03C022E02BB99F7790BD89B988E956
|
||||||
|
:100550008AB986E880BD08959091720080917100FB
|
||||||
|
:10056000981781F0E0917100EF5FEF71E0937100F7
|
||||||
|
:10057000F0E0EB58FF4F20818091700010927000E6
|
||||||
|
:1005800030E002C020E031E0C9010895909174008C
|
||||||
|
:100590009F5F9F71209173009217E1F3E92FF0E0C4
|
||||||
|
:1005A000EB56FF4F808390937400559A0895CF9334
|
||||||
|
:1005B000DF93EC0101C0EADF89918111FCCFDF916B
|
||||||
|
:1005C000CF910895CF93DF93EC0101C0DFDFFE01EF
|
||||||
|
:1005D000219684918111FACFDF91CF91089587B34D
|
||||||
|
:1005E000836087BB88B38C7F88BB91DE8EB58B60C0
|
||||||
|
:1005F0008EBD82EE94E09BBD8ABD80E189BF789478
|
||||||
|
:1006000089E190E095DFC098C19AC4E6D0E080917E
|
||||||
|
:100610006C0090916D008436910530F010926D0061
|
||||||
|
:1006200010926C0043DDE8DD97DF811521E0920731
|
||||||
|
:1006300071F399278136910529F08037910539F7B3
|
||||||
|
:100640008CDDE5CF81E4A2DF80916A0090916B00A0
|
||||||
|
:10065000E9DE8CE29BDF8091660090916700E2DE2C
|
||||||
|
:100660008CE294DF80E090E0DDDE8CE28FDF809131
|
||||||
|
:10067000660090916700BE014BD09B0180916A009B
|
||||||
|
:1006800090916B00BE0130D0269FC001279F900D36
|
||||||
|
:10069000369F900D1124BE0127D0CB01C3DE8CE222
|
||||||
|
:1006A00075DF80E090E0BEDE8CE270DF86B38170A3
|
||||||
|
:1006B000805D6CDF8CE26ADF80E368DF8CE266DFFE
|
||||||
|
:1006C00086B386958170805D61DF82E45FDF9FCFB6
|
||||||
|
:1006D000991B79E004C0991F961708F0961B881F94
|
||||||
|
:1006E0007A95C9F780950895AA1BBB1B51E107C0F5
|
||||||
|
:1006F000AA1FBB1FA617B70710F0A61BB70B881FB2
|
||||||
|
:10070000991F5A95A9F780959095BC01CD01089540
|
||||||
|
:1007100097FB072E16F4009406D077FD08D0E4DF8F
|
||||||
|
:1007200007FC05D03EF4909581959F4F08957095F4
|
||||||
|
:0A07300061957F4F0895F894FFCF04
|
||||||
|
:00000001FF
|
|
@ -0,0 +1,913 @@
|
||||||
|
|
||||||
|
main.elf: file format elf32-avr
|
||||||
|
|
||||||
|
Sections:
|
||||||
|
Idx Name Size VMA LMA File off Algn
|
||||||
|
0 .text 0000073c 00000000 00000000 00000074 2**1
|
||||||
|
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||||
|
1 .bss 00000055 00800060 00800060 000007b0 2**0
|
||||||
|
ALLOC
|
||||||
|
2 .stab 000006cc 00000000 00000000 000007b0 2**2
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
3 .stabstr 00000054 00000000 00000000 00000e7c 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
4 .comment 00000011 00000000 00000000 00000ed0 2**0
|
||||||
|
CONTENTS, READONLY
|
||||||
|
|
||||||
|
Disassembly of section .text:
|
||||||
|
|
||||||
|
00000000 <__vectors>:
|
||||||
|
0: 44 c0 rjmp .+136 ; 0x8a <__ctors_end>
|
||||||
|
2: 53 c0 rjmp .+166 ; 0xaa <__bad_interrupt>
|
||||||
|
4: 52 c0 rjmp .+164 ; 0xaa <__bad_interrupt>
|
||||||
|
6: 51 c0 rjmp .+162 ; 0xaa <__bad_interrupt>
|
||||||
|
8: 50 c0 rjmp .+160 ; 0xaa <__bad_interrupt>
|
||||||
|
a: 4f c0 rjmp .+158 ; 0xaa <__bad_interrupt>
|
||||||
|
c: 42 c1 rjmp .+644 ; 0x292 <__vector_6>
|
||||||
|
e: 4d c0 rjmp .+154 ; 0xaa <__bad_interrupt>
|
||||||
|
10: 4c c0 rjmp .+152 ; 0xaa <__bad_interrupt>
|
||||||
|
12: 4b c0 rjmp .+150 ; 0xaa <__bad_interrupt>
|
||||||
|
14: 4a c0 rjmp .+148 ; 0xaa <__bad_interrupt>
|
||||||
|
16: 3c c2 rjmp .+1144 ; 0x490 <__vector_11>
|
||||||
|
18: 67 c2 rjmp .+1230 ; 0x4e8 <__vector_12>
|
||||||
|
1a: 47 c0 rjmp .+142 ; 0xaa <__bad_interrupt>
|
||||||
|
1c: 46 c0 rjmp .+140 ; 0xaa <__bad_interrupt>
|
||||||
|
1e: 45 c0 rjmp .+138 ; 0xaa <__bad_interrupt>
|
||||||
|
20: 44 c0 rjmp .+136 ; 0xaa <__bad_interrupt>
|
||||||
|
22: 43 c0 rjmp .+134 ; 0xaa <__bad_interrupt>
|
||||||
|
24: 42 c0 rjmp .+132 ; 0xaa <__bad_interrupt>
|
||||||
|
|
||||||
|
00000026 <__c.1594>:
|
||||||
|
26: 42 61 74 74 65 72 79 20 56 6f 6c 74 61 67 65 3a Battery Voltage:
|
||||||
|
36: 20 20 20 00 .
|
||||||
|
|
||||||
|
0000003a <__c.1596>:
|
||||||
|
3a: 6d 56 0d 0a 00 mV...
|
||||||
|
|
||||||
|
0000003f <__c.1598>:
|
||||||
|
3f: 47 65 6e 65 72 61 74 6f 72 20 56 6f 6c 74 61 67 Generator Voltag
|
||||||
|
4f: 65 3a 20 20 20 00 e: .
|
||||||
|
|
||||||
|
00000055 <__c.1600>:
|
||||||
|
55: 6d 56 0d 0a 00 mV...
|
||||||
|
|
||||||
|
0000005a <__c.1602>:
|
||||||
|
5a: 47 65 6e 65 72 61 74 6f 72 3a 20 00 Generator: .
|
||||||
|
|
||||||
|
00000066 <__c.1604>:
|
||||||
|
66: 6d 41 20 20 00 mA .
|
||||||
|
|
||||||
|
0000006b <__c.1606>:
|
||||||
|
6b: 57 0d 0a 00 W...
|
||||||
|
|
||||||
|
0000006f <__c.1608>:
|
||||||
|
6f: 73 77 69 74 63 68 65 73 20 28 6c 6f 61 64 2c 20 switches (load,
|
||||||
|
7f: 67 65 6e 29 3a 20 00 gen): .
|
||||||
|
|
||||||
|
00000086 <__c.1610>:
|
||||||
|
86: 0d 0a 00 00 ....
|
||||||
|
|
||||||
|
0000008a <__ctors_end>:
|
||||||
|
8a: 11 24 eor r1, r1
|
||||||
|
8c: 1f be out 0x3f, r1 ; 63
|
||||||
|
8e: cf e5 ldi r28, 0x5F ; 95
|
||||||
|
90: d4 e0 ldi r29, 0x04 ; 4
|
||||||
|
92: de bf out 0x3e, r29 ; 62
|
||||||
|
94: cd bf out 0x3d, r28 ; 61
|
||||||
|
|
||||||
|
00000096 <__do_clear_bss>:
|
||||||
|
96: 10 e0 ldi r17, 0x00 ; 0
|
||||||
|
98: a0 e6 ldi r26, 0x60 ; 96
|
||||||
|
9a: b0 e0 ldi r27, 0x00 ; 0
|
||||||
|
9c: 01 c0 rjmp .+2 ; 0xa0 <.do_clear_bss_start>
|
||||||
|
|
||||||
|
0000009e <.do_clear_bss_loop>:
|
||||||
|
9e: 1d 92 st X+, r1
|
||||||
|
|
||||||
|
000000a0 <.do_clear_bss_start>:
|
||||||
|
a0: a5 3b cpi r26, 0xB5 ; 181
|
||||||
|
a2: b1 07 cpc r27, r17
|
||||||
|
a4: e1 f7 brne .-8 ; 0x9e <.do_clear_bss_loop>
|
||||||
|
a6: 9c d2 rcall .+1336 ; 0x5e0 <main>
|
||||||
|
a8: 47 c3 rjmp .+1678 ; 0x738 <_exit>
|
||||||
|
|
||||||
|
000000aa <__bad_interrupt>:
|
||||||
|
aa: aa cf rjmp .-172 ; 0x0 <__vectors>
|
||||||
|
|
||||||
|
000000ac <measure>:
|
||||||
|
ac: cf 93 push r28
|
||||||
|
ae: 64 e0 ldi r22, 0x04 ; 4
|
||||||
|
b0: 82 e0 ldi r24, 0x02 ; 2
|
||||||
|
b2: 45 d1 rcall .+650 ; 0x33e <adc_read_avg>
|
||||||
|
b4: cf e0 ldi r28, 0x0F ; 15
|
||||||
|
b6: 9c 01 movw r18, r24
|
||||||
|
b8: c2 9f mul r28, r18
|
||||||
|
ba: c0 01 movw r24, r0
|
||||||
|
bc: c3 9f mul r28, r19
|
||||||
|
be: 90 0d add r25, r0
|
||||||
|
c0: 11 24 eor r1, r1
|
||||||
|
c2: 8a 5e subi r24, 0xEA ; 234
|
||||||
|
c4: 9c 4f sbci r25, 0xFC ; 252
|
||||||
|
c6: 90 93 6b 00 sts 0x006B, r25
|
||||||
|
ca: 80 93 6a 00 sts 0x006A, r24
|
||||||
|
ce: 64 e0 ldi r22, 0x04 ; 4
|
||||||
|
d0: 80 e0 ldi r24, 0x00 ; 0
|
||||||
|
d2: 35 d1 rcall .+618 ; 0x33e <adc_read_avg>
|
||||||
|
d4: 9c 01 movw r18, r24
|
||||||
|
d6: c2 9f mul r28, r18
|
||||||
|
d8: c0 01 movw r24, r0
|
||||||
|
da: c3 9f mul r28, r19
|
||||||
|
dc: 90 0d add r25, r0
|
||||||
|
de: 11 24 eor r1, r1
|
||||||
|
e0: 90 93 69 00 sts 0x0069, r25
|
||||||
|
e4: 80 93 68 00 sts 0x0068, r24
|
||||||
|
e8: 64 e0 ldi r22, 0x04 ; 4
|
||||||
|
ea: 81 e0 ldi r24, 0x01 ; 1
|
||||||
|
ec: 28 d1 rcall .+592 ; 0x33e <adc_read_avg>
|
||||||
|
ee: 8f 5f subi r24, 0xFF ; 255
|
||||||
|
f0: 91 40 sbci r25, 0x01 ; 1
|
||||||
|
f2: 97 fd sbrc r25, 7
|
||||||
|
f4: 05 c0 rjmp .+10 ; 0x100 <measure+0x54>
|
||||||
|
f6: 90 93 6f 00 sts 0x006F, r25
|
||||||
|
fa: 80 93 6e 00 sts 0x006E, r24
|
||||||
|
fe: 04 c0 rjmp .+8 ; 0x108 <measure+0x5c>
|
||||||
|
100: 10 92 6f 00 sts 0x006F, r1
|
||||||
|
104: 10 92 6e 00 sts 0x006E, r1
|
||||||
|
108: 20 91 6e 00 lds r18, 0x006E
|
||||||
|
10c: 30 91 6f 00 lds r19, 0x006F
|
||||||
|
110: 48 e4 ldi r20, 0x48 ; 72
|
||||||
|
112: 42 9f mul r20, r18
|
||||||
|
114: c0 01 movw r24, r0
|
||||||
|
116: 43 9f mul r20, r19
|
||||||
|
118: 90 0d add r25, r0
|
||||||
|
11a: 11 24 eor r1, r1
|
||||||
|
11c: 90 93 67 00 sts 0x0067, r25
|
||||||
|
120: 80 93 66 00 sts 0x0066, r24
|
||||||
|
124: cf 91 pop r28
|
||||||
|
126: 08 95 ret
|
||||||
|
|
||||||
|
00000128 <get_power>:
|
||||||
|
128: cf 93 push r28
|
||||||
|
12a: df 93 push r29
|
||||||
|
12c: ec 01 movw r28, r24
|
||||||
|
12e: cb 01 movw r24, r22
|
||||||
|
130: 24 e6 ldi r18, 0x64 ; 100
|
||||||
|
132: 30 e0 ldi r19, 0x00 ; 0
|
||||||
|
134: b9 01 movw r22, r18
|
||||||
|
136: ed d2 rcall .+1498 ; 0x712 <__divmodhi4>
|
||||||
|
138: fb 01 movw r30, r22
|
||||||
|
13a: ce 01 movw r24, r28
|
||||||
|
13c: b9 01 movw r22, r18
|
||||||
|
13e: d5 d2 rcall .+1450 ; 0x6ea <__udivmodhi4>
|
||||||
|
140: e6 9f mul r30, r22
|
||||||
|
142: c0 01 movw r24, r0
|
||||||
|
144: e7 9f mul r30, r23
|
||||||
|
146: 90 0d add r25, r0
|
||||||
|
148: f6 9f mul r31, r22
|
||||||
|
14a: 90 0d add r25, r0
|
||||||
|
14c: 11 24 eor r1, r1
|
||||||
|
14e: b9 01 movw r22, r18
|
||||||
|
150: cc d2 rcall .+1432 ; 0x6ea <__udivmodhi4>
|
||||||
|
152: cb 01 movw r24, r22
|
||||||
|
154: df 91 pop r29
|
||||||
|
156: cf 91 pop r28
|
||||||
|
158: 08 95 ret
|
||||||
|
|
||||||
|
0000015a <pretty_print_all_values>:
|
||||||
|
15a: 86 e2 ldi r24, 0x26 ; 38
|
||||||
|
15c: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
15e: 33 d2 rcall .+1126 ; 0x5c6 <uart_puts_p>
|
||||||
|
160: 80 91 6a 00 lds r24, 0x006A
|
||||||
|
164: 90 91 6b 00 lds r25, 0x006B
|
||||||
|
168: 5e d1 rcall .+700 ; 0x426 <uart_print_uint16>
|
||||||
|
16a: 8a e3 ldi r24, 0x3A ; 58
|
||||||
|
16c: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
16e: 2b d2 rcall .+1110 ; 0x5c6 <uart_puts_p>
|
||||||
|
170: 8f e3 ldi r24, 0x3F ; 63
|
||||||
|
172: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
174: 28 d2 rcall .+1104 ; 0x5c6 <uart_puts_p>
|
||||||
|
176: 80 91 68 00 lds r24, 0x0068
|
||||||
|
17a: 90 91 69 00 lds r25, 0x0069
|
||||||
|
17e: 53 d1 rcall .+678 ; 0x426 <uart_print_uint16>
|
||||||
|
180: 85 e5 ldi r24, 0x55 ; 85
|
||||||
|
182: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
184: 20 d2 rcall .+1088 ; 0x5c6 <uart_puts_p>
|
||||||
|
186: 8a e5 ldi r24, 0x5A ; 90
|
||||||
|
188: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
18a: 1d d2 rcall .+1082 ; 0x5c6 <uart_puts_p>
|
||||||
|
18c: 80 91 66 00 lds r24, 0x0066
|
||||||
|
190: 90 91 67 00 lds r25, 0x0067
|
||||||
|
194: 48 d1 rcall .+656 ; 0x426 <uart_print_uint16>
|
||||||
|
196: 86 e6 ldi r24, 0x66 ; 102
|
||||||
|
198: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
19a: 15 d2 rcall .+1066 ; 0x5c6 <uart_puts_p>
|
||||||
|
19c: 80 91 66 00 lds r24, 0x0066
|
||||||
|
1a0: 90 91 67 00 lds r25, 0x0067
|
||||||
|
1a4: 24 e6 ldi r18, 0x64 ; 100
|
||||||
|
1a6: 30 e0 ldi r19, 0x00 ; 0
|
||||||
|
1a8: b9 01 movw r22, r18
|
||||||
|
1aa: b3 d2 rcall .+1382 ; 0x712 <__divmodhi4>
|
||||||
|
1ac: fb 01 movw r30, r22
|
||||||
|
1ae: 80 91 6a 00 lds r24, 0x006A
|
||||||
|
1b2: 90 91 6b 00 lds r25, 0x006B
|
||||||
|
1b6: b9 01 movw r22, r18
|
||||||
|
1b8: 98 d2 rcall .+1328 ; 0x6ea <__udivmodhi4>
|
||||||
|
1ba: e6 9f mul r30, r22
|
||||||
|
1bc: c0 01 movw r24, r0
|
||||||
|
1be: e7 9f mul r30, r23
|
||||||
|
1c0: 90 0d add r25, r0
|
||||||
|
1c2: f6 9f mul r31, r22
|
||||||
|
1c4: 90 0d add r25, r0
|
||||||
|
1c6: 11 24 eor r1, r1
|
||||||
|
1c8: b9 01 movw r22, r18
|
||||||
|
1ca: 8f d2 rcall .+1310 ; 0x6ea <__udivmodhi4>
|
||||||
|
1cc: cb 01 movw r24, r22
|
||||||
|
1ce: 2b d1 rcall .+598 ; 0x426 <uart_print_uint16>
|
||||||
|
1d0: 8b e6 ldi r24, 0x6B ; 107
|
||||||
|
1d2: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
1d4: f8 d1 rcall .+1008 ; 0x5c6 <uart_puts_p>
|
||||||
|
1d6: 8f e6 ldi r24, 0x6F ; 111
|
||||||
|
1d8: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
1da: f5 d1 rcall .+1002 ; 0x5c6 <uart_puts_p>
|
||||||
|
1dc: 86 b3 in r24, 0x16 ; 22
|
||||||
|
1de: 81 70 andi r24, 0x01 ; 1
|
||||||
|
1e0: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
1e2: d5 d1 rcall .+938 ; 0x58e <uart_putc>
|
||||||
|
1e4: 8c e2 ldi r24, 0x2C ; 44
|
||||||
|
1e6: d3 d1 rcall .+934 ; 0x58e <uart_putc>
|
||||||
|
1e8: 86 b3 in r24, 0x16 ; 22
|
||||||
|
1ea: 86 95 lsr r24
|
||||||
|
1ec: 81 70 andi r24, 0x01 ; 1
|
||||||
|
1ee: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
1f0: ce d1 rcall .+924 ; 0x58e <uart_putc>
|
||||||
|
1f2: 86 e8 ldi r24, 0x86 ; 134
|
||||||
|
1f4: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
1f6: e7 c1 rjmp .+974 ; 0x5c6 <uart_puts_p>
|
||||||
|
|
||||||
|
000001f8 <handle_over_and_undervoltage>:
|
||||||
|
1f8: 80 91 6a 00 lds r24, 0x006A
|
||||||
|
1fc: 90 91 6b 00 lds r25, 0x006B
|
||||||
|
200: 80 3c cpi r24, 0xC0 ; 192
|
||||||
|
202: 9b 42 sbci r25, 0x2B ; 43
|
||||||
|
204: 50 f4 brcc .+20 ; 0x21a <handle_over_and_undervoltage+0x22>
|
||||||
|
206: 10 92 62 00 sts 0x0062, r1
|
||||||
|
20a: 80 91 63 00 lds r24, 0x0063
|
||||||
|
20e: 85 30 cpi r24, 0x05 ; 5
|
||||||
|
210: 68 f4 brcc .+26 ; 0x22c <handle_over_and_undervoltage+0x34>
|
||||||
|
212: 8f 5f subi r24, 0xFF ; 255
|
||||||
|
214: 80 93 63 00 sts 0x0063, r24
|
||||||
|
218: 09 c0 rjmp .+18 ; 0x22c <handle_over_and_undervoltage+0x34>
|
||||||
|
21a: 10 92 63 00 sts 0x0063, r1
|
||||||
|
21e: 80 91 62 00 lds r24, 0x0062
|
||||||
|
222: 83 30 cpi r24, 0x03 ; 3
|
||||||
|
224: 18 f4 brcc .+6 ; 0x22c <handle_over_and_undervoltage+0x34>
|
||||||
|
226: 8f 5f subi r24, 0xFF ; 255
|
||||||
|
228: 80 93 62 00 sts 0x0062, r24
|
||||||
|
22c: 80 91 68 00 lds r24, 0x0068
|
||||||
|
230: 90 91 69 00 lds r25, 0x0069
|
||||||
|
234: 89 3c cpi r24, 0xC9 ; 201
|
||||||
|
236: 92 43 sbci r25, 0x32 ; 50
|
||||||
|
238: 50 f0 brcs .+20 ; 0x24e <handle_over_and_undervoltage+0x56>
|
||||||
|
23a: 10 92 60 00 sts 0x0060, r1
|
||||||
|
23e: 80 91 61 00 lds r24, 0x0061
|
||||||
|
242: 82 30 cpi r24, 0x02 ; 2
|
||||||
|
244: 68 f4 brcc .+26 ; 0x260 <handle_over_and_undervoltage+0x68>
|
||||||
|
246: 8f 5f subi r24, 0xFF ; 255
|
||||||
|
248: 80 93 61 00 sts 0x0061, r24
|
||||||
|
24c: 09 c0 rjmp .+18 ; 0x260 <handle_over_and_undervoltage+0x68>
|
||||||
|
24e: 10 92 61 00 sts 0x0061, r1
|
||||||
|
252: 80 91 60 00 lds r24, 0x0060
|
||||||
|
256: 82 30 cpi r24, 0x02 ; 2
|
||||||
|
258: 18 f4 brcc .+6 ; 0x260 <handle_over_and_undervoltage+0x68>
|
||||||
|
25a: 8f 5f subi r24, 0xFF ; 255
|
||||||
|
25c: 80 93 60 00 sts 0x0060, r24
|
||||||
|
260: 80 91 63 00 lds r24, 0x0063
|
||||||
|
264: 85 30 cpi r24, 0x05 ; 5
|
||||||
|
266: 18 f0 brcs .+6 ; 0x26e <handle_over_and_undervoltage+0x76>
|
||||||
|
268: 10 92 62 00 sts 0x0062, r1
|
||||||
|
26c: 10 c0 rjmp .+32 ; 0x28e <handle_over_and_undervoltage+0x96>
|
||||||
|
26e: 80 91 62 00 lds r24, 0x0062
|
||||||
|
272: 83 30 cpi r24, 0x03 ; 3
|
||||||
|
274: 68 f0 brcs .+26 ; 0x290 <handle_over_and_undervoltage+0x98>
|
||||||
|
276: 10 92 63 00 sts 0x0063, r1
|
||||||
|
27a: 80 91 61 00 lds r24, 0x0061
|
||||||
|
27e: 82 30 cpi r24, 0x02 ; 2
|
||||||
|
280: 10 f0 brcs .+4 ; 0x286 <handle_over_and_undervoltage+0x8e>
|
||||||
|
282: c0 9a sbi 0x18, 0 ; 24
|
||||||
|
284: 08 95 ret
|
||||||
|
286: 80 91 60 00 lds r24, 0x0060
|
||||||
|
28a: 82 30 cpi r24, 0x02 ; 2
|
||||||
|
28c: 08 f0 brcs .+2 ; 0x290 <handle_over_and_undervoltage+0x98>
|
||||||
|
28e: c0 98 cbi 0x18, 0 ; 24
|
||||||
|
290: 08 95 ret
|
||||||
|
|
||||||
|
00000292 <__vector_6>:
|
||||||
|
292: 1f 92 push r1
|
||||||
|
294: 0f 92 push r0
|
||||||
|
296: 0f b6 in r0, 0x3f ; 63
|
||||||
|
298: 0f 92 push r0
|
||||||
|
29a: 11 24 eor r1, r1
|
||||||
|
29c: 2f 93 push r18
|
||||||
|
29e: 3f 93 push r19
|
||||||
|
2a0: 4f 93 push r20
|
||||||
|
2a2: 5f 93 push r21
|
||||||
|
2a4: 6f 93 push r22
|
||||||
|
2a6: 7f 93 push r23
|
||||||
|
2a8: 8f 93 push r24
|
||||||
|
2aa: 9f 93 push r25
|
||||||
|
2ac: 80 91 6c 00 lds r24, 0x006C
|
||||||
|
2b0: 90 91 6d 00 lds r25, 0x006D
|
||||||
|
2b4: 01 96 adiw r24, 0x01 ; 1
|
||||||
|
2b6: 90 93 6d 00 sts 0x006D, r25
|
||||||
|
2ba: 80 93 6c 00 sts 0x006C, r24
|
||||||
|
2be: 20 91 6c 00 lds r18, 0x006C
|
||||||
|
2c2: 30 91 6d 00 lds r19, 0x006D
|
||||||
|
2c6: 81 e0 ldi r24, 0x01 ; 1
|
||||||
|
2c8: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
2ca: 20 36 cpi r18, 0x60 ; 96
|
||||||
|
2cc: 4a ee ldi r20, 0xEA ; 234
|
||||||
|
2ce: 34 07 cpc r19, r20
|
||||||
|
2d0: 10 f4 brcc .+4 ; 0x2d6 <__vector_6+0x44>
|
||||||
|
2d2: 80 e0 ldi r24, 0x00 ; 0
|
||||||
|
2d4: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
2d6: 60 e6 ldi r22, 0x60 ; 96
|
||||||
|
2d8: 7a ee ldi r23, 0xEA ; 234
|
||||||
|
2da: 86 9f mul r24, r22
|
||||||
|
2dc: a0 01 movw r20, r0
|
||||||
|
2de: 87 9f mul r24, r23
|
||||||
|
2e0: 50 0d add r21, r0
|
||||||
|
2e2: 96 9f mul r25, r22
|
||||||
|
2e4: 50 0d add r21, r0
|
||||||
|
2e6: 11 24 eor r1, r1
|
||||||
|
2e8: c9 01 movw r24, r18
|
||||||
|
2ea: 84 1b sub r24, r20
|
||||||
|
2ec: 95 0b sbc r25, r21
|
||||||
|
2ee: 90 93 6d 00 sts 0x006D, r25
|
||||||
|
2f2: 80 93 6c 00 sts 0x006C, r24
|
||||||
|
2f6: 9f 91 pop r25
|
||||||
|
2f8: 8f 91 pop r24
|
||||||
|
2fa: 7f 91 pop r23
|
||||||
|
2fc: 6f 91 pop r22
|
||||||
|
2fe: 5f 91 pop r21
|
||||||
|
300: 4f 91 pop r20
|
||||||
|
302: 3f 91 pop r19
|
||||||
|
304: 2f 91 pop r18
|
||||||
|
306: 0f 90 pop r0
|
||||||
|
308: 0f be out 0x3f, r0 ; 63
|
||||||
|
30a: 0f 90 pop r0
|
||||||
|
30c: 1f 90 pop r1
|
||||||
|
30e: 18 95 reti
|
||||||
|
|
||||||
|
00000310 <adc_init>:
|
||||||
|
310: 80 e4 ldi r24, 0x40 ; 64
|
||||||
|
312: 87 b9 out 0x07, r24 ; 7
|
||||||
|
314: 83 e0 ldi r24, 0x03 ; 3
|
||||||
|
316: 86 b9 out 0x06, r24 ; 6
|
||||||
|
318: 37 9a sbi 0x06, 7 ; 6
|
||||||
|
31a: 36 9a sbi 0x06, 6 ; 6
|
||||||
|
31c: 36 99 sbic 0x06, 6 ; 6
|
||||||
|
31e: fe cf rjmp .-4 ; 0x31c <adc_init+0xc>
|
||||||
|
320: 84 b1 in r24, 0x04 ; 4
|
||||||
|
322: 95 b1 in r25, 0x05 ; 5
|
||||||
|
324: 08 95 ret
|
||||||
|
|
||||||
|
00000326 <adc_read_single>:
|
||||||
|
326: 97 b1 in r25, 0x07 ; 7
|
||||||
|
328: 8f 71 andi r24, 0x1F ; 31
|
||||||
|
32a: 90 7e andi r25, 0xE0 ; 224
|
||||||
|
32c: 89 2b or r24, r25
|
||||||
|
32e: 87 b9 out 0x07, r24 ; 7
|
||||||
|
330: 36 9a sbi 0x06, 6 ; 6
|
||||||
|
332: 36 99 sbic 0x06, 6 ; 6
|
||||||
|
334: fe cf rjmp .-4 ; 0x332 <adc_read_single+0xc>
|
||||||
|
336: 24 b1 in r18, 0x04 ; 4
|
||||||
|
338: 35 b1 in r19, 0x05 ; 5
|
||||||
|
33a: c9 01 movw r24, r18
|
||||||
|
33c: 08 95 ret
|
||||||
|
|
||||||
|
0000033e <adc_read_avg>:
|
||||||
|
33e: ff 92 push r15
|
||||||
|
340: 0f 93 push r16
|
||||||
|
342: 1f 93 push r17
|
||||||
|
344: cf 93 push r28
|
||||||
|
346: df 93 push r29
|
||||||
|
348: 08 2f mov r16, r24
|
||||||
|
34a: 86 2f mov r24, r22
|
||||||
|
34c: 6c e3 ldi r22, 0x3C ; 60
|
||||||
|
34e: c1 d1 rcall .+898 ; 0x6d2 <__udivmodqi4>
|
||||||
|
350: f9 2e mov r15, r25
|
||||||
|
352: 10 e0 ldi r17, 0x00 ; 0
|
||||||
|
354: c0 e0 ldi r28, 0x00 ; 0
|
||||||
|
356: d0 e0 ldi r29, 0x00 ; 0
|
||||||
|
358: 05 c0 rjmp .+10 ; 0x364 <adc_read_avg+0x26>
|
||||||
|
35a: 80 2f mov r24, r16
|
||||||
|
35c: e4 df rcall .-56 ; 0x326 <adc_read_single>
|
||||||
|
35e: c8 0f add r28, r24
|
||||||
|
360: d9 1f adc r29, r25
|
||||||
|
362: 1f 5f subi r17, 0xFF ; 255
|
||||||
|
364: 1f 11 cpse r17, r15
|
||||||
|
366: f9 cf rjmp .-14 ; 0x35a <adc_read_avg+0x1c>
|
||||||
|
368: 61 2f mov r22, r17
|
||||||
|
36a: ce 01 movw r24, r28
|
||||||
|
36c: 70 e0 ldi r23, 0x00 ; 0
|
||||||
|
36e: bd d1 rcall .+890 ; 0x6ea <__udivmodhi4>
|
||||||
|
370: cb 01 movw r24, r22
|
||||||
|
372: df 91 pop r29
|
||||||
|
374: cf 91 pop r28
|
||||||
|
376: 1f 91 pop r17
|
||||||
|
378: 0f 91 pop r16
|
||||||
|
37a: ff 90 pop r15
|
||||||
|
37c: 08 95 ret
|
||||||
|
|
||||||
|
0000037e <wait>:
|
||||||
|
37e: 81 11 cpse r24, r1
|
||||||
|
380: 01 c0 rjmp .+2 ; 0x384 <wait+0x6>
|
||||||
|
382: 84 e6 ldi r24, 0x64 ; 100
|
||||||
|
384: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
386: ef e1 ldi r30, 0x1F ; 31
|
||||||
|
388: fe e4 ldi r31, 0x4E ; 78
|
||||||
|
38a: 31 97 sbiw r30, 0x01 ; 1
|
||||||
|
38c: f1 f7 brne .-4 ; 0x38a <wait+0xc>
|
||||||
|
38e: 00 c0 rjmp .+0 ; 0x390 <wait+0x12>
|
||||||
|
390: 00 00 nop
|
||||||
|
392: 9f 5f subi r25, 0xFF ; 255
|
||||||
|
394: 98 13 cpse r25, r24
|
||||||
|
396: f7 cf rjmp .-18 ; 0x386 <wait+0x8>
|
||||||
|
398: 08 95 ret
|
||||||
|
|
||||||
|
0000039a <uart_print_voltage>:
|
||||||
|
39a: ef 92 push r14
|
||||||
|
39c: ff 92 push r15
|
||||||
|
39e: 0f 93 push r16
|
||||||
|
3a0: 1f 93 push r17
|
||||||
|
3a2: cf 93 push r28
|
||||||
|
3a4: df 93 push r29
|
||||||
|
3a6: 8c 01 movw r16, r24
|
||||||
|
3a8: 60 e1 ldi r22, 0x10 ; 16
|
||||||
|
3aa: 77 e2 ldi r23, 0x27 ; 39
|
||||||
|
3ac: 9e d1 rcall .+828 ; 0x6ea <__udivmodhi4>
|
||||||
|
3ae: 7c 01 movw r14, r24
|
||||||
|
3b0: 86 2f mov r24, r22
|
||||||
|
3b2: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
3b4: ec d0 rcall .+472 ; 0x58e <uart_putc>
|
||||||
|
3b6: c8 ee ldi r28, 0xE8 ; 232
|
||||||
|
3b8: d3 e0 ldi r29, 0x03 ; 3
|
||||||
|
3ba: c7 01 movw r24, r14
|
||||||
|
3bc: be 01 movw r22, r28
|
||||||
|
3be: 95 d1 rcall .+810 ; 0x6ea <__udivmodhi4>
|
||||||
|
3c0: 86 2f mov r24, r22
|
||||||
|
3c2: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
3c4: e4 d0 rcall .+456 ; 0x58e <uart_putc>
|
||||||
|
3c6: 8e e2 ldi r24, 0x2E ; 46
|
||||||
|
3c8: e2 d0 rcall .+452 ; 0x58e <uart_putc>
|
||||||
|
3ca: c8 01 movw r24, r16
|
||||||
|
3cc: be 01 movw r22, r28
|
||||||
|
3ce: 8d d1 rcall .+794 ; 0x6ea <__udivmodhi4>
|
||||||
|
3d0: 64 e6 ldi r22, 0x64 ; 100
|
||||||
|
3d2: 70 e0 ldi r23, 0x00 ; 0
|
||||||
|
3d4: 8a d1 rcall .+788 ; 0x6ea <__udivmodhi4>
|
||||||
|
3d6: 86 2f mov r24, r22
|
||||||
|
3d8: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
3da: df 91 pop r29
|
||||||
|
3dc: cf 91 pop r28
|
||||||
|
3de: 1f 91 pop r17
|
||||||
|
3e0: 0f 91 pop r16
|
||||||
|
3e2: ff 90 pop r15
|
||||||
|
3e4: ef 90 pop r14
|
||||||
|
3e6: d3 c0 rjmp .+422 ; 0x58e <uart_putc>
|
||||||
|
|
||||||
|
000003e8 <uart_print_uint8>:
|
||||||
|
3e8: 0f 93 push r16
|
||||||
|
3ea: 1f 93 push r17
|
||||||
|
3ec: cf 93 push r28
|
||||||
|
3ee: df 93 push r29
|
||||||
|
3f0: 1f 92 push r1
|
||||||
|
3f2: cd b7 in r28, 0x3d ; 61
|
||||||
|
3f4: de b7 in r29, 0x3e ; 62
|
||||||
|
3f6: 08 2f mov r16, r24
|
||||||
|
3f8: 64 e6 ldi r22, 0x64 ; 100
|
||||||
|
3fa: 6b d1 rcall .+726 ; 0x6d2 <__udivmodqi4>
|
||||||
|
3fc: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
3fe: 99 83 std Y+1, r25 ; 0x01
|
||||||
|
400: c6 d0 rcall .+396 ; 0x58e <uart_putc>
|
||||||
|
402: 1a e0 ldi r17, 0x0A ; 10
|
||||||
|
404: 99 81 ldd r25, Y+1 ; 0x01
|
||||||
|
406: 89 2f mov r24, r25
|
||||||
|
408: 61 2f mov r22, r17
|
||||||
|
40a: 63 d1 rcall .+710 ; 0x6d2 <__udivmodqi4>
|
||||||
|
40c: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
40e: bf d0 rcall .+382 ; 0x58e <uart_putc>
|
||||||
|
410: 80 2f mov r24, r16
|
||||||
|
412: 61 2f mov r22, r17
|
||||||
|
414: 5e d1 rcall .+700 ; 0x6d2 <__udivmodqi4>
|
||||||
|
416: 89 2f mov r24, r25
|
||||||
|
418: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
41a: 0f 90 pop r0
|
||||||
|
41c: df 91 pop r29
|
||||||
|
41e: cf 91 pop r28
|
||||||
|
420: 1f 91 pop r17
|
||||||
|
422: 0f 91 pop r16
|
||||||
|
424: b4 c0 rjmp .+360 ; 0x58e <uart_putc>
|
||||||
|
|
||||||
|
00000426 <uart_print_uint16>:
|
||||||
|
426: ef 92 push r14
|
||||||
|
428: ff 92 push r15
|
||||||
|
42a: 0f 93 push r16
|
||||||
|
42c: 1f 93 push r17
|
||||||
|
42e: cf 93 push r28
|
||||||
|
430: df 93 push r29
|
||||||
|
432: ec 01 movw r28, r24
|
||||||
|
434: 60 e1 ldi r22, 0x10 ; 16
|
||||||
|
436: 77 e2 ldi r23, 0x27 ; 39
|
||||||
|
438: 58 d1 rcall .+688 ; 0x6ea <__udivmodhi4>
|
||||||
|
43a: 7c 01 movw r14, r24
|
||||||
|
43c: 86 2f mov r24, r22
|
||||||
|
43e: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
440: a6 d0 rcall .+332 ; 0x58e <uart_putc>
|
||||||
|
442: 08 ee ldi r16, 0xE8 ; 232
|
||||||
|
444: 13 e0 ldi r17, 0x03 ; 3
|
||||||
|
446: c7 01 movw r24, r14
|
||||||
|
448: b8 01 movw r22, r16
|
||||||
|
44a: 4f d1 rcall .+670 ; 0x6ea <__udivmodhi4>
|
||||||
|
44c: 86 2f mov r24, r22
|
||||||
|
44e: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
450: 9e d0 rcall .+316 ; 0x58e <uart_putc>
|
||||||
|
452: ce 01 movw r24, r28
|
||||||
|
454: b8 01 movw r22, r16
|
||||||
|
456: 49 d1 rcall .+658 ; 0x6ea <__udivmodhi4>
|
||||||
|
458: 04 e6 ldi r16, 0x64 ; 100
|
||||||
|
45a: 10 e0 ldi r17, 0x00 ; 0
|
||||||
|
45c: b8 01 movw r22, r16
|
||||||
|
45e: 45 d1 rcall .+650 ; 0x6ea <__udivmodhi4>
|
||||||
|
460: 86 2f mov r24, r22
|
||||||
|
462: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
464: 94 d0 rcall .+296 ; 0x58e <uart_putc>
|
||||||
|
466: ce 01 movw r24, r28
|
||||||
|
468: b8 01 movw r22, r16
|
||||||
|
46a: 3f d1 rcall .+638 ; 0x6ea <__udivmodhi4>
|
||||||
|
46c: 0a e0 ldi r16, 0x0A ; 10
|
||||||
|
46e: 10 e0 ldi r17, 0x00 ; 0
|
||||||
|
470: b8 01 movw r22, r16
|
||||||
|
472: 3b d1 rcall .+630 ; 0x6ea <__udivmodhi4>
|
||||||
|
474: 86 2f mov r24, r22
|
||||||
|
476: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
478: 8a d0 rcall .+276 ; 0x58e <uart_putc>
|
||||||
|
47a: ce 01 movw r24, r28
|
||||||
|
47c: b8 01 movw r22, r16
|
||||||
|
47e: 35 d1 rcall .+618 ; 0x6ea <__udivmodhi4>
|
||||||
|
480: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
482: df 91 pop r29
|
||||||
|
484: cf 91 pop r28
|
||||||
|
486: 1f 91 pop r17
|
||||||
|
488: 0f 91 pop r16
|
||||||
|
48a: ff 90 pop r15
|
||||||
|
48c: ef 90 pop r14
|
||||||
|
48e: 7f c0 rjmp .+254 ; 0x58e <uart_putc>
|
||||||
|
|
||||||
|
00000490 <__vector_11>:
|
||||||
|
490: 1f 92 push r1
|
||||||
|
492: 0f 92 push r0
|
||||||
|
494: 0f b6 in r0, 0x3f ; 63
|
||||||
|
496: 0f 92 push r0
|
||||||
|
498: 11 24 eor r1, r1
|
||||||
|
49a: 2f 93 push r18
|
||||||
|
49c: 8f 93 push r24
|
||||||
|
49e: 9f 93 push r25
|
||||||
|
4a0: ef 93 push r30
|
||||||
|
4a2: ff 93 push r31
|
||||||
|
4a4: 8b b1 in r24, 0x0b ; 11
|
||||||
|
4a6: 9c b1 in r25, 0x0c ; 12
|
||||||
|
4a8: 88 71 andi r24, 0x18 ; 24
|
||||||
|
4aa: e0 91 72 00 lds r30, 0x0072
|
||||||
|
4ae: ef 5f subi r30, 0xFF ; 255
|
||||||
|
4b0: ef 71 andi r30, 0x1F ; 31
|
||||||
|
4b2: 20 91 71 00 lds r18, 0x0071
|
||||||
|
4b6: e2 17 cp r30, r18
|
||||||
|
4b8: 39 f0 breq .+14 ; 0x4c8 <__vector_11+0x38>
|
||||||
|
4ba: e0 93 72 00 sts 0x0072, r30
|
||||||
|
4be: f0 e0 ldi r31, 0x00 ; 0
|
||||||
|
4c0: eb 58 subi r30, 0x8B ; 139
|
||||||
|
4c2: ff 4f sbci r31, 0xFF ; 255
|
||||||
|
4c4: 90 83 st Z, r25
|
||||||
|
4c6: 01 c0 rjmp .+2 ; 0x4ca <__vector_11+0x3a>
|
||||||
|
4c8: 82 e0 ldi r24, 0x02 ; 2
|
||||||
|
4ca: 90 91 70 00 lds r25, 0x0070
|
||||||
|
4ce: 98 2b or r25, r24
|
||||||
|
4d0: 90 93 70 00 sts 0x0070, r25
|
||||||
|
4d4: ff 91 pop r31
|
||||||
|
4d6: ef 91 pop r30
|
||||||
|
4d8: 9f 91 pop r25
|
||||||
|
4da: 8f 91 pop r24
|
||||||
|
4dc: 2f 91 pop r18
|
||||||
|
4de: 0f 90 pop r0
|
||||||
|
4e0: 0f be out 0x3f, r0 ; 63
|
||||||
|
4e2: 0f 90 pop r0
|
||||||
|
4e4: 1f 90 pop r1
|
||||||
|
4e6: 18 95 reti
|
||||||
|
|
||||||
|
000004e8 <__vector_12>:
|
||||||
|
4e8: 1f 92 push r1
|
||||||
|
4ea: 0f 92 push r0
|
||||||
|
4ec: 0f b6 in r0, 0x3f ; 63
|
||||||
|
4ee: 0f 92 push r0
|
||||||
|
4f0: 11 24 eor r1, r1
|
||||||
|
4f2: 8f 93 push r24
|
||||||
|
4f4: 9f 93 push r25
|
||||||
|
4f6: ef 93 push r30
|
||||||
|
4f8: ff 93 push r31
|
||||||
|
4fa: 90 91 74 00 lds r25, 0x0074
|
||||||
|
4fe: 80 91 73 00 lds r24, 0x0073
|
||||||
|
502: 98 17 cp r25, r24
|
||||||
|
504: 61 f0 breq .+24 ; 0x51e <__vector_12+0x36>
|
||||||
|
506: e0 91 73 00 lds r30, 0x0073
|
||||||
|
50a: ef 5f subi r30, 0xFF ; 255
|
||||||
|
50c: ef 71 andi r30, 0x1F ; 31
|
||||||
|
50e: e0 93 73 00 sts 0x0073, r30
|
||||||
|
512: f0 e0 ldi r31, 0x00 ; 0
|
||||||
|
514: eb 56 subi r30, 0x6B ; 107
|
||||||
|
516: ff 4f sbci r31, 0xFF ; 255
|
||||||
|
518: 80 81 ld r24, Z
|
||||||
|
51a: 8c b9 out 0x0c, r24 ; 12
|
||||||
|
51c: 01 c0 rjmp .+2 ; 0x520 <__vector_12+0x38>
|
||||||
|
51e: 55 98 cbi 0x0a, 5 ; 10
|
||||||
|
520: ff 91 pop r31
|
||||||
|
522: ef 91 pop r30
|
||||||
|
524: 9f 91 pop r25
|
||||||
|
526: 8f 91 pop r24
|
||||||
|
528: 0f 90 pop r0
|
||||||
|
52a: 0f be out 0x3f, r0 ; 63
|
||||||
|
52c: 0f 90 pop r0
|
||||||
|
52e: 1f 90 pop r1
|
||||||
|
530: 18 95 reti
|
||||||
|
|
||||||
|
00000532 <uart_init>:
|
||||||
|
532: 10 92 74 00 sts 0x0074, r1
|
||||||
|
536: 10 92 73 00 sts 0x0073, r1
|
||||||
|
53a: 10 92 72 00 sts 0x0072, r1
|
||||||
|
53e: 10 92 71 00 sts 0x0071, r1
|
||||||
|
542: 97 ff sbrs r25, 7
|
||||||
|
544: 03 c0 rjmp .+6 ; 0x54c <uart_init+0x1a>
|
||||||
|
546: 22 e0 ldi r18, 0x02 ; 2
|
||||||
|
548: 2b b9 out 0x0b, r18 ; 11
|
||||||
|
54a: 9f 77 andi r25, 0x7F ; 127
|
||||||
|
54c: 90 bd out 0x20, r25 ; 32
|
||||||
|
54e: 89 b9 out 0x09, r24 ; 9
|
||||||
|
550: 88 e9 ldi r24, 0x98 ; 152
|
||||||
|
552: 8a b9 out 0x0a, r24 ; 10
|
||||||
|
554: 86 e8 ldi r24, 0x86 ; 134
|
||||||
|
556: 80 bd out 0x20, r24 ; 32
|
||||||
|
558: 08 95 ret
|
||||||
|
|
||||||
|
0000055a <uart_getc>:
|
||||||
|
55a: 90 91 72 00 lds r25, 0x0072
|
||||||
|
55e: 80 91 71 00 lds r24, 0x0071
|
||||||
|
562: 98 17 cp r25, r24
|
||||||
|
564: 81 f0 breq .+32 ; 0x586 <uart_getc+0x2c>
|
||||||
|
566: e0 91 71 00 lds r30, 0x0071
|
||||||
|
56a: ef 5f subi r30, 0xFF ; 255
|
||||||
|
56c: ef 71 andi r30, 0x1F ; 31
|
||||||
|
56e: e0 93 71 00 sts 0x0071, r30
|
||||||
|
572: f0 e0 ldi r31, 0x00 ; 0
|
||||||
|
574: eb 58 subi r30, 0x8B ; 139
|
||||||
|
576: ff 4f sbci r31, 0xFF ; 255
|
||||||
|
578: 20 81 ld r18, Z
|
||||||
|
57a: 80 91 70 00 lds r24, 0x0070
|
||||||
|
57e: 10 92 70 00 sts 0x0070, r1
|
||||||
|
582: 30 e0 ldi r19, 0x00 ; 0
|
||||||
|
584: 02 c0 rjmp .+4 ; 0x58a <uart_getc+0x30>
|
||||||
|
586: 20 e0 ldi r18, 0x00 ; 0
|
||||||
|
588: 31 e0 ldi r19, 0x01 ; 1
|
||||||
|
58a: c9 01 movw r24, r18
|
||||||
|
58c: 08 95 ret
|
||||||
|
|
||||||
|
0000058e <uart_putc>:
|
||||||
|
58e: 90 91 74 00 lds r25, 0x0074
|
||||||
|
592: 9f 5f subi r25, 0xFF ; 255
|
||||||
|
594: 9f 71 andi r25, 0x1F ; 31
|
||||||
|
596: 20 91 73 00 lds r18, 0x0073
|
||||||
|
59a: 92 17 cp r25, r18
|
||||||
|
59c: e1 f3 breq .-8 ; 0x596 <uart_putc+0x8>
|
||||||
|
59e: e9 2f mov r30, r25
|
||||||
|
5a0: f0 e0 ldi r31, 0x00 ; 0
|
||||||
|
5a2: eb 56 subi r30, 0x6B ; 107
|
||||||
|
5a4: ff 4f sbci r31, 0xFF ; 255
|
||||||
|
5a6: 80 83 st Z, r24
|
||||||
|
5a8: 90 93 74 00 sts 0x0074, r25
|
||||||
|
5ac: 55 9a sbi 0x0a, 5 ; 10
|
||||||
|
5ae: 08 95 ret
|
||||||
|
|
||||||
|
000005b0 <uart_puts>:
|
||||||
|
5b0: cf 93 push r28
|
||||||
|
5b2: df 93 push r29
|
||||||
|
5b4: ec 01 movw r28, r24
|
||||||
|
5b6: 01 c0 rjmp .+2 ; 0x5ba <uart_puts+0xa>
|
||||||
|
5b8: ea df rcall .-44 ; 0x58e <uart_putc>
|
||||||
|
5ba: 89 91 ld r24, Y+
|
||||||
|
5bc: 81 11 cpse r24, r1
|
||||||
|
5be: fc cf rjmp .-8 ; 0x5b8 <uart_puts+0x8>
|
||||||
|
5c0: df 91 pop r29
|
||||||
|
5c2: cf 91 pop r28
|
||||||
|
5c4: 08 95 ret
|
||||||
|
|
||||||
|
000005c6 <uart_puts_p>:
|
||||||
|
5c6: cf 93 push r28
|
||||||
|
5c8: df 93 push r29
|
||||||
|
5ca: ec 01 movw r28, r24
|
||||||
|
5cc: 01 c0 rjmp .+2 ; 0x5d0 <uart_puts_p+0xa>
|
||||||
|
5ce: df df rcall .-66 ; 0x58e <uart_putc>
|
||||||
|
5d0: fe 01 movw r30, r28
|
||||||
|
5d2: 21 96 adiw r28, 0x01 ; 1
|
||||||
|
5d4: 84 91 lpm r24, Z+
|
||||||
|
5d6: 81 11 cpse r24, r1
|
||||||
|
5d8: fa cf rjmp .-12 ; 0x5ce <uart_puts_p+0x8>
|
||||||
|
5da: df 91 pop r29
|
||||||
|
5dc: cf 91 pop r28
|
||||||
|
5de: 08 95 ret
|
||||||
|
|
||||||
|
000005e0 <main>:
|
||||||
|
5e0: 87 b3 in r24, 0x17 ; 23
|
||||||
|
5e2: 83 60 ori r24, 0x03 ; 3
|
||||||
|
5e4: 87 bb out 0x17, r24 ; 23
|
||||||
|
5e6: 88 b3 in r24, 0x18 ; 24
|
||||||
|
5e8: 8c 7f andi r24, 0xFC ; 252
|
||||||
|
5ea: 88 bb out 0x18, r24 ; 24
|
||||||
|
5ec: 91 de rcall .-734 ; 0x310 <adc_init>
|
||||||
|
5ee: 8e b5 in r24, 0x2e ; 46
|
||||||
|
5f0: 8b 60 ori r24, 0x0B ; 11
|
||||||
|
5f2: 8e bd out 0x2e, r24 ; 46
|
||||||
|
5f4: 82 ee ldi r24, 0xE2 ; 226
|
||||||
|
5f6: 94 e0 ldi r25, 0x04 ; 4
|
||||||
|
5f8: 9b bd out 0x2b, r25 ; 43
|
||||||
|
5fa: 8a bd out 0x2a, r24 ; 42
|
||||||
|
5fc: 80 e1 ldi r24, 0x10 ; 16
|
||||||
|
5fe: 89 bf out 0x39, r24 ; 57
|
||||||
|
600: 78 94 sei
|
||||||
|
602: 89 e1 ldi r24, 0x19 ; 25
|
||||||
|
604: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
606: 95 df rcall .-214 ; 0x532 <uart_init>
|
||||||
|
608: c0 98 cbi 0x18, 0 ; 24
|
||||||
|
60a: c1 9a sbi 0x18, 1 ; 24
|
||||||
|
60c: c4 e6 ldi r28, 0x64 ; 100
|
||||||
|
60e: d0 e0 ldi r29, 0x00 ; 0
|
||||||
|
610: 80 91 6c 00 lds r24, 0x006C
|
||||||
|
614: 90 91 6d 00 lds r25, 0x006D
|
||||||
|
618: 84 36 cpi r24, 0x64 ; 100
|
||||||
|
61a: 91 05 cpc r25, r1
|
||||||
|
61c: 30 f0 brcs .+12 ; 0x62a <main+0x4a>
|
||||||
|
61e: 10 92 6d 00 sts 0x006D, r1
|
||||||
|
622: 10 92 6c 00 sts 0x006C, r1
|
||||||
|
626: 42 dd rcall .-1404 ; 0xac <measure>
|
||||||
|
628: e7 dd rcall .-1074 ; 0x1f8 <handle_over_and_undervoltage>
|
||||||
|
62a: 97 df rcall .-210 ; 0x55a <uart_getc>
|
||||||
|
62c: 81 15 cp r24, r1
|
||||||
|
62e: 21 e0 ldi r18, 0x01 ; 1
|
||||||
|
630: 92 07 cpc r25, r18
|
||||||
|
632: 71 f3 breq .-36 ; 0x610 <main+0x30>
|
||||||
|
634: 99 27 eor r25, r25
|
||||||
|
636: 81 36 cpi r24, 0x61 ; 97
|
||||||
|
638: 91 05 cpc r25, r1
|
||||||
|
63a: 29 f0 breq .+10 ; 0x646 <main+0x66>
|
||||||
|
63c: 80 37 cpi r24, 0x70 ; 112
|
||||||
|
63e: 91 05 cpc r25, r1
|
||||||
|
640: 39 f7 brne .-50 ; 0x610 <main+0x30>
|
||||||
|
642: 8b dd rcall .-1258 ; 0x15a <pretty_print_all_values>
|
||||||
|
644: e5 cf rjmp .-54 ; 0x610 <main+0x30>
|
||||||
|
646: 81 e4 ldi r24, 0x41 ; 65
|
||||||
|
648: a2 df rcall .-188 ; 0x58e <uart_putc>
|
||||||
|
64a: 80 91 6a 00 lds r24, 0x006A
|
||||||
|
64e: 90 91 6b 00 lds r25, 0x006B
|
||||||
|
652: e9 de rcall .-558 ; 0x426 <uart_print_uint16>
|
||||||
|
654: 8c e2 ldi r24, 0x2C ; 44
|
||||||
|
656: 9b df rcall .-202 ; 0x58e <uart_putc>
|
||||||
|
658: 80 91 66 00 lds r24, 0x0066
|
||||||
|
65c: 90 91 67 00 lds r25, 0x0067
|
||||||
|
660: e2 de rcall .-572 ; 0x426 <uart_print_uint16>
|
||||||
|
662: 8c e2 ldi r24, 0x2C ; 44
|
||||||
|
664: 94 df rcall .-216 ; 0x58e <uart_putc>
|
||||||
|
666: 80 e0 ldi r24, 0x00 ; 0
|
||||||
|
668: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
66a: dd de rcall .-582 ; 0x426 <uart_print_uint16>
|
||||||
|
66c: 8c e2 ldi r24, 0x2C ; 44
|
||||||
|
66e: 8f df rcall .-226 ; 0x58e <uart_putc>
|
||||||
|
670: 80 91 66 00 lds r24, 0x0066
|
||||||
|
674: 90 91 67 00 lds r25, 0x0067
|
||||||
|
678: be 01 movw r22, r28
|
||||||
|
67a: 4b d0 rcall .+150 ; 0x712 <__divmodhi4>
|
||||||
|
67c: 9b 01 movw r18, r22
|
||||||
|
67e: 80 91 6a 00 lds r24, 0x006A
|
||||||
|
682: 90 91 6b 00 lds r25, 0x006B
|
||||||
|
686: be 01 movw r22, r28
|
||||||
|
688: 30 d0 rcall .+96 ; 0x6ea <__udivmodhi4>
|
||||||
|
68a: 26 9f mul r18, r22
|
||||||
|
68c: c0 01 movw r24, r0
|
||||||
|
68e: 27 9f mul r18, r23
|
||||||
|
690: 90 0d add r25, r0
|
||||||
|
692: 36 9f mul r19, r22
|
||||||
|
694: 90 0d add r25, r0
|
||||||
|
696: 11 24 eor r1, r1
|
||||||
|
698: be 01 movw r22, r28
|
||||||
|
69a: 27 d0 rcall .+78 ; 0x6ea <__udivmodhi4>
|
||||||
|
69c: cb 01 movw r24, r22
|
||||||
|
69e: c3 de rcall .-634 ; 0x426 <uart_print_uint16>
|
||||||
|
6a0: 8c e2 ldi r24, 0x2C ; 44
|
||||||
|
6a2: 75 df rcall .-278 ; 0x58e <uart_putc>
|
||||||
|
6a4: 80 e0 ldi r24, 0x00 ; 0
|
||||||
|
6a6: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
6a8: be de rcall .-644 ; 0x426 <uart_print_uint16>
|
||||||
|
6aa: 8c e2 ldi r24, 0x2C ; 44
|
||||||
|
6ac: 70 df rcall .-288 ; 0x58e <uart_putc>
|
||||||
|
6ae: 86 b3 in r24, 0x16 ; 22
|
||||||
|
6b0: 81 70 andi r24, 0x01 ; 1
|
||||||
|
6b2: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
6b4: 6c df rcall .-296 ; 0x58e <uart_putc>
|
||||||
|
6b6: 8c e2 ldi r24, 0x2C ; 44
|
||||||
|
6b8: 6a df rcall .-300 ; 0x58e <uart_putc>
|
||||||
|
6ba: 80 e3 ldi r24, 0x30 ; 48
|
||||||
|
6bc: 68 df rcall .-304 ; 0x58e <uart_putc>
|
||||||
|
6be: 8c e2 ldi r24, 0x2C ; 44
|
||||||
|
6c0: 66 df rcall .-308 ; 0x58e <uart_putc>
|
||||||
|
6c2: 86 b3 in r24, 0x16 ; 22
|
||||||
|
6c4: 86 95 lsr r24
|
||||||
|
6c6: 81 70 andi r24, 0x01 ; 1
|
||||||
|
6c8: 80 5d subi r24, 0xD0 ; 208
|
||||||
|
6ca: 61 df rcall .-318 ; 0x58e <uart_putc>
|
||||||
|
6cc: 82 e4 ldi r24, 0x42 ; 66
|
||||||
|
6ce: 5f df rcall .-322 ; 0x58e <uart_putc>
|
||||||
|
6d0: 9f cf rjmp .-194 ; 0x610 <main+0x30>
|
||||||
|
|
||||||
|
000006d2 <__udivmodqi4>:
|
||||||
|
6d2: 99 1b sub r25, r25
|
||||||
|
6d4: 79 e0 ldi r23, 0x09 ; 9
|
||||||
|
6d6: 04 c0 rjmp .+8 ; 0x6e0 <__udivmodqi4_ep>
|
||||||
|
|
||||||
|
000006d8 <__udivmodqi4_loop>:
|
||||||
|
6d8: 99 1f adc r25, r25
|
||||||
|
6da: 96 17 cp r25, r22
|
||||||
|
6dc: 08 f0 brcs .+2 ; 0x6e0 <__udivmodqi4_ep>
|
||||||
|
6de: 96 1b sub r25, r22
|
||||||
|
|
||||||
|
000006e0 <__udivmodqi4_ep>:
|
||||||
|
6e0: 88 1f adc r24, r24
|
||||||
|
6e2: 7a 95 dec r23
|
||||||
|
6e4: c9 f7 brne .-14 ; 0x6d8 <__udivmodqi4_loop>
|
||||||
|
6e6: 80 95 com r24
|
||||||
|
6e8: 08 95 ret
|
||||||
|
|
||||||
|
000006ea <__udivmodhi4>:
|
||||||
|
6ea: aa 1b sub r26, r26
|
||||||
|
6ec: bb 1b sub r27, r27
|
||||||
|
6ee: 51 e1 ldi r21, 0x11 ; 17
|
||||||
|
6f0: 07 c0 rjmp .+14 ; 0x700 <__udivmodhi4_ep>
|
||||||
|
|
||||||
|
000006f2 <__udivmodhi4_loop>:
|
||||||
|
6f2: aa 1f adc r26, r26
|
||||||
|
6f4: bb 1f adc r27, r27
|
||||||
|
6f6: a6 17 cp r26, r22
|
||||||
|
6f8: b7 07 cpc r27, r23
|
||||||
|
6fa: 10 f0 brcs .+4 ; 0x700 <__udivmodhi4_ep>
|
||||||
|
6fc: a6 1b sub r26, r22
|
||||||
|
6fe: b7 0b sbc r27, r23
|
||||||
|
|
||||||
|
00000700 <__udivmodhi4_ep>:
|
||||||
|
700: 88 1f adc r24, r24
|
||||||
|
702: 99 1f adc r25, r25
|
||||||
|
704: 5a 95 dec r21
|
||||||
|
706: a9 f7 brne .-22 ; 0x6f2 <__udivmodhi4_loop>
|
||||||
|
708: 80 95 com r24
|
||||||
|
70a: 90 95 com r25
|
||||||
|
70c: bc 01 movw r22, r24
|
||||||
|
70e: cd 01 movw r24, r26
|
||||||
|
710: 08 95 ret
|
||||||
|
|
||||||
|
00000712 <__divmodhi4>:
|
||||||
|
712: 97 fb bst r25, 7
|
||||||
|
714: 07 2e mov r0, r23
|
||||||
|
716: 16 f4 brtc .+4 ; 0x71c <__divmodhi4+0xa>
|
||||||
|
718: 00 94 com r0
|
||||||
|
71a: 06 d0 rcall .+12 ; 0x728 <__divmodhi4_neg1>
|
||||||
|
71c: 77 fd sbrc r23, 7
|
||||||
|
71e: 08 d0 rcall .+16 ; 0x730 <__divmodhi4_neg2>
|
||||||
|
720: e4 df rcall .-56 ; 0x6ea <__udivmodhi4>
|
||||||
|
722: 07 fc sbrc r0, 7
|
||||||
|
724: 05 d0 rcall .+10 ; 0x730 <__divmodhi4_neg2>
|
||||||
|
726: 3e f4 brtc .+14 ; 0x736 <__divmodhi4_exit>
|
||||||
|
|
||||||
|
00000728 <__divmodhi4_neg1>:
|
||||||
|
728: 90 95 com r25
|
||||||
|
72a: 81 95 neg r24
|
||||||
|
72c: 9f 4f sbci r25, 0xFF ; 255
|
||||||
|
72e: 08 95 ret
|
||||||
|
|
||||||
|
00000730 <__divmodhi4_neg2>:
|
||||||
|
730: 70 95 com r23
|
||||||
|
732: 61 95 neg r22
|
||||||
|
734: 7f 4f sbci r23, 0xFF ; 255
|
||||||
|
|
||||||
|
00000736 <__divmodhi4_exit>:
|
||||||
|
736: 08 95 ret
|
||||||
|
|
||||||
|
00000738 <_exit>:
|
||||||
|
738: f8 94 cli
|
||||||
|
|
||||||
|
0000073a <__stop_program>:
|
||||||
|
73a: ff cf rjmp .-2 ; 0x73a <__stop_program>
|
|
@ -0,0 +1,543 @@
|
||||||
|
Archive member included because of file (symbol)
|
||||||
|
|
||||||
|
/usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodqi4.o)
|
||||||
|
src/adc.o (__udivmodqi4)
|
||||||
|
/usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodhi4.o)
|
||||||
|
src/main.o (__udivmodhi4)
|
||||||
|
/usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_divmodhi4.o)
|
||||||
|
src/main.o (__divmodhi4)
|
||||||
|
/usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_exit.o)
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o (exit)
|
||||||
|
/usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_clear_bss.o)
|
||||||
|
src/main.o (__do_clear_bss)
|
||||||
|
|
||||||
|
Memory Configuration
|
||||||
|
|
||||||
|
Name Origin Length Attributes
|
||||||
|
text 0x0000000000000000 0x0000000000002000 xr
|
||||||
|
data 0x0000000000800060 0x000000000000ffa0 rw !x
|
||||||
|
eeprom 0x0000000000810000 0x0000000000010000 rw !x
|
||||||
|
fuse 0x0000000000820000 0x0000000000000400 rw !x
|
||||||
|
lock 0x0000000000830000 0x0000000000000400 rw !x
|
||||||
|
signature 0x0000000000840000 0x0000000000000400 rw !x
|
||||||
|
*default* 0x0000000000000000 0xffffffffffffffff
|
||||||
|
|
||||||
|
Linker script and memory map
|
||||||
|
|
||||||
|
LOAD /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
LOAD src/main.o
|
||||||
|
LOAD src/adc.o
|
||||||
|
LOAD src/utils.o
|
||||||
|
LOAD src/uart.o
|
||||||
|
LOAD /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a
|
||||||
|
LOAD /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/libc.a
|
||||||
|
LOAD /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a
|
||||||
|
|
||||||
|
.hash
|
||||||
|
*(.hash)
|
||||||
|
|
||||||
|
.dynsym
|
||||||
|
*(.dynsym)
|
||||||
|
|
||||||
|
.dynstr
|
||||||
|
*(.dynstr)
|
||||||
|
|
||||||
|
.gnu.version
|
||||||
|
*(.gnu.version)
|
||||||
|
|
||||||
|
.gnu.version_d
|
||||||
|
*(.gnu.version_d)
|
||||||
|
|
||||||
|
.gnu.version_r
|
||||||
|
*(.gnu.version_r)
|
||||||
|
|
||||||
|
.rel.init
|
||||||
|
*(.rel.init)
|
||||||
|
|
||||||
|
.rela.init
|
||||||
|
*(.rela.init)
|
||||||
|
|
||||||
|
.rel.text
|
||||||
|
*(.rel.text)
|
||||||
|
*(.rel.text.*)
|
||||||
|
*(.rel.gnu.linkonce.t*)
|
||||||
|
|
||||||
|
.rela.text
|
||||||
|
*(.rela.text)
|
||||||
|
*(.rela.text.*)
|
||||||
|
*(.rela.gnu.linkonce.t*)
|
||||||
|
|
||||||
|
.rel.fini
|
||||||
|
*(.rel.fini)
|
||||||
|
|
||||||
|
.rela.fini
|
||||||
|
*(.rela.fini)
|
||||||
|
|
||||||
|
.rel.rodata
|
||||||
|
*(.rel.rodata)
|
||||||
|
*(.rel.rodata.*)
|
||||||
|
*(.rel.gnu.linkonce.r*)
|
||||||
|
|
||||||
|
.rela.rodata
|
||||||
|
*(.rela.rodata)
|
||||||
|
*(.rela.rodata.*)
|
||||||
|
*(.rela.gnu.linkonce.r*)
|
||||||
|
|
||||||
|
.rel.data
|
||||||
|
*(.rel.data)
|
||||||
|
*(.rel.data.*)
|
||||||
|
*(.rel.gnu.linkonce.d*)
|
||||||
|
|
||||||
|
.rela.data
|
||||||
|
*(.rela.data)
|
||||||
|
*(.rela.data.*)
|
||||||
|
*(.rela.gnu.linkonce.d*)
|
||||||
|
|
||||||
|
.rel.ctors
|
||||||
|
*(.rel.ctors)
|
||||||
|
|
||||||
|
.rela.ctors
|
||||||
|
*(.rela.ctors)
|
||||||
|
|
||||||
|
.rel.dtors
|
||||||
|
*(.rel.dtors)
|
||||||
|
|
||||||
|
.rela.dtors
|
||||||
|
*(.rela.dtors)
|
||||||
|
|
||||||
|
.rel.got
|
||||||
|
*(.rel.got)
|
||||||
|
|
||||||
|
.rela.got
|
||||||
|
*(.rela.got)
|
||||||
|
|
||||||
|
.rel.bss
|
||||||
|
*(.rel.bss)
|
||||||
|
|
||||||
|
.rela.bss
|
||||||
|
*(.rela.bss)
|
||||||
|
|
||||||
|
.rel.plt
|
||||||
|
*(.rel.plt)
|
||||||
|
|
||||||
|
.rela.plt
|
||||||
|
*(.rela.plt)
|
||||||
|
|
||||||
|
.text 0x0000000000000000 0x73a
|
||||||
|
*(.vectors)
|
||||||
|
.vectors 0x0000000000000000 0x26 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
0x0000000000000000 __vectors
|
||||||
|
0x0000000000000000 __vector_default
|
||||||
|
*(.vectors)
|
||||||
|
*(.progmem.gcc*)
|
||||||
|
*(.progmem*)
|
||||||
|
.progmem.data 0x0000000000000026 0x63 src/main.o
|
||||||
|
0x000000000000008a . = ALIGN (0x2)
|
||||||
|
*fill* 0x0000000000000089 0x1 00
|
||||||
|
0x000000000000008a __trampolines_start = .
|
||||||
|
*(.trampolines)
|
||||||
|
.trampolines 0x000000000000008a 0x0 linker stubs
|
||||||
|
*(.trampolines*)
|
||||||
|
0x000000000000008a __trampolines_end = .
|
||||||
|
*(.jumptables)
|
||||||
|
*(.jumptables*)
|
||||||
|
*(.lowtext)
|
||||||
|
*(.lowtext*)
|
||||||
|
0x000000000000008a __ctors_start = .
|
||||||
|
*(.ctors)
|
||||||
|
0x000000000000008a __ctors_end = .
|
||||||
|
0x000000000000008a __dtors_start = .
|
||||||
|
*(.dtors)
|
||||||
|
0x000000000000008a __dtors_end = .
|
||||||
|
SORT(*)(.ctors)
|
||||||
|
SORT(*)(.dtors)
|
||||||
|
*(.init0)
|
||||||
|
.init0 0x000000000000008a 0x0 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
0x000000000000008a __init
|
||||||
|
*(.init0)
|
||||||
|
*(.init1)
|
||||||
|
*(.init1)
|
||||||
|
*(.init2)
|
||||||
|
.init2 0x000000000000008a 0xc /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
*(.init2)
|
||||||
|
*(.init3)
|
||||||
|
*(.init3)
|
||||||
|
*(.init4)
|
||||||
|
.init4 0x0000000000000096 0x10 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_clear_bss.o)
|
||||||
|
0x0000000000000096 __do_clear_bss
|
||||||
|
*(.init4)
|
||||||
|
*(.init5)
|
||||||
|
*(.init5)
|
||||||
|
*(.init6)
|
||||||
|
*(.init6)
|
||||||
|
*(.init7)
|
||||||
|
*(.init7)
|
||||||
|
*(.init8)
|
||||||
|
*(.init8)
|
||||||
|
*(.init9)
|
||||||
|
.init9 0x00000000000000a6 0x4 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
*(.init9)
|
||||||
|
*(.text)
|
||||||
|
.text 0x00000000000000aa 0x2 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
0x00000000000000aa __vector_1
|
||||||
|
0x00000000000000aa __bad_interrupt
|
||||||
|
0x00000000000000aa __vector_3
|
||||||
|
0x00000000000000aa __vector_13
|
||||||
|
0x00000000000000aa __vector_17
|
||||||
|
0x00000000000000aa __vector_7
|
||||||
|
0x00000000000000aa __vector_5
|
||||||
|
0x00000000000000aa __vector_4
|
||||||
|
0x00000000000000aa __vector_9
|
||||||
|
0x00000000000000aa __vector_2
|
||||||
|
0x00000000000000aa __vector_15
|
||||||
|
0x00000000000000aa __vector_8
|
||||||
|
0x00000000000000aa __vector_14
|
||||||
|
0x00000000000000aa __vector_10
|
||||||
|
0x00000000000000aa __vector_16
|
||||||
|
0x00000000000000aa __vector_18
|
||||||
|
.text 0x00000000000000ac 0x262 src/main.o
|
||||||
|
0x00000000000000ac measure
|
||||||
|
0x0000000000000128 get_power
|
||||||
|
0x000000000000015a pretty_print_all_values
|
||||||
|
0x00000000000001f8 handle_over_and_undervoltage
|
||||||
|
0x0000000000000290 __vector_6
|
||||||
|
.text 0x000000000000030e 0x6e src/adc.o
|
||||||
|
0x000000000000030e adc_init
|
||||||
|
0x0000000000000324 adc_read_single
|
||||||
|
0x000000000000033c adc_read_avg
|
||||||
|
.text 0x000000000000037c 0x112 src/utils.o
|
||||||
|
0x000000000000037c wait
|
||||||
|
0x0000000000000398 uart_print_voltage
|
||||||
|
0x00000000000003e6 uart_print_uint8
|
||||||
|
0x0000000000000424 uart_print_uint16
|
||||||
|
.text 0x000000000000048e 0x150 src/uart.o
|
||||||
|
0x000000000000048e __vector_11
|
||||||
|
0x00000000000004e6 __vector_12
|
||||||
|
0x0000000000000530 uart_init
|
||||||
|
0x0000000000000558 uart_getc
|
||||||
|
0x000000000000058c uart_putc
|
||||||
|
0x00000000000005ae uart_puts
|
||||||
|
0x00000000000005c4 uart_puts_p
|
||||||
|
.text 0x00000000000005de 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodqi4.o)
|
||||||
|
.text 0x00000000000005de 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodhi4.o)
|
||||||
|
.text 0x00000000000005de 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_divmodhi4.o)
|
||||||
|
.text 0x00000000000005de 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_exit.o)
|
||||||
|
.text 0x00000000000005de 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_clear_bss.o)
|
||||||
|
0x00000000000005de . = ALIGN (0x2)
|
||||||
|
*(.text.*)
|
||||||
|
.text.startup 0x00000000000005de 0xf2 src/main.o
|
||||||
|
0x00000000000005de main
|
||||||
|
.text.libgcc.mul
|
||||||
|
0x00000000000006d0 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodqi4.o)
|
||||||
|
.text.libgcc.div
|
||||||
|
0x00000000000006d0 0x18 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodqi4.o)
|
||||||
|
0x00000000000006d0 __udivmodqi4
|
||||||
|
.text.libgcc 0x00000000000006e8 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodqi4.o)
|
||||||
|
.text.libgcc.prologue
|
||||||
|
0x00000000000006e8 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodqi4.o)
|
||||||
|
.text.libgcc.builtins
|
||||||
|
0x00000000000006e8 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodqi4.o)
|
||||||
|
.text.libgcc.fmul
|
||||||
|
0x00000000000006e8 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodqi4.o)
|
||||||
|
.text.libgcc.mul
|
||||||
|
0x00000000000006e8 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodhi4.o)
|
||||||
|
.text.libgcc.div
|
||||||
|
0x00000000000006e8 0x28 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodhi4.o)
|
||||||
|
0x00000000000006e8 __udivmodhi4
|
||||||
|
.text.libgcc 0x0000000000000710 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodhi4.o)
|
||||||
|
.text.libgcc.prologue
|
||||||
|
0x0000000000000710 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodhi4.o)
|
||||||
|
.text.libgcc.builtins
|
||||||
|
0x0000000000000710 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodhi4.o)
|
||||||
|
.text.libgcc.fmul
|
||||||
|
0x0000000000000710 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodhi4.o)
|
||||||
|
.text.libgcc.mul
|
||||||
|
0x0000000000000710 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_divmodhi4.o)
|
||||||
|
.text.libgcc.div
|
||||||
|
0x0000000000000710 0x26 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_divmodhi4.o)
|
||||||
|
0x0000000000000710 __divmodhi4
|
||||||
|
0x0000000000000710 _div
|
||||||
|
.text.libgcc 0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_divmodhi4.o)
|
||||||
|
.text.libgcc.prologue
|
||||||
|
0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_divmodhi4.o)
|
||||||
|
.text.libgcc.builtins
|
||||||
|
0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_divmodhi4.o)
|
||||||
|
.text.libgcc.fmul
|
||||||
|
0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_divmodhi4.o)
|
||||||
|
.text.libgcc.mul
|
||||||
|
0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_exit.o)
|
||||||
|
.text.libgcc.div
|
||||||
|
0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_exit.o)
|
||||||
|
.text.libgcc 0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_exit.o)
|
||||||
|
.text.libgcc.prologue
|
||||||
|
0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_exit.o)
|
||||||
|
.text.libgcc.builtins
|
||||||
|
0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_exit.o)
|
||||||
|
.text.libgcc.fmul
|
||||||
|
0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_exit.o)
|
||||||
|
.text.libgcc.mul
|
||||||
|
0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_clear_bss.o)
|
||||||
|
.text.libgcc.div
|
||||||
|
0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_clear_bss.o)
|
||||||
|
.text.libgcc 0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_clear_bss.o)
|
||||||
|
.text.libgcc.prologue
|
||||||
|
0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_clear_bss.o)
|
||||||
|
.text.libgcc.builtins
|
||||||
|
0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_clear_bss.o)
|
||||||
|
.text.libgcc.fmul
|
||||||
|
0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_clear_bss.o)
|
||||||
|
0x0000000000000736 . = ALIGN (0x2)
|
||||||
|
*(.fini9)
|
||||||
|
.fini9 0x0000000000000736 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_exit.o)
|
||||||
|
0x0000000000000736 exit
|
||||||
|
0x0000000000000736 _exit
|
||||||
|
*(.fini9)
|
||||||
|
*(.fini8)
|
||||||
|
*(.fini8)
|
||||||
|
*(.fini7)
|
||||||
|
*(.fini7)
|
||||||
|
*(.fini6)
|
||||||
|
*(.fini6)
|
||||||
|
*(.fini5)
|
||||||
|
*(.fini5)
|
||||||
|
*(.fini4)
|
||||||
|
*(.fini4)
|
||||||
|
*(.fini3)
|
||||||
|
*(.fini3)
|
||||||
|
*(.fini2)
|
||||||
|
*(.fini2)
|
||||||
|
*(.fini1)
|
||||||
|
*(.fini1)
|
||||||
|
*(.fini0)
|
||||||
|
.fini0 0x0000000000000736 0x4 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_exit.o)
|
||||||
|
*(.fini0)
|
||||||
|
0x000000000000073a _etext = .
|
||||||
|
|
||||||
|
.data 0x0000000000800060 0x0 load address 0x000000000000073a
|
||||||
|
0x0000000000800060 PROVIDE (__data_start, .)
|
||||||
|
*(.data)
|
||||||
|
.data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
.data 0x0000000000800060 0x0 src/main.o
|
||||||
|
.data 0x0000000000800060 0x0 src/adc.o
|
||||||
|
.data 0x0000000000800060 0x0 src/utils.o
|
||||||
|
.data 0x0000000000800060 0x0 src/uart.o
|
||||||
|
.data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodqi4.o)
|
||||||
|
.data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodhi4.o)
|
||||||
|
.data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_divmodhi4.o)
|
||||||
|
.data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_exit.o)
|
||||||
|
.data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_clear_bss.o)
|
||||||
|
*(.data*)
|
||||||
|
*(.rodata)
|
||||||
|
*(.rodata*)
|
||||||
|
*(.gnu.linkonce.d*)
|
||||||
|
0x0000000000800060 . = ALIGN (0x2)
|
||||||
|
0x0000000000800060 _edata = .
|
||||||
|
0x0000000000800060 PROVIDE (__data_end, .)
|
||||||
|
|
||||||
|
.bss 0x0000000000800060 0x55
|
||||||
|
0x0000000000800060 PROVIDE (__bss_start, .)
|
||||||
|
*(.bss)
|
||||||
|
.bss 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
.bss 0x0000000000800060 0x10 src/main.o
|
||||||
|
0x0000000000800060 generator_off_counter
|
||||||
|
0x0000000000800061 generator_counter
|
||||||
|
0x0000000000800062 undervoltage_off_counter
|
||||||
|
0x0000000000800063 undervoltage_counter
|
||||||
|
0x0000000000800064 overvoltage_off_counter
|
||||||
|
0x0000000000800065 overvoltage_counter
|
||||||
|
0x0000000000800066 current_in
|
||||||
|
0x0000000000800068 voltage_gen
|
||||||
|
0x000000000080006a voltage_bat
|
||||||
|
0x000000000080006c syscounter
|
||||||
|
.bss 0x0000000000800070 0x0 src/adc.o
|
||||||
|
.bss 0x0000000000800070 0x0 src/utils.o
|
||||||
|
.bss 0x0000000000800070 0x45 src/uart.o
|
||||||
|
.bss 0x00000000008000b5 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodqi4.o)
|
||||||
|
.bss 0x00000000008000b5 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodhi4.o)
|
||||||
|
.bss 0x00000000008000b5 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_divmodhi4.o)
|
||||||
|
.bss 0x00000000008000b5 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_exit.o)
|
||||||
|
.bss 0x00000000008000b5 0x0 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_clear_bss.o)
|
||||||
|
*(.bss*)
|
||||||
|
*(COMMON)
|
||||||
|
0x00000000008000b5 PROVIDE (__bss_end, .)
|
||||||
|
0x000000000000073a __data_load_start = LOADADDR (.data)
|
||||||
|
0x000000000000073a __data_load_end = (__data_load_start + SIZEOF (.data))
|
||||||
|
|
||||||
|
.noinit 0x00000000008000b5 0x0
|
||||||
|
0x00000000008000b5 PROVIDE (__noinit_start, .)
|
||||||
|
*(.noinit*)
|
||||||
|
0x00000000008000b5 PROVIDE (__noinit_end, .)
|
||||||
|
0x00000000008000b5 _end = .
|
||||||
|
0x00000000008000b5 PROVIDE (__heap_start, .)
|
||||||
|
|
||||||
|
.eeprom 0x0000000000810000 0x0
|
||||||
|
*(.eeprom*)
|
||||||
|
0x0000000000810000 __eeprom_end = .
|
||||||
|
|
||||||
|
.fuse
|
||||||
|
*(.fuse)
|
||||||
|
*(.lfuse)
|
||||||
|
*(.hfuse)
|
||||||
|
*(.efuse)
|
||||||
|
|
||||||
|
.lock
|
||||||
|
*(.lock*)
|
||||||
|
|
||||||
|
.signature
|
||||||
|
*(.signature*)
|
||||||
|
|
||||||
|
.stab 0x0000000000000000 0x6cc
|
||||||
|
*(.stab)
|
||||||
|
.stab 0x0000000000000000 0x6cc /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
|
||||||
|
.stabstr 0x0000000000000000 0x54
|
||||||
|
*(.stabstr)
|
||||||
|
.stabstr 0x0000000000000000 0x54 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
|
||||||
|
.stab.excl
|
||||||
|
*(.stab.excl)
|
||||||
|
|
||||||
|
.stab.exclstr
|
||||||
|
*(.stab.exclstr)
|
||||||
|
|
||||||
|
.stab.index
|
||||||
|
*(.stab.index)
|
||||||
|
|
||||||
|
.stab.indexstr
|
||||||
|
*(.stab.indexstr)
|
||||||
|
|
||||||
|
.comment 0x0000000000000000 0x11
|
||||||
|
*(.comment)
|
||||||
|
.comment 0x0000000000000000 0x11 src/main.o
|
||||||
|
0x12 (size before relaxing)
|
||||||
|
.comment 0x0000000000000000 0x12 src/adc.o
|
||||||
|
.comment 0x0000000000000000 0x12 src/utils.o
|
||||||
|
.comment 0x0000000000000000 0x12 src/uart.o
|
||||||
|
|
||||||
|
.debug
|
||||||
|
*(.debug)
|
||||||
|
|
||||||
|
.line
|
||||||
|
*(.line)
|
||||||
|
|
||||||
|
.debug_srcinfo
|
||||||
|
*(.debug_srcinfo)
|
||||||
|
|
||||||
|
.debug_sfnames
|
||||||
|
*(.debug_sfnames)
|
||||||
|
|
||||||
|
.debug_aranges
|
||||||
|
*(.debug_aranges)
|
||||||
|
|
||||||
|
.debug_pubnames
|
||||||
|
*(.debug_pubnames)
|
||||||
|
|
||||||
|
.debug_info
|
||||||
|
*(.debug_info)
|
||||||
|
*(.gnu.linkonce.wi.*)
|
||||||
|
|
||||||
|
.debug_abbrev
|
||||||
|
*(.debug_abbrev)
|
||||||
|
|
||||||
|
.debug_line
|
||||||
|
*(.debug_line)
|
||||||
|
|
||||||
|
.debug_frame
|
||||||
|
*(.debug_frame)
|
||||||
|
|
||||||
|
.debug_str
|
||||||
|
*(.debug_str)
|
||||||
|
|
||||||
|
.debug_loc
|
||||||
|
*(.debug_loc)
|
||||||
|
|
||||||
|
.debug_macinfo
|
||||||
|
*(.debug_macinfo)
|
||||||
|
OUTPUT(main.elf elf32-avr)
|
||||||
|
LOAD linker stubs
|
||||||
|
|
||||||
|
Cross Reference Table
|
||||||
|
|
||||||
|
Symbol File
|
||||||
|
__bad_interrupt /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__bss_end /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_clear_bss.o)
|
||||||
|
__bss_start /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_clear_bss.o)
|
||||||
|
__divmodhi4 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_divmodhi4.o)
|
||||||
|
src/main.o
|
||||||
|
__do_clear_bss /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_clear_bss.o)
|
||||||
|
src/uart.o
|
||||||
|
src/main.o
|
||||||
|
__heap_end /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__init /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__stack /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__udivmodhi4 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodhi4.o)
|
||||||
|
/usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_divmodhi4.o)
|
||||||
|
src/utils.o
|
||||||
|
src/adc.o
|
||||||
|
src/main.o
|
||||||
|
__udivmodqi4 /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_udivmodqi4.o)
|
||||||
|
src/utils.o
|
||||||
|
src/adc.o
|
||||||
|
__vector_1 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_10 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_11 src/uart.o
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_12 src/uart.o
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_13 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_14 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_15 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_16 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_17 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_18 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_2 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_3 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_4 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_5 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_6 src/main.o
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_7 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_8 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_9 /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vector_default /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
__vectors /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
_div /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_divmodhi4.o)
|
||||||
|
_exit /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_exit.o)
|
||||||
|
adc_init src/adc.o
|
||||||
|
src/main.o
|
||||||
|
adc_read_avg src/adc.o
|
||||||
|
src/main.o
|
||||||
|
adc_read_single src/adc.o
|
||||||
|
current_in src/main.o
|
||||||
|
exit /usr/lib/gcc/avr/4.7.2/avr4/libgcc.a(_exit.o)
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
generator_counter src/main.o
|
||||||
|
generator_off_counter src/main.o
|
||||||
|
get_power src/main.o
|
||||||
|
handle_over_and_undervoltage src/main.o
|
||||||
|
main src/main.o
|
||||||
|
/usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr4/crtm8.o
|
||||||
|
measure src/main.o
|
||||||
|
overvoltage_counter src/main.o
|
||||||
|
overvoltage_off_counter src/main.o
|
||||||
|
pretty_print_all_values src/main.o
|
||||||
|
syscounter src/main.o
|
||||||
|
uart_getc src/uart.o
|
||||||
|
src/main.o
|
||||||
|
uart_init src/uart.o
|
||||||
|
src/main.o
|
||||||
|
uart_print_uint16 src/utils.o
|
||||||
|
src/main.o
|
||||||
|
uart_print_uint8 src/utils.o
|
||||||
|
uart_print_voltage src/utils.o
|
||||||
|
uart_putc src/uart.o
|
||||||
|
src/utils.o
|
||||||
|
src/main.o
|
||||||
|
uart_puts src/uart.o
|
||||||
|
uart_puts_p src/uart.o
|
||||||
|
src/main.o
|
||||||
|
undervoltage_counter src/main.o
|
||||||
|
undervoltage_off_counter src/main.o
|
||||||
|
voltage_bat src/main.o
|
||||||
|
voltage_gen src/main.o
|
||||||
|
wait src/utils.o
|
|
@ -0,0 +1,119 @@
|
||||||
|
00000000 W __heap_end
|
||||||
|
00000000 a __tmp_reg__
|
||||||
|
00000000 a __tmp_reg__
|
||||||
|
00000000 a __tmp_reg__
|
||||||
|
00000000 a __tmp_reg__
|
||||||
|
00000000 W __vector_default
|
||||||
|
00000000 T __vectors
|
||||||
|
00000001 a __zero_reg__
|
||||||
|
00000001 a __zero_reg__
|
||||||
|
00000001 a __zero_reg__
|
||||||
|
00000001 a __zero_reg__
|
||||||
|
00000026 t __c.1594
|
||||||
|
0000003a t __c.1596
|
||||||
|
0000003d a __SP_L__
|
||||||
|
0000003d a __SP_L__
|
||||||
|
0000003d a __SP_L__
|
||||||
|
0000003d a __SP_L__
|
||||||
|
0000003e a __SP_H__
|
||||||
|
0000003e a __SP_H__
|
||||||
|
0000003e a __SP_H__
|
||||||
|
0000003e a __SP_H__
|
||||||
|
0000003f a __SREG__
|
||||||
|
0000003f a __SREG__
|
||||||
|
0000003f a __SREG__
|
||||||
|
0000003f a __SREG__
|
||||||
|
0000003f t __c.1598
|
||||||
|
00000055 t __c.1600
|
||||||
|
0000005a t __c.1602
|
||||||
|
00000066 t __c.1604
|
||||||
|
0000006b t __c.1606
|
||||||
|
0000006f t __c.1608
|
||||||
|
00000086 t __c.1610
|
||||||
|
0000008a T __ctors_end
|
||||||
|
0000008a T __ctors_start
|
||||||
|
0000008a T __dtors_end
|
||||||
|
0000008a T __dtors_start
|
||||||
|
0000008a W __init
|
||||||
|
0000008a T __trampolines_end
|
||||||
|
0000008a T __trampolines_start
|
||||||
|
00000096 T __do_clear_bss
|
||||||
|
0000009e t .do_clear_bss_loop
|
||||||
|
000000a0 t .do_clear_bss_start
|
||||||
|
000000aa T __bad_interrupt
|
||||||
|
000000aa W __vector_1
|
||||||
|
000000aa W __vector_10
|
||||||
|
000000aa W __vector_13
|
||||||
|
000000aa W __vector_14
|
||||||
|
000000aa W __vector_15
|
||||||
|
000000aa W __vector_16
|
||||||
|
000000aa W __vector_17
|
||||||
|
000000aa W __vector_18
|
||||||
|
000000aa W __vector_2
|
||||||
|
000000aa W __vector_3
|
||||||
|
000000aa W __vector_4
|
||||||
|
000000aa W __vector_5
|
||||||
|
000000aa W __vector_7
|
||||||
|
000000aa W __vector_8
|
||||||
|
000000aa W __vector_9
|
||||||
|
000000ac T measure
|
||||||
|
00000128 T get_power
|
||||||
|
0000015a T pretty_print_all_values
|
||||||
|
000001f8 T handle_over_and_undervoltage
|
||||||
|
00000292 T __vector_6
|
||||||
|
00000310 T adc_init
|
||||||
|
00000326 T adc_read_single
|
||||||
|
0000033e T adc_read_avg
|
||||||
|
0000037e T wait
|
||||||
|
0000039a T uart_print_voltage
|
||||||
|
000003e8 T uart_print_uint8
|
||||||
|
00000426 T uart_print_uint16
|
||||||
|
0000045f W __stack
|
||||||
|
00000490 T __vector_11
|
||||||
|
000004e8 T __vector_12
|
||||||
|
00000532 T uart_init
|
||||||
|
0000055a T uart_getc
|
||||||
|
0000058e T uart_putc
|
||||||
|
000005b0 T uart_puts
|
||||||
|
000005c6 T uart_puts_p
|
||||||
|
000005e0 T main
|
||||||
|
000006d2 T __udivmodqi4
|
||||||
|
000006d8 t __udivmodqi4_loop
|
||||||
|
000006e0 t __udivmodqi4_ep
|
||||||
|
000006ea T __udivmodhi4
|
||||||
|
000006f2 t __udivmodhi4_loop
|
||||||
|
00000700 t __udivmodhi4_ep
|
||||||
|
00000712 T __divmodhi4
|
||||||
|
00000712 T _div
|
||||||
|
00000728 t __divmodhi4_neg1
|
||||||
|
00000730 t __divmodhi4_neg2
|
||||||
|
00000736 t __divmodhi4_exit
|
||||||
|
00000738 T _exit
|
||||||
|
00000738 W exit
|
||||||
|
0000073a t __stop_program
|
||||||
|
0000073c A __data_load_end
|
||||||
|
0000073c A __data_load_start
|
||||||
|
0000073c T _etext
|
||||||
|
00800060 B __bss_start
|
||||||
|
00800060 T _edata
|
||||||
|
00800060 B generator_off_counter
|
||||||
|
00800061 B generator_counter
|
||||||
|
00800062 B undervoltage_off_counter
|
||||||
|
00800063 B undervoltage_counter
|
||||||
|
00800064 B overvoltage_off_counter
|
||||||
|
00800065 B overvoltage_counter
|
||||||
|
00800066 B current_in
|
||||||
|
00800068 B voltage_gen
|
||||||
|
0080006a B voltage_bat
|
||||||
|
0080006c B syscounter
|
||||||
|
0080006e b temp.1586
|
||||||
|
00800070 b UART_LastRxError
|
||||||
|
00800071 b UART_RxTail
|
||||||
|
00800072 b UART_RxHead
|
||||||
|
00800073 b UART_TxTail
|
||||||
|
00800074 b UART_TxHead
|
||||||
|
00800075 b UART_RxBuf
|
||||||
|
00800095 b UART_TxBuf
|
||||||
|
008000b5 B __bss_end
|
||||||
|
008000b5 N _end
|
||||||
|
00810000 N __eeprom_end
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="C++" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="jdk" jdkName="Cpp SDK" jdkType="CppSdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
#include <avr/io.h>
|
||||||
|
|
||||||
|
|
||||||
|
void adc_init(void) {
|
||||||
|
uint16_t dummyResult;
|
||||||
|
// AVCC with external capacitor at AREF pin
|
||||||
|
ADMUX = _BV(REFS0);
|
||||||
|
|
||||||
|
// set frequency prescaler to 8
|
||||||
|
ADCSRA = _BV(ADPS1) | _BV(ADPS0);
|
||||||
|
|
||||||
|
// enable ADC
|
||||||
|
ADCSRA |= _BV(ADEN);
|
||||||
|
|
||||||
|
// make a dummy read out
|
||||||
|
ADCSRA |= _BV(ADSC);
|
||||||
|
while (ADCSRA & _BV(ADSC) ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// we have to read, otherwise the next result is not available
|
||||||
|
dummyResult = ADCW;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t adc_read_single(uint8_t channel) {
|
||||||
|
ADMUX = (ADMUX & ~(0x1F)) | (channel & 0x1F);
|
||||||
|
ADCSRA |= _BV(ADSC);
|
||||||
|
while (ADCSRA & (1<<ADSC) ) {
|
||||||
|
}
|
||||||
|
return ADCW;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t adc_read_avg(const uint8_t channel, const uint8_t nsamples) {
|
||||||
|
uint16_t sum = 0;
|
||||||
|
uint8_t count = nsamples % 60;
|
||||||
|
|
||||||
|
for (uint8_t i=0; i<count;++i ) {
|
||||||
|
sum += adc_read_single(channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (sum / count);
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef _adc_h
|
||||||
|
#define _adc_h
|
||||||
|
|
||||||
|
extern void adc_init(void);
|
||||||
|
extern uint16_t adc_read_single(uint8_t);
|
||||||
|
extern uint16_t adc_read_avg(uint8_t, uint8_t);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,100 @@
|
||||||
|
1 .file "adc.c"
|
||||||
|
2 __SP_H__ = 0x3e
|
||||||
|
3 __SP_L__ = 0x3d
|
||||||
|
4 __SREG__ = 0x3f
|
||||||
|
5 __tmp_reg__ = 0
|
||||||
|
6 __zero_reg__ = 1
|
||||||
|
7 .text
|
||||||
|
8 .global adc_init
|
||||||
|
10 adc_init:
|
||||||
|
11 /* prologue: function */
|
||||||
|
12 /* frame size = 0 */
|
||||||
|
13 /* stack size = 0 */
|
||||||
|
14 .L__stack_usage = 0
|
||||||
|
15 0000 80E4 ldi r24,lo8(64)
|
||||||
|
16 0002 87B9 out 0x7,r24
|
||||||
|
17 0004 83E0 ldi r24,lo8(3)
|
||||||
|
18 0006 86B9 out 0x6,r24
|
||||||
|
19 0008 379A sbi 0x6,7
|
||||||
|
20 000a 369A sbi 0x6,6
|
||||||
|
21 .L2:
|
||||||
|
22 000c 3699 sbic 0x6,6
|
||||||
|
23 000e 00C0 rjmp .L2
|
||||||
|
24 0010 84B1 in r24,0x4
|
||||||
|
25 0012 95B1 in r25,0x4+1
|
||||||
|
26 0014 0895 ret
|
||||||
|
28 .global adc_read_single
|
||||||
|
30 adc_read_single:
|
||||||
|
31 /* prologue: function */
|
||||||
|
32 /* frame size = 0 */
|
||||||
|
33 /* stack size = 0 */
|
||||||
|
34 .L__stack_usage = 0
|
||||||
|
35 0016 97B1 in r25,0x7
|
||||||
|
36 0018 8F71 andi r24,lo8(31)
|
||||||
|
37 001a 907E andi r25,lo8(-32)
|
||||||
|
38 001c 892B or r24,r25
|
||||||
|
39 001e 87B9 out 0x7,r24
|
||||||
|
40 0020 369A sbi 0x6,6
|
||||||
|
41 .L5:
|
||||||
|
42 0022 3699 sbic 0x6,6
|
||||||
|
43 0024 00C0 rjmp .L5
|
||||||
|
44 0026 24B1 in r18,0x4
|
||||||
|
45 0028 35B1 in r19,0x4+1
|
||||||
|
46 002a C901 movw r24,r18
|
||||||
|
47 002c 0895 ret
|
||||||
|
49 .global adc_read_avg
|
||||||
|
51 adc_read_avg:
|
||||||
|
52 002e FF92 push r15
|
||||||
|
53 0030 0F93 push r16
|
||||||
|
54 0032 1F93 push r17
|
||||||
|
55 0034 CF93 push r28
|
||||||
|
56 0036 DF93 push r29
|
||||||
|
57 /* prologue: function */
|
||||||
|
58 /* frame size = 0 */
|
||||||
|
59 /* stack size = 5 */
|
||||||
|
60 .L__stack_usage = 5
|
||||||
|
61 0038 082F mov r16,r24
|
||||||
|
62 003a 862F mov r24,r22
|
||||||
|
63 003c 6CE3 ldi r22,lo8(60)
|
||||||
|
64 003e 00D0 rcall __udivmodqi4
|
||||||
|
65 0040 F92E mov r15,r25
|
||||||
|
66 0042 10E0 ldi r17,0
|
||||||
|
67 0044 C0E0 ldi r28,0
|
||||||
|
68 0046 D0E0 ldi r29,0
|
||||||
|
69 0048 00C0 rjmp .L8
|
||||||
|
70 .L9:
|
||||||
|
71 004a 802F mov r24,r16
|
||||||
|
72 004c 00D0 rcall adc_read_single
|
||||||
|
73 004e C80F add r28,r24
|
||||||
|
74 0050 D91F adc r29,r25
|
||||||
|
75 0052 1F5F subi r17,lo8(-(1))
|
||||||
|
76 .L8:
|
||||||
|
77 0054 1F11 cpse r17,r15
|
||||||
|
78 0056 00C0 rjmp .L9
|
||||||
|
79 0058 612F mov r22,r17
|
||||||
|
80 005a CE01 movw r24,r28
|
||||||
|
81 005c 70E0 ldi r23,0
|
||||||
|
82 005e 00D0 rcall __udivmodhi4
|
||||||
|
83 0060 CB01 movw r24,r22
|
||||||
|
84 /* epilogue start */
|
||||||
|
85 0062 DF91 pop r29
|
||||||
|
86 0064 CF91 pop r28
|
||||||
|
87 0066 1F91 pop r17
|
||||||
|
88 0068 0F91 pop r16
|
||||||
|
89 006a FF90 pop r15
|
||||||
|
90 006c 0895 ret
|
||||||
|
92 .ident "GCC: (GNU) 4.7.2"
|
||||||
|
DEFINED SYMBOLS
|
||||||
|
*ABS*:0000000000000000 adc.c
|
||||||
|
/tmp/ccEsNr7S.s:2 *ABS*:000000000000003e __SP_H__
|
||||||
|
/tmp/ccEsNr7S.s:3 *ABS*:000000000000003d __SP_L__
|
||||||
|
/tmp/ccEsNr7S.s:4 *ABS*:000000000000003f __SREG__
|
||||||
|
/tmp/ccEsNr7S.s:5 *ABS*:0000000000000000 __tmp_reg__
|
||||||
|
/tmp/ccEsNr7S.s:6 *ABS*:0000000000000001 __zero_reg__
|
||||||
|
/tmp/ccEsNr7S.s:10 .text:0000000000000000 adc_init
|
||||||
|
/tmp/ccEsNr7S.s:30 .text:0000000000000016 adc_read_single
|
||||||
|
/tmp/ccEsNr7S.s:51 .text:000000000000002e adc_read_avg
|
||||||
|
|
||||||
|
UNDEFINED SYMBOLS
|
||||||
|
__udivmodqi4
|
||||||
|
__udivmodhi4
|
Binary file not shown.
|
@ -0,0 +1,204 @@
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#include "utils.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "adc.h"
|
||||||
|
#include "uart.h"
|
||||||
|
|
||||||
|
volatile uint16_t syscounter = 0;
|
||||||
|
uint16_t voltage_bat = 0;
|
||||||
|
uint16_t voltage_gen = 0;
|
||||||
|
uint16_t current_in = 0;
|
||||||
|
|
||||||
|
uint8_t overvoltage_counter = 0;
|
||||||
|
uint8_t overvoltage_off_counter = 0;
|
||||||
|
uint8_t undervoltage_counter = 0;
|
||||||
|
uint8_t undervoltage_off_counter = 0;
|
||||||
|
uint8_t generator_counter = 0;
|
||||||
|
uint8_t generator_off_counter = 0;
|
||||||
|
|
||||||
|
|
||||||
|
static void timer_init(void) {
|
||||||
|
// clock is 8MHz
|
||||||
|
TCCR1B |= _BV(WGM12) | _BV(CS11) | _BV(CS10) ; // CTC Mode for Timer 1 (16Bit) with prescale of 64
|
||||||
|
OCR1A = 1250; // 100Hz
|
||||||
|
TIMSK = _BV(OCIE1A);
|
||||||
|
sei(); // enable interrupts
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ports_init(void) {
|
||||||
|
DDR_SW |= _BV(LOADSW) | _BV(GENSW);
|
||||||
|
PORT_SW &= ~(_BV(LOADSW) | _BV(GENSW));
|
||||||
|
}
|
||||||
|
|
||||||
|
void measure(void) {
|
||||||
|
|
||||||
|
static int16_t temp;
|
||||||
|
|
||||||
|
voltage_bat = adc_read_avg(AD_V_BAT, 4);
|
||||||
|
voltage_bat *= VOLTAGE_PER_TICK;
|
||||||
|
voltage_bat += 790;
|
||||||
|
|
||||||
|
voltage_gen = adc_read_avg(AD_V_GEN, 4);
|
||||||
|
voltage_gen *= VOLTAGE_PER_TICK;
|
||||||
|
|
||||||
|
temp = adc_read_avg(AD_I_GEN, 4);
|
||||||
|
temp -= CURRENT_OFFSET;
|
||||||
|
if(temp < 0) temp = 0;
|
||||||
|
current_in = temp * CURRENT_PER_TICK;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t get_power(uint16_t voltage, int16_t currents) {
|
||||||
|
return (voltage/100 * (currents/100)) / 100 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pretty_print_all_values(void) {
|
||||||
|
uart_puts_P("Battery Voltage: ");
|
||||||
|
uart_print_uint16(voltage_bat);
|
||||||
|
uart_puts_P("mV\r\n");
|
||||||
|
|
||||||
|
uart_puts_P("Generator Voltage: ");
|
||||||
|
uart_print_uint16(voltage_gen);
|
||||||
|
uart_puts_P("mV\r\n");
|
||||||
|
|
||||||
|
uart_puts_P("Generator: ");
|
||||||
|
uart_print_uint16(current_in);
|
||||||
|
uart_puts_P("mA ");
|
||||||
|
uart_print_uint16(get_power(voltage_bat, current_in));
|
||||||
|
uart_puts_P("W\r\n");
|
||||||
|
|
||||||
|
uart_puts_P("switches (load, gen): ");
|
||||||
|
uart_putc(48 + (IS_LOAD_ON >> LOADSW));
|
||||||
|
uart_putc(',');
|
||||||
|
uart_putc(48 + (IS_GEN_ON >> GENSW));
|
||||||
|
uart_puts_P("\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void handle_over_and_undervoltage(void) {
|
||||||
|
|
||||||
|
if(voltage_bat < UNDERVOLTAGE) {
|
||||||
|
undervoltage_off_counter = 0;
|
||||||
|
if(undervoltage_counter<UNDERVOLTAGE_TIMEOUT) undervoltage_counter++;
|
||||||
|
} else {
|
||||||
|
undervoltage_counter = 0;
|
||||||
|
if(undervoltage_off_counter<UNDERVOLTAGEOFF_TIMEOUT) undervoltage_off_counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(voltage_gen > GENERATOR) {
|
||||||
|
generator_off_counter = 0;
|
||||||
|
if(generator_counter<GENERATOR_TIMEOUT) generator_counter++;
|
||||||
|
} else {
|
||||||
|
generator_counter = 0;
|
||||||
|
if(generator_off_counter<GENERATOR_OFF_TIMEOUT) generator_off_counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(undervoltage_counter >= UNDERVOLTAGE_TIMEOUT) {
|
||||||
|
// spannung zu niedrig => abschalten
|
||||||
|
undervoltage_off_counter = 0;
|
||||||
|
LOAD_OFF;
|
||||||
|
} else {
|
||||||
|
// spannung ist okay
|
||||||
|
|
||||||
|
// ist die spannung schon lange genug okay?
|
||||||
|
if(undervoltage_off_counter >= UNDERVOLTAGEOFF_TIMEOUT) {
|
||||||
|
undervoltage_counter = 0;
|
||||||
|
|
||||||
|
// ja, also schauen ob der generator schon lange genug läuft
|
||||||
|
if(generator_counter >= GENERATOR_TIMEOUT) {
|
||||||
|
// ja, also einschalten
|
||||||
|
LOAD_ON;
|
||||||
|
} else {
|
||||||
|
// nein, generator nicht lange genug an
|
||||||
|
|
||||||
|
// ist er vielleicht schon lange aus?
|
||||||
|
if(generator_off_counter >= GENERATOR_OFF_TIMEOUT) {
|
||||||
|
// ja, also abschalten, egal ob akku okay
|
||||||
|
LOAD_OFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
uart_puts_P("ov1=");
|
||||||
|
uart_print_uint8(overvoltage_counter1);
|
||||||
|
uart_puts_P(" ovo1=");
|
||||||
|
uart_print_uint8 (overvoltage_off_counter1);
|
||||||
|
uart_puts_P("\r\n");
|
||||||
|
|
||||||
|
uart_puts_P("uv =");
|
||||||
|
uart_print_uint8(undervoltage_counter);
|
||||||
|
uart_puts_P(" uvo =");
|
||||||
|
uart_print_uint8(undervoltage_off_counter);
|
||||||
|
uart_puts_P("\r\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void work_uart(void) {
|
||||||
|
uint16_t uart_char = uart_getc();
|
||||||
|
|
||||||
|
if(uart_char != UART_NO_DATA) {
|
||||||
|
switch(uart_char & 0xff) {
|
||||||
|
case 'p':
|
||||||
|
pretty_print_all_values();
|
||||||
|
break;
|
||||||
|
case 'a':
|
||||||
|
uart_putc('A');
|
||||||
|
uart_print_uint16(voltage_bat);
|
||||||
|
uart_putc(',');
|
||||||
|
uart_print_uint16(current_in);
|
||||||
|
uart_putc(',');
|
||||||
|
uart_print_uint16(0);
|
||||||
|
uart_putc(',');
|
||||||
|
uart_print_uint16(get_power(voltage_bat, current_in));
|
||||||
|
uart_putc(',');
|
||||||
|
uart_print_uint16(0);
|
||||||
|
uart_putc(',');
|
||||||
|
uart_putc(48 + (IS_LOAD_ON >> LOADSW));
|
||||||
|
uart_putc(',');
|
||||||
|
uart_putc(48);
|
||||||
|
uart_putc(',');
|
||||||
|
uart_putc(48 + (IS_GEN_ON >> GENSW));
|
||||||
|
uart_putc('B');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
ports_init();
|
||||||
|
adc_init();
|
||||||
|
timer_init();
|
||||||
|
uart_init(UART_BAUD_SELECT(19200,F_CPU));
|
||||||
|
|
||||||
|
LOAD_OFF;
|
||||||
|
GEN_ON;
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
if(syscounter >= 100) {
|
||||||
|
syscounter = 0;
|
||||||
|
|
||||||
|
measure();
|
||||||
|
|
||||||
|
//pretty_print_all_values();
|
||||||
|
|
||||||
|
handle_over_and_undervoltage();
|
||||||
|
}
|
||||||
|
|
||||||
|
work_uart();
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// system timer
|
||||||
|
SIGNAL(TIMER1_COMPA_vect) {
|
||||||
|
syscounter++;
|
||||||
|
syscounter %= 60000;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
#ifndef _main_h
|
||||||
|
#define _main_h
|
||||||
|
|
||||||
|
#define AD_V_GEN 0
|
||||||
|
#define AD_I_GEN 1
|
||||||
|
#define AD_V_BAT 2
|
||||||
|
|
||||||
|
#define LOADSW PB0
|
||||||
|
#define GENSW PB1
|
||||||
|
#define PORT_SW PORTB
|
||||||
|
#define DDR_SW DDRB
|
||||||
|
#define PIN_SW PINB
|
||||||
|
|
||||||
|
#define LOAD_ON PORT_SW |= _BV(LOADSW)
|
||||||
|
#define LOAD_OFF PORT_SW &= ~_BV(LOADSW)
|
||||||
|
#define GEN_ON PORT_SW |= _BV(GENSW)
|
||||||
|
#define GEN_OFF PORT_SW &= ~_BV(GENSW)
|
||||||
|
|
||||||
|
#define IS_LOAD_ON (PIN_SW & _BV(LOADSW))
|
||||||
|
#define IS_GEN_ON (PIN_SW & _BV(GENSW))
|
||||||
|
|
||||||
|
#define GENERATOR 13000
|
||||||
|
#define GENERATOR_TIMEOUT 3
|
||||||
|
#define GENERATOR_OFF_TIMEOUT 1
|
||||||
|
|
||||||
|
#define UNDERVOLTAGE 11200
|
||||||
|
#define OVERVOLTAGE 15000
|
||||||
|
#define OVERVOLTAGE_TIMEOUT 5
|
||||||
|
#define OVERVOLTAGEOFF_TIMEOUT 3
|
||||||
|
#define UNDERVOLTAGE_TIMEOUT 5
|
||||||
|
#define UNDERVOLTAGEOFF_TIMEOUT 3
|
||||||
|
|
||||||
|
#define CURRENT_OFFSET 511
|
||||||
|
#define CURRENT_PER_TICK 72
|
||||||
|
#define VOLTAGE_PER_TICK 15
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,544 @@
|
||||||
|
1 .file "main.c"
|
||||||
|
2 __SP_H__ = 0x3e
|
||||||
|
3 __SP_L__ = 0x3d
|
||||||
|
4 __SREG__ = 0x3f
|
||||||
|
5 __tmp_reg__ = 0
|
||||||
|
6 __zero_reg__ = 1
|
||||||
|
7 .text
|
||||||
|
8 .global measure
|
||||||
|
10 measure:
|
||||||
|
11 0000 CF93 push r28
|
||||||
|
12 /* prologue: function */
|
||||||
|
13 /* frame size = 0 */
|
||||||
|
14 /* stack size = 1 */
|
||||||
|
15 .L__stack_usage = 1
|
||||||
|
16 0002 64E0 ldi r22,lo8(4)
|
||||||
|
17 0004 82E0 ldi r24,lo8(2)
|
||||||
|
18 0006 00D0 rcall adc_read_avg
|
||||||
|
19 0008 CFE0 ldi r28,lo8(15)
|
||||||
|
20 000a 9C01 movw r18,r24
|
||||||
|
21 000c C29F mul r28,r18
|
||||||
|
22 000e C001 movw r24,r0
|
||||||
|
23 0010 C39F mul r28,r19
|
||||||
|
24 0012 900D add r25,r0
|
||||||
|
25 0014 1124 clr __zero_reg__
|
||||||
|
26 0016 8A5E subi r24,-22
|
||||||
|
27 0018 9C4F sbci r25,-4
|
||||||
|
28 001a 9093 0000 sts voltage_bat+1,r25
|
||||||
|
29 001e 8093 0000 sts voltage_bat,r24
|
||||||
|
30 0022 64E0 ldi r22,lo8(4)
|
||||||
|
31 0024 80E0 ldi r24,0
|
||||||
|
32 0026 00D0 rcall adc_read_avg
|
||||||
|
33 0028 9C01 movw r18,r24
|
||||||
|
34 002a C29F mul r28,r18
|
||||||
|
35 002c C001 movw r24,r0
|
||||||
|
36 002e C39F mul r28,r19
|
||||||
|
37 0030 900D add r25,r0
|
||||||
|
38 0032 1124 clr __zero_reg__
|
||||||
|
39 0034 9093 0000 sts voltage_gen+1,r25
|
||||||
|
40 0038 8093 0000 sts voltage_gen,r24
|
||||||
|
41 003c 64E0 ldi r22,lo8(4)
|
||||||
|
42 003e 81E0 ldi r24,lo8(1)
|
||||||
|
43 0040 00D0 rcall adc_read_avg
|
||||||
|
44 0042 8F5F subi r24,-1
|
||||||
|
45 0044 9140 sbci r25,1
|
||||||
|
46 0046 97FD sbrc r25,7
|
||||||
|
47 0048 00C0 rjmp .L2
|
||||||
|
48 004a 9093 0000 sts temp.1586+1,r25
|
||||||
|
49 004e 8093 0000 sts temp.1586,r24
|
||||||
|
50 0052 00C0 rjmp .L3
|
||||||
|
51 .L2:
|
||||||
|
52 0054 1092 0000 sts temp.1586+1,__zero_reg__
|
||||||
|
53 0058 1092 0000 sts temp.1586,__zero_reg__
|
||||||
|
54 .L3:
|
||||||
|
55 005c 2091 0000 lds r18,temp.1586
|
||||||
|
56 0060 3091 0000 lds r19,temp.1586+1
|
||||||
|
57 0064 48E4 ldi r20,lo8(72)
|
||||||
|
58 0066 429F mul r20,r18
|
||||||
|
59 0068 C001 movw r24,r0
|
||||||
|
60 006a 439F mul r20,r19
|
||||||
|
61 006c 900D add r25,r0
|
||||||
|
62 006e 1124 clr __zero_reg__
|
||||||
|
63 0070 9093 0000 sts current_in+1,r25
|
||||||
|
64 0074 8093 0000 sts current_in,r24
|
||||||
|
65 /* epilogue start */
|
||||||
|
66 0078 CF91 pop r28
|
||||||
|
67 007a 0895 ret
|
||||||
|
69 .global get_power
|
||||||
|
71 get_power:
|
||||||
|
72 007c CF93 push r28
|
||||||
|
73 007e DF93 push r29
|
||||||
|
74 /* prologue: function */
|
||||||
|
75 /* frame size = 0 */
|
||||||
|
76 /* stack size = 2 */
|
||||||
|
77 .L__stack_usage = 2
|
||||||
|
78 0080 EC01 movw r28,r24
|
||||||
|
79 0082 CB01 movw r24,r22
|
||||||
|
80 0084 24E6 ldi r18,lo8(100)
|
||||||
|
81 0086 30E0 ldi r19,0
|
||||||
|
82 0088 B901 movw r22,r18
|
||||||
|
83 008a 00D0 rcall __divmodhi4
|
||||||
|
84 008c FB01 movw r30,r22
|
||||||
|
85 008e CE01 movw r24,r28
|
||||||
|
86 0090 B901 movw r22,r18
|
||||||
|
87 0092 00D0 rcall __udivmodhi4
|
||||||
|
88 0094 E69F mul r30,r22
|
||||||
|
89 0096 C001 movw r24,r0
|
||||||
|
90 0098 E79F mul r30,r23
|
||||||
|
91 009a 900D add r25,r0
|
||||||
|
92 009c F69F mul r31,r22
|
||||||
|
93 009e 900D add r25,r0
|
||||||
|
94 00a0 1124 clr r1
|
||||||
|
95 00a2 B901 movw r22,r18
|
||||||
|
96 00a4 00D0 rcall __udivmodhi4
|
||||||
|
97 00a6 CB01 movw r24,r22
|
||||||
|
98 /* epilogue start */
|
||||||
|
99 00a8 DF91 pop r29
|
||||||
|
100 00aa CF91 pop r28
|
||||||
|
101 00ac 0895 ret
|
||||||
|
103 .global pretty_print_all_values
|
||||||
|
105 pretty_print_all_values:
|
||||||
|
106 /* prologue: function */
|
||||||
|
107 /* frame size = 0 */
|
||||||
|
108 /* stack size = 0 */
|
||||||
|
109 .L__stack_usage = 0
|
||||||
|
110 00ae 80E0 ldi r24,lo8(__c.1594)
|
||||||
|
111 00b0 90E0 ldi r25,hi8(__c.1594)
|
||||||
|
112 00b2 00D0 rcall uart_puts_p
|
||||||
|
113 00b4 8091 0000 lds r24,voltage_bat
|
||||||
|
114 00b8 9091 0000 lds r25,voltage_bat+1
|
||||||
|
115 00bc 00D0 rcall uart_print_uint16
|
||||||
|
116 00be 80E0 ldi r24,lo8(__c.1596)
|
||||||
|
117 00c0 90E0 ldi r25,hi8(__c.1596)
|
||||||
|
118 00c2 00D0 rcall uart_puts_p
|
||||||
|
119 00c4 80E0 ldi r24,lo8(__c.1598)
|
||||||
|
120 00c6 90E0 ldi r25,hi8(__c.1598)
|
||||||
|
121 00c8 00D0 rcall uart_puts_p
|
||||||
|
122 00ca 8091 0000 lds r24,voltage_gen
|
||||||
|
123 00ce 9091 0000 lds r25,voltage_gen+1
|
||||||
|
124 00d2 00D0 rcall uart_print_uint16
|
||||||
|
125 00d4 80E0 ldi r24,lo8(__c.1600)
|
||||||
|
126 00d6 90E0 ldi r25,hi8(__c.1600)
|
||||||
|
127 00d8 00D0 rcall uart_puts_p
|
||||||
|
128 00da 80E0 ldi r24,lo8(__c.1602)
|
||||||
|
129 00dc 90E0 ldi r25,hi8(__c.1602)
|
||||||
|
130 00de 00D0 rcall uart_puts_p
|
||||||
|
131 00e0 8091 0000 lds r24,current_in
|
||||||
|
132 00e4 9091 0000 lds r25,current_in+1
|
||||||
|
133 00e8 00D0 rcall uart_print_uint16
|
||||||
|
134 00ea 80E0 ldi r24,lo8(__c.1604)
|
||||||
|
135 00ec 90E0 ldi r25,hi8(__c.1604)
|
||||||
|
136 00ee 00D0 rcall uart_puts_p
|
||||||
|
137 00f0 8091 0000 lds r24,current_in
|
||||||
|
138 00f4 9091 0000 lds r25,current_in+1
|
||||||
|
139 00f8 24E6 ldi r18,lo8(100)
|
||||||
|
140 00fa 30E0 ldi r19,0
|
||||||
|
141 00fc B901 movw r22,r18
|
||||||
|
142 00fe 00D0 rcall __divmodhi4
|
||||||
|
143 0100 FB01 movw r30,r22
|
||||||
|
144 0102 8091 0000 lds r24,voltage_bat
|
||||||
|
145 0106 9091 0000 lds r25,voltage_bat+1
|
||||||
|
146 010a B901 movw r22,r18
|
||||||
|
147 010c 00D0 rcall __udivmodhi4
|
||||||
|
148 010e E69F mul r30,r22
|
||||||
|
149 0110 C001 movw r24,r0
|
||||||
|
150 0112 E79F mul r30,r23
|
||||||
|
151 0114 900D add r25,r0
|
||||||
|
152 0116 F69F mul r31,r22
|
||||||
|
153 0118 900D add r25,r0
|
||||||
|
154 011a 1124 clr r1
|
||||||
|
155 011c B901 movw r22,r18
|
||||||
|
156 011e 00D0 rcall __udivmodhi4
|
||||||
|
157 0120 CB01 movw r24,r22
|
||||||
|
158 0122 00D0 rcall uart_print_uint16
|
||||||
|
159 0124 80E0 ldi r24,lo8(__c.1606)
|
||||||
|
160 0126 90E0 ldi r25,hi8(__c.1606)
|
||||||
|
161 0128 00D0 rcall uart_puts_p
|
||||||
|
162 012a 80E0 ldi r24,lo8(__c.1608)
|
||||||
|
163 012c 90E0 ldi r25,hi8(__c.1608)
|
||||||
|
164 012e 00D0 rcall uart_puts_p
|
||||||
|
165 0130 86B3 in r24,0x16
|
||||||
|
166 0132 8170 andi r24,lo8(1)
|
||||||
|
167 0134 805D subi r24,lo8(-(48))
|
||||||
|
168 0136 00D0 rcall uart_putc
|
||||||
|
169 0138 8CE2 ldi r24,lo8(44)
|
||||||
|
170 013a 00D0 rcall uart_putc
|
||||||
|
171 013c 86B3 in r24,0x16
|
||||||
|
172 013e 8695 lsr r24
|
||||||
|
173 0140 8170 andi r24,1
|
||||||
|
174 0142 805D subi r24,lo8(-(48))
|
||||||
|
175 0144 00D0 rcall uart_putc
|
||||||
|
176 0146 80E0 ldi r24,lo8(__c.1610)
|
||||||
|
177 0148 90E0 ldi r25,hi8(__c.1610)
|
||||||
|
178 014a 00C0 rjmp uart_puts_p
|
||||||
|
180 .global handle_over_and_undervoltage
|
||||||
|
182 handle_over_and_undervoltage:
|
||||||
|
183 /* prologue: function */
|
||||||
|
184 /* frame size = 0 */
|
||||||
|
185 /* stack size = 0 */
|
||||||
|
186 .L__stack_usage = 0
|
||||||
|
187 014c 8091 0000 lds r24,voltage_bat
|
||||||
|
188 0150 9091 0000 lds r25,voltage_bat+1
|
||||||
|
189 0154 803C cpi r24,-64
|
||||||
|
190 0156 9B42 sbci r25,43
|
||||||
|
191 0158 00F4 brsh .L7
|
||||||
|
192 015a 1092 0000 sts undervoltage_off_counter,__zero_reg__
|
||||||
|
193 015e 8091 0000 lds r24,undervoltage_counter
|
||||||
|
194 0162 8530 cpi r24,lo8(5)
|
||||||
|
195 0164 00F4 brsh .L9
|
||||||
|
196 0166 8F5F subi r24,lo8(-(1))
|
||||||
|
197 0168 8093 0000 sts undervoltage_counter,r24
|
||||||
|
198 016c 00C0 rjmp .L9
|
||||||
|
199 .L7:
|
||||||
|
200 016e 1092 0000 sts undervoltage_counter,__zero_reg__
|
||||||
|
201 0172 8091 0000 lds r24,undervoltage_off_counter
|
||||||
|
202 0176 8330 cpi r24,lo8(3)
|
||||||
|
203 0178 00F4 brsh .L9
|
||||||
|
204 017a 8F5F subi r24,lo8(-(1))
|
||||||
|
205 017c 8093 0000 sts undervoltage_off_counter,r24
|
||||||
|
206 .L9:
|
||||||
|
207 0180 8091 0000 lds r24,voltage_gen
|
||||||
|
208 0184 9091 0000 lds r25,voltage_gen+1
|
||||||
|
209 0188 893C cpi r24,-55
|
||||||
|
210 018a 9243 sbci r25,50
|
||||||
|
211 018c 00F0 brlo .L11
|
||||||
|
212 018e 1092 0000 sts generator_off_counter,__zero_reg__
|
||||||
|
213 0192 8091 0000 lds r24,generator_counter
|
||||||
|
214 0196 8330 cpi r24,lo8(3)
|
||||||
|
215 0198 00F4 brsh .L13
|
||||||
|
216 019a 8F5F subi r24,lo8(-(1))
|
||||||
|
217 019c 8093 0000 sts generator_counter,r24
|
||||||
|
218 01a0 00C0 rjmp .L13
|
||||||
|
219 .L11:
|
||||||
|
220 01a2 1092 0000 sts generator_counter,__zero_reg__
|
||||||
|
221 01a6 8091 0000 lds r24,generator_off_counter
|
||||||
|
222 01aa 8111 cpse r24,__zero_reg__
|
||||||
|
223 01ac 00C0 rjmp .L13
|
||||||
|
224 01ae 81E0 ldi r24,lo8(1)
|
||||||
|
225 01b0 8093 0000 sts generator_off_counter,r24
|
||||||
|
226 .L13:
|
||||||
|
227 01b4 8091 0000 lds r24,undervoltage_counter
|
||||||
|
228 01b8 8530 cpi r24,lo8(5)
|
||||||
|
229 01ba 00F0 brlo .L15
|
||||||
|
230 01bc 1092 0000 sts undervoltage_off_counter,__zero_reg__
|
||||||
|
231 01c0 00C0 rjmp .L23
|
||||||
|
232 .L15:
|
||||||
|
233 01c2 8091 0000 lds r24,undervoltage_off_counter
|
||||||
|
234 01c6 8330 cpi r24,lo8(3)
|
||||||
|
235 01c8 00F0 brlo .L6
|
||||||
|
236 01ca 1092 0000 sts undervoltage_counter,__zero_reg__
|
||||||
|
237 01ce 8091 0000 lds r24,generator_counter
|
||||||
|
238 01d2 8330 cpi r24,lo8(3)
|
||||||
|
239 01d4 00F0 brlo .L18
|
||||||
|
240 01d6 C09A sbi 0x18,0
|
||||||
|
241 01d8 0895 ret
|
||||||
|
242 .L18:
|
||||||
|
243 01da 8091 0000 lds r24,generator_off_counter
|
||||||
|
244 01de 8111 cpse r24,__zero_reg__
|
||||||
|
245 .L23:
|
||||||
|
246 01e0 C098 cbi 0x18,0
|
||||||
|
247 .L6:
|
||||||
|
248 01e2 0895 ret
|
||||||
|
250 .section .text.startup,"ax",@progbits
|
||||||
|
251 .global main
|
||||||
|
253 main:
|
||||||
|
254 /* prologue: function */
|
||||||
|
255 /* frame size = 0 */
|
||||||
|
256 /* stack size = 0 */
|
||||||
|
257 .L__stack_usage = 0
|
||||||
|
258 0000 87B3 in r24,0x17
|
||||||
|
259 0002 8360 ori r24,lo8(3)
|
||||||
|
260 0004 87BB out 0x17,r24
|
||||||
|
261 0006 88B3 in r24,0x18
|
||||||
|
262 0008 8C7F andi r24,lo8(-4)
|
||||||
|
263 000a 88BB out 0x18,r24
|
||||||
|
264 000c 00D0 rcall adc_init
|
||||||
|
265 000e 8EB5 in r24,0x2e
|
||||||
|
266 0010 8B60 ori r24,lo8(11)
|
||||||
|
267 0012 8EBD out 0x2e,r24
|
||||||
|
268 0014 82EE ldi r24,lo8(-30)
|
||||||
|
269 0016 94E0 ldi r25,lo8(4)
|
||||||
|
270 0018 9BBD out 0x2a+1,r25
|
||||||
|
271 001a 8ABD out 0x2a,r24
|
||||||
|
272 001c 80E1 ldi r24,lo8(16)
|
||||||
|
273 001e 89BF out 0x39,r24
|
||||||
|
274 /* #APP */
|
||||||
|
275 ; 27 "src/main.c" 1
|
||||||
|
276 0020 7894 sei
|
||||||
|
277 ; 0 "" 2
|
||||||
|
278 /* #NOAPP */
|
||||||
|
279 0022 89E1 ldi r24,lo8(25)
|
||||||
|
280 0024 90E0 ldi r25,0
|
||||||
|
281 0026 00D0 rcall uart_init
|
||||||
|
282 0028 C098 cbi 0x18,0
|
||||||
|
283 002a C19A sbi 0x18,1
|
||||||
|
284 002c C4E6 ldi r28,lo8(100)
|
||||||
|
285 002e D0E0 ldi r29,0
|
||||||
|
286 .L35:
|
||||||
|
287 0030 8091 0000 lds r24,syscounter
|
||||||
|
288 0034 9091 0000 lds r25,syscounter+1
|
||||||
|
289 0038 8436 cpi r24,100
|
||||||
|
290 003a 9105 cpc r25,__zero_reg__
|
||||||
|
291 003c 00F0 brlo .L27
|
||||||
|
292 003e 1092 0000 sts syscounter+1,__zero_reg__
|
||||||
|
293 0042 1092 0000 sts syscounter,__zero_reg__
|
||||||
|
294 0046 00D0 rcall measure
|
||||||
|
295 0048 00D0 rcall handle_over_and_undervoltage
|
||||||
|
296 .L27:
|
||||||
|
297 004a 00D0 rcall uart_getc
|
||||||
|
298 004c 8115 cp r24,__zero_reg__
|
||||||
|
299 004e 21E0 ldi r18,1
|
||||||
|
300 0050 9207 cpc r25,r18
|
||||||
|
301 0052 01F0 breq .L35
|
||||||
|
302 0054 9927 clr r25
|
||||||
|
303 0056 8136 cpi r24,97
|
||||||
|
304 0058 9105 cpc r25,__zero_reg__
|
||||||
|
305 005a 01F0 breq .L28
|
||||||
|
306 005c 8037 cpi r24,112
|
||||||
|
307 005e 9105 cpc r25,__zero_reg__
|
||||||
|
308 0060 01F4 brne .L35
|
||||||
|
309 0062 00D0 rcall pretty_print_all_values
|
||||||
|
310 0064 00C0 rjmp .L35
|
||||||
|
311 .L28:
|
||||||
|
312 0066 81E4 ldi r24,lo8(65)
|
||||||
|
313 0068 00D0 rcall uart_putc
|
||||||
|
314 006a 8091 0000 lds r24,voltage_bat
|
||||||
|
315 006e 9091 0000 lds r25,voltage_bat+1
|
||||||
|
316 0072 00D0 rcall uart_print_uint16
|
||||||
|
317 0074 8CE2 ldi r24,lo8(44)
|
||||||
|
318 0076 00D0 rcall uart_putc
|
||||||
|
319 0078 8091 0000 lds r24,current_in
|
||||||
|
320 007c 9091 0000 lds r25,current_in+1
|
||||||
|
321 0080 00D0 rcall uart_print_uint16
|
||||||
|
322 0082 8CE2 ldi r24,lo8(44)
|
||||||
|
323 0084 00D0 rcall uart_putc
|
||||||
|
324 0086 80E0 ldi r24,0
|
||||||
|
325 0088 90E0 ldi r25,0
|
||||||
|
326 008a 00D0 rcall uart_print_uint16
|
||||||
|
327 008c 8CE2 ldi r24,lo8(44)
|
||||||
|
328 008e 00D0 rcall uart_putc
|
||||||
|
329 0090 8091 0000 lds r24,current_in
|
||||||
|
330 0094 9091 0000 lds r25,current_in+1
|
||||||
|
331 0098 BE01 movw r22,r28
|
||||||
|
332 009a 00D0 rcall __divmodhi4
|
||||||
|
333 009c 9B01 movw r18,r22
|
||||||
|
334 009e 8091 0000 lds r24,voltage_bat
|
||||||
|
335 00a2 9091 0000 lds r25,voltage_bat+1
|
||||||
|
336 00a6 BE01 movw r22,r28
|
||||||
|
337 00a8 00D0 rcall __udivmodhi4
|
||||||
|
338 00aa 269F mul r18,r22
|
||||||
|
339 00ac C001 movw r24,r0
|
||||||
|
340 00ae 279F mul r18,r23
|
||||||
|
341 00b0 900D add r25,r0
|
||||||
|
342 00b2 369F mul r19,r22
|
||||||
|
343 00b4 900D add r25,r0
|
||||||
|
344 00b6 1124 clr r1
|
||||||
|
345 00b8 BE01 movw r22,r28
|
||||||
|
346 00ba 00D0 rcall __udivmodhi4
|
||||||
|
347 00bc CB01 movw r24,r22
|
||||||
|
348 00be 00D0 rcall uart_print_uint16
|
||||||
|
349 00c0 8CE2 ldi r24,lo8(44)
|
||||||
|
350 00c2 00D0 rcall uart_putc
|
||||||
|
351 00c4 80E0 ldi r24,0
|
||||||
|
352 00c6 90E0 ldi r25,0
|
||||||
|
353 00c8 00D0 rcall uart_print_uint16
|
||||||
|
354 00ca 8CE2 ldi r24,lo8(44)
|
||||||
|
355 00cc 00D0 rcall uart_putc
|
||||||
|
356 00ce 86B3 in r24,0x16
|
||||||
|
357 00d0 8170 andi r24,lo8(1)
|
||||||
|
358 00d2 805D subi r24,lo8(-(48))
|
||||||
|
359 00d4 00D0 rcall uart_putc
|
||||||
|
360 00d6 8CE2 ldi r24,lo8(44)
|
||||||
|
361 00d8 00D0 rcall uart_putc
|
||||||
|
362 00da 80E3 ldi r24,lo8(48)
|
||||||
|
363 00dc 00D0 rcall uart_putc
|
||||||
|
364 00de 8CE2 ldi r24,lo8(44)
|
||||||
|
365 00e0 00D0 rcall uart_putc
|
||||||
|
366 00e2 86B3 in r24,0x16
|
||||||
|
367 00e4 8695 lsr r24
|
||||||
|
368 00e6 8170 andi r24,1
|
||||||
|
369 00e8 805D subi r24,lo8(-(48))
|
||||||
|
370 00ea 00D0 rcall uart_putc
|
||||||
|
371 00ec 82E4 ldi r24,lo8(66)
|
||||||
|
372 00ee 00D0 rcall uart_putc
|
||||||
|
373 00f0 00C0 rjmp .L35
|
||||||
|
375 .text
|
||||||
|
376 .global __vector_6
|
||||||
|
378 __vector_6:
|
||||||
|
379 01e4 1F92 push r1
|
||||||
|
380 01e6 0F92 push r0
|
||||||
|
381 01e8 0FB6 in r0,__SREG__
|
||||||
|
382 01ea 0F92 push r0
|
||||||
|
383 01ec 1124 clr __zero_reg__
|
||||||
|
384 01ee 2F93 push r18
|
||||||
|
385 01f0 3F93 push r19
|
||||||
|
386 01f2 4F93 push r20
|
||||||
|
387 01f4 5F93 push r21
|
||||||
|
388 01f6 6F93 push r22
|
||||||
|
389 01f8 7F93 push r23
|
||||||
|
390 01fa 8F93 push r24
|
||||||
|
391 01fc 9F93 push r25
|
||||||
|
392 /* prologue: Signal */
|
||||||
|
393 /* frame size = 0 */
|
||||||
|
394 /* stack size = 11 */
|
||||||
|
395 .L__stack_usage = 11
|
||||||
|
396 01fe 8091 0000 lds r24,syscounter
|
||||||
|
397 0202 9091 0000 lds r25,syscounter+1
|
||||||
|
398 0206 0196 adiw r24,1
|
||||||
|
399 0208 9093 0000 sts syscounter+1,r25
|
||||||
|
400 020c 8093 0000 sts syscounter,r24
|
||||||
|
401 0210 2091 0000 lds r18,syscounter
|
||||||
|
402 0214 3091 0000 lds r19,syscounter+1
|
||||||
|
403 0218 81E0 ldi r24,lo8(1)
|
||||||
|
404 021a 90E0 ldi r25,0
|
||||||
|
405 021c 2036 cpi r18,96
|
||||||
|
406 021e 4AEE ldi r20,-22
|
||||||
|
407 0220 3407 cpc r19,r20
|
||||||
|
408 0222 00F4 brsh .L37
|
||||||
|
409 0224 80E0 ldi r24,0
|
||||||
|
410 0226 90E0 ldi r25,0
|
||||||
|
411 .L37:
|
||||||
|
412 0228 60E6 ldi r22,lo8(96)
|
||||||
|
413 022a 7AEE ldi r23,lo8(-22)
|
||||||
|
414 022c 869F mul r24,r22
|
||||||
|
415 022e A001 movw r20,r0
|
||||||
|
416 0230 879F mul r24,r23
|
||||||
|
417 0232 500D add r21,r0
|
||||||
|
418 0234 969F mul r25,r22
|
||||||
|
419 0236 500D add r21,r0
|
||||||
|
420 0238 1124 clr r1
|
||||||
|
421 023a C901 movw r24,r18
|
||||||
|
422 023c 841B sub r24,r20
|
||||||
|
423 023e 950B sbc r25,r21
|
||||||
|
424 0240 9093 0000 sts syscounter+1,r25
|
||||||
|
425 0244 8093 0000 sts syscounter,r24
|
||||||
|
426 /* epilogue start */
|
||||||
|
427 0248 9F91 pop r25
|
||||||
|
428 024a 8F91 pop r24
|
||||||
|
429 024c 7F91 pop r23
|
||||||
|
430 024e 6F91 pop r22
|
||||||
|
431 0250 5F91 pop r21
|
||||||
|
432 0252 4F91 pop r20
|
||||||
|
433 0254 3F91 pop r19
|
||||||
|
434 0256 2F91 pop r18
|
||||||
|
435 0258 0F90 pop r0
|
||||||
|
436 025a 0FBE out __SREG__,r0
|
||||||
|
437 025c 0F90 pop r0
|
||||||
|
438 025e 1F90 pop r1
|
||||||
|
439 0260 1895 reti
|
||||||
|
441 .global generator_off_counter
|
||||||
|
442 .section .bss
|
||||||
|
445 generator_off_counter:
|
||||||
|
446 0000 00 .zero 1
|
||||||
|
447 .global generator_counter
|
||||||
|
450 generator_counter:
|
||||||
|
451 0001 00 .zero 1
|
||||||
|
452 .global undervoltage_off_counter
|
||||||
|
455 undervoltage_off_counter:
|
||||||
|
456 0002 00 .zero 1
|
||||||
|
457 .global undervoltage_counter
|
||||||
|
460 undervoltage_counter:
|
||||||
|
461 0003 00 .zero 1
|
||||||
|
462 .global overvoltage_off_counter
|
||||||
|
465 overvoltage_off_counter:
|
||||||
|
466 0004 00 .zero 1
|
||||||
|
467 .global overvoltage_counter
|
||||||
|
470 overvoltage_counter:
|
||||||
|
471 0005 00 .zero 1
|
||||||
|
472 .global current_in
|
||||||
|
475 current_in:
|
||||||
|
476 0006 0000 .zero 2
|
||||||
|
477 .global voltage_gen
|
||||||
|
480 voltage_gen:
|
||||||
|
481 0008 0000 .zero 2
|
||||||
|
482 .global voltage_bat
|
||||||
|
485 voltage_bat:
|
||||||
|
486 000a 0000 .zero 2
|
||||||
|
487 .global syscounter
|
||||||
|
490 syscounter:
|
||||||
|
491 000c 0000 .zero 2
|
||||||
|
492 .local temp.1586
|
||||||
|
493 .comm temp.1586,2,1
|
||||||
|
494 .section .progmem.data,"a",@progbits
|
||||||
|
497 __c.1594:
|
||||||
|
498 0000 4261 7474 .string "Battery Voltage: "
|
||||||
|
498 6572 7920
|
||||||
|
498 566F 6C74
|
||||||
|
498 6167 653A
|
||||||
|
498 2020 2000
|
||||||
|
501 __c.1596:
|
||||||
|
502 0014 6D56 0D0A .string "mV\r\n"
|
||||||
|
502 00
|
||||||
|
505 __c.1598:
|
||||||
|
506 0019 4765 6E65 .string "Generator Voltage: "
|
||||||
|
506 7261 746F
|
||||||
|
506 7220 566F
|
||||||
|
506 6C74 6167
|
||||||
|
506 653A 2020
|
||||||
|
509 __c.1600:
|
||||||
|
510 002f 6D56 0D0A .string "mV\r\n"
|
||||||
|
510 00
|
||||||
|
513 __c.1602:
|
||||||
|
514 0034 4765 6E65 .string "Generator: "
|
||||||
|
514 7261 746F
|
||||||
|
514 723A 2000
|
||||||
|
517 __c.1604:
|
||||||
|
518 0040 6D41 2020 .string "mA "
|
||||||
|
518 00
|
||||||
|
521 __c.1606:
|
||||||
|
522 0045 570D 0A00 .string "W\r\n"
|
||||||
|
525 __c.1608:
|
||||||
|
526 0049 7377 6974 .string "switches (load, gen): "
|
||||||
|
526 6368 6573
|
||||||
|
526 2028 6C6F
|
||||||
|
526 6164 2C20
|
||||||
|
526 6765 6E29
|
||||||
|
529 __c.1610:
|
||||||
|
530 0060 0D0A 00 .string "\r\n"
|
||||||
|
531 .ident "GCC: (GNU) 4.7.2"
|
||||||
|
532 .global __do_clear_bss
|
||||||
|
DEFINED SYMBOLS
|
||||||
|
*ABS*:0000000000000000 main.c
|
||||||
|
/tmp/ccKzr9U4.s:2 *ABS*:000000000000003e __SP_H__
|
||||||
|
/tmp/ccKzr9U4.s:3 *ABS*:000000000000003d __SP_L__
|
||||||
|
/tmp/ccKzr9U4.s:4 *ABS*:000000000000003f __SREG__
|
||||||
|
/tmp/ccKzr9U4.s:5 *ABS*:0000000000000000 __tmp_reg__
|
||||||
|
/tmp/ccKzr9U4.s:6 *ABS*:0000000000000001 __zero_reg__
|
||||||
|
/tmp/ccKzr9U4.s:10 .text:0000000000000000 measure
|
||||||
|
/tmp/ccKzr9U4.s:485 .bss:000000000000000a voltage_bat
|
||||||
|
/tmp/ccKzr9U4.s:480 .bss:0000000000000008 voltage_gen
|
||||||
|
.bss:000000000000000e temp.1586
|
||||||
|
/tmp/ccKzr9U4.s:475 .bss:0000000000000006 current_in
|
||||||
|
/tmp/ccKzr9U4.s:71 .text:000000000000007c get_power
|
||||||
|
/tmp/ccKzr9U4.s:105 .text:00000000000000ae pretty_print_all_values
|
||||||
|
/tmp/ccKzr9U4.s:497 .progmem.data:0000000000000000 __c.1594
|
||||||
|
/tmp/ccKzr9U4.s:501 .progmem.data:0000000000000014 __c.1596
|
||||||
|
/tmp/ccKzr9U4.s:505 .progmem.data:0000000000000019 __c.1598
|
||||||
|
/tmp/ccKzr9U4.s:509 .progmem.data:000000000000002f __c.1600
|
||||||
|
/tmp/ccKzr9U4.s:513 .progmem.data:0000000000000034 __c.1602
|
||||||
|
/tmp/ccKzr9U4.s:517 .progmem.data:0000000000000040 __c.1604
|
||||||
|
/tmp/ccKzr9U4.s:521 .progmem.data:0000000000000045 __c.1606
|
||||||
|
/tmp/ccKzr9U4.s:525 .progmem.data:0000000000000049 __c.1608
|
||||||
|
/tmp/ccKzr9U4.s:529 .progmem.data:0000000000000060 __c.1610
|
||||||
|
/tmp/ccKzr9U4.s:182 .text:000000000000014c handle_over_and_undervoltage
|
||||||
|
/tmp/ccKzr9U4.s:455 .bss:0000000000000002 undervoltage_off_counter
|
||||||
|
/tmp/ccKzr9U4.s:460 .bss:0000000000000003 undervoltage_counter
|
||||||
|
/tmp/ccKzr9U4.s:445 .bss:0000000000000000 generator_off_counter
|
||||||
|
/tmp/ccKzr9U4.s:450 .bss:0000000000000001 generator_counter
|
||||||
|
/tmp/ccKzr9U4.s:253 .text.startup:0000000000000000 main
|
||||||
|
/tmp/ccKzr9U4.s:490 .bss:000000000000000c syscounter
|
||||||
|
/tmp/ccKzr9U4.s:378 .text:00000000000001e4 __vector_6
|
||||||
|
/tmp/ccKzr9U4.s:465 .bss:0000000000000004 overvoltage_off_counter
|
||||||
|
/tmp/ccKzr9U4.s:470 .bss:0000000000000005 overvoltage_counter
|
||||||
|
|
||||||
|
UNDEFINED SYMBOLS
|
||||||
|
adc_read_avg
|
||||||
|
__divmodhi4
|
||||||
|
__udivmodhi4
|
||||||
|
uart_puts_p
|
||||||
|
uart_print_uint16
|
||||||
|
uart_putc
|
||||||
|
adc_init
|
||||||
|
uart_init
|
||||||
|
uart_getc
|
||||||
|
__do_clear_bss
|
Binary file not shown.
|
@ -0,0 +1,663 @@
|
||||||
|
/*************************************************************************
|
||||||
|
Title: Interrupt UART library with receive/transmit circular buffers
|
||||||
|
Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
|
||||||
|
File: $Id: uart.c,v 1.10 2013/06/02 07:27:04 peter Exp $
|
||||||
|
Software: AVR-GCC 4.1, AVR Libc 1.4.6 or higher
|
||||||
|
Hardware: any AVR with built-in UART,
|
||||||
|
License: GNU General Public License
|
||||||
|
|
||||||
|
DESCRIPTION:
|
||||||
|
An interrupt is generated when the UART has finished transmitting or
|
||||||
|
receiving a byte. The interrupt handling routines use circular buffers
|
||||||
|
for buffering received and transmitted data.
|
||||||
|
|
||||||
|
The UART_RX_BUFFER_SIZE and UART_TX_BUFFER_SIZE variables define
|
||||||
|
the buffer size in bytes. Note that these variables must be a
|
||||||
|
power of 2.
|
||||||
|
|
||||||
|
USAGE:
|
||||||
|
Refere to the header file uart.h for a description of the routines.
|
||||||
|
See also example test_uart.c.
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
Based on Atmel Application Note AVR306
|
||||||
|
|
||||||
|
LICENSE:
|
||||||
|
Copyright (C) 2006 Peter Fleury
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
*************************************************************************/
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#include "uart.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* constants and macros
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* size of RX/TX buffers */
|
||||||
|
#define UART_RX_BUFFER_MASK ( UART_RX_BUFFER_SIZE - 1)
|
||||||
|
#define UART_TX_BUFFER_MASK ( UART_TX_BUFFER_SIZE - 1)
|
||||||
|
|
||||||
|
#if ( UART_RX_BUFFER_SIZE & UART_RX_BUFFER_MASK )
|
||||||
|
#error RX buffer size is not a power of 2
|
||||||
|
#endif
|
||||||
|
#if ( UART_TX_BUFFER_SIZE & UART_TX_BUFFER_MASK )
|
||||||
|
#error TX buffer size is not a power of 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__AVR_AT90S2313__) \
|
||||||
|
|| defined(__AVR_AT90S4414__) || defined(__AVR_AT90S4434__) \
|
||||||
|
|| defined(__AVR_AT90S8515__) || defined(__AVR_AT90S8535__) \
|
||||||
|
|| defined(__AVR_ATmega103__)
|
||||||
|
/* old AVR classic or ATmega103 with one UART */
|
||||||
|
#define AT90_UART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT UART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT UART_UDRE_vect
|
||||||
|
#define UART0_STATUS USR
|
||||||
|
#define UART0_CONTROL UCR
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_AT90S2333__) || defined(__AVR_AT90S4433__)
|
||||||
|
/* old AVR classic with one UART */
|
||||||
|
#define AT90_UART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT UART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT UART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega8__) || defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) \
|
||||||
|
|| defined(__AVR_ATmega323__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART_RXC_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined (__AVR_ATmega8515__) || defined(__AVR_ATmega8535__)
|
||||||
|
#define ATMEGA_USART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega163__)
|
||||||
|
/* ATmega163 with one UART */
|
||||||
|
#define ATMEGA_UART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT UART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT UART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega162__)
|
||||||
|
/* ATmega with two USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define ATMEGA_USART1
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RXC_vect
|
||||||
|
#define UART1_RECEIVE_INTERRUPT USART1_RXC_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#define UART1_STATUS UCSR1A
|
||||||
|
#define UART1_CONTROL UCSR1B
|
||||||
|
#define UART1_DATA UDR1
|
||||||
|
#define UART1_UDRIE UDRIE1
|
||||||
|
#elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__)
|
||||||
|
/* ATmega with two USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define ATMEGA_USART1
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART1_RECEIVE_INTERRUPT USART1_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#define UART1_STATUS UCSR1A
|
||||||
|
#define UART1_CONTROL UCSR1B
|
||||||
|
#define UART1_DATA UDR1
|
||||||
|
#define UART1_UDRIE UDRIE1
|
||||||
|
#elif defined(__AVR_ATmega161__)
|
||||||
|
/* ATmega with UART */
|
||||||
|
#error "AVR ATmega161 currently not supported by this libaray !"
|
||||||
|
#elif defined(__AVR_ATmega169__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega48__) || defined(__AVR_ATmega88__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega48P__) || defined(__AVR_ATmega88P__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__) \
|
||||||
|
|| defined(__AVR_ATmega3250__) || defined(__AVR_ATmega3290__) ||defined(__AVR_ATmega6450__) || defined(__AVR_ATmega6490__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#elif defined(__AVR_ATtiny2313__)
|
||||||
|
#define ATMEGA_USART
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSRA
|
||||||
|
#define UART0_CONTROL UCSRB
|
||||||
|
#define UART0_DATA UDR
|
||||||
|
#define UART0_UDRIE UDRIE
|
||||||
|
#elif defined(__AVR_ATmega329__) || \
|
||||||
|
defined(__AVR_ATmega649__) || \
|
||||||
|
defined(__AVR_ATmega325__) || \
|
||||||
|
defined(__AVR_ATmega645__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#elif defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega640__)
|
||||||
|
/* ATmega with two USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define ATMEGA_USART1
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART1_RECEIVE_INTERRUPT USART1_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#define UART1_STATUS UCSR1A
|
||||||
|
#define UART1_CONTROL UCSR1B
|
||||||
|
#define UART1_DATA UDR1
|
||||||
|
#define UART1_UDRIE UDRIE1
|
||||||
|
#elif defined(__AVR_ATmega644__)
|
||||||
|
/* ATmega with one USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#elif defined(__AVR_ATmega164P__) || defined(__AVR_ATmega324P__) || defined(__AVR_ATmega644P__)
|
||||||
|
/* ATmega with two USART */
|
||||||
|
#define ATMEGA_USART0
|
||||||
|
#define ATMEGA_USART1
|
||||||
|
#define UART0_RECEIVE_INTERRUPT USART0_RX_vect
|
||||||
|
#define UART1_RECEIVE_INTERRUPT USART1_RX_vect
|
||||||
|
#define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect
|
||||||
|
#define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect
|
||||||
|
#define UART0_STATUS UCSR0A
|
||||||
|
#define UART0_CONTROL UCSR0B
|
||||||
|
#define UART0_DATA UDR0
|
||||||
|
#define UART0_UDRIE UDRIE0
|
||||||
|
#define UART1_STATUS UCSR1A
|
||||||
|
#define UART1_CONTROL UCSR1B
|
||||||
|
#define UART1_DATA UDR1
|
||||||
|
#define UART1_UDRIE UDRIE1
|
||||||
|
#else
|
||||||
|
#error "no UART definition for MCU available"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* module global variables
|
||||||
|
*/
|
||||||
|
static volatile unsigned char UART_TxBuf[UART_TX_BUFFER_SIZE];
|
||||||
|
static volatile unsigned char UART_RxBuf[UART_RX_BUFFER_SIZE];
|
||||||
|
static volatile unsigned char UART_TxHead;
|
||||||
|
static volatile unsigned char UART_TxTail;
|
||||||
|
static volatile unsigned char UART_RxHead;
|
||||||
|
static volatile unsigned char UART_RxTail;
|
||||||
|
static volatile unsigned char UART_LastRxError;
|
||||||
|
|
||||||
|
#if defined( ATMEGA_USART1 )
|
||||||
|
static volatile unsigned char UART1_TxBuf[UART_TX_BUFFER_SIZE];
|
||||||
|
static volatile unsigned char UART1_RxBuf[UART_RX_BUFFER_SIZE];
|
||||||
|
static volatile unsigned char UART1_TxHead;
|
||||||
|
static volatile unsigned char UART1_TxTail;
|
||||||
|
static volatile unsigned char UART1_RxHead;
|
||||||
|
static volatile unsigned char UART1_RxTail;
|
||||||
|
static volatile unsigned char UART1_LastRxError;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ISR (UART0_RECEIVE_INTERRUPT)
|
||||||
|
/*************************************************************************
|
||||||
|
Function: UART Receive Complete interrupt
|
||||||
|
Purpose: called when the UART has received a character
|
||||||
|
**************************************************************************/
|
||||||
|
{
|
||||||
|
unsigned char tmphead;
|
||||||
|
unsigned char data;
|
||||||
|
unsigned char usr;
|
||||||
|
unsigned char lastRxError;
|
||||||
|
|
||||||
|
|
||||||
|
/* read UART status register and UART data register */
|
||||||
|
usr = UART0_STATUS;
|
||||||
|
data = UART0_DATA;
|
||||||
|
|
||||||
|
/* */
|
||||||
|
#if defined( AT90_UART )
|
||||||
|
lastRxError = (usr & (_BV(FE)|_BV(DOR)) );
|
||||||
|
#elif defined( ATMEGA_USART )
|
||||||
|
lastRxError = (usr & (_BV(FE)|_BV(DOR)) );
|
||||||
|
#elif defined( ATMEGA_USART0 )
|
||||||
|
lastRxError = (usr & (_BV(FE0)|_BV(DOR0)) );
|
||||||
|
#elif defined ( ATMEGA_UART )
|
||||||
|
lastRxError = (usr & (_BV(FE)|_BV(DOR)) );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* calculate buffer index */
|
||||||
|
tmphead = ( UART_RxHead + 1) & UART_RX_BUFFER_MASK;
|
||||||
|
|
||||||
|
if ( tmphead == UART_RxTail ) {
|
||||||
|
/* error: receive buffer overflow */
|
||||||
|
lastRxError = UART_BUFFER_OVERFLOW >> 8;
|
||||||
|
}else{
|
||||||
|
/* store new index */
|
||||||
|
UART_RxHead = tmphead;
|
||||||
|
/* store received data in buffer */
|
||||||
|
UART_RxBuf[tmphead] = data;
|
||||||
|
}
|
||||||
|
UART_LastRxError |= lastRxError;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ISR (UART0_TRANSMIT_INTERRUPT)
|
||||||
|
/*************************************************************************
|
||||||
|
Function: UART Data Register Empty interrupt
|
||||||
|
Purpose: called when the UART is ready to transmit the next byte
|
||||||
|
**************************************************************************/
|
||||||
|
{
|
||||||
|
unsigned char tmptail;
|
||||||
|
|
||||||
|
|
||||||
|
if ( UART_TxHead != UART_TxTail) {
|
||||||
|
/* calculate and store new buffer index */
|
||||||
|
tmptail = (UART_TxTail + 1) & UART_TX_BUFFER_MASK;
|
||||||
|
UART_TxTail = tmptail;
|
||||||
|
/* get one byte from buffer and write it to UART */
|
||||||
|
UART0_DATA = UART_TxBuf[tmptail]; /* start transmission */
|
||||||
|
}else{
|
||||||
|
/* tx buffer empty, disable UDRE interrupt */
|
||||||
|
UART0_CONTROL &= ~_BV(UART0_UDRIE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_init()
|
||||||
|
Purpose: initialize UART and set baudrate
|
||||||
|
Input: baudrate using macro UART_BAUD_SELECT()
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart_init(unsigned int baudrate)
|
||||||
|
{
|
||||||
|
UART_TxHead = 0;
|
||||||
|
UART_TxTail = 0;
|
||||||
|
UART_RxHead = 0;
|
||||||
|
UART_RxTail = 0;
|
||||||
|
|
||||||
|
#if defined( AT90_UART )
|
||||||
|
/* set baud rate */
|
||||||
|
UBRR = (unsigned char)baudrate;
|
||||||
|
|
||||||
|
/* enable UART receiver and transmmitter and receive complete interrupt */
|
||||||
|
UART0_CONTROL = _BV(RXCIE)|_BV(RXEN)|_BV(TXEN);
|
||||||
|
|
||||||
|
#elif defined (ATMEGA_USART)
|
||||||
|
/* Set baud rate */
|
||||||
|
if ( baudrate & 0x8000 )
|
||||||
|
{
|
||||||
|
UART0_STATUS = (1<<U2X); //Enable 2x speed
|
||||||
|
baudrate &= ~0x8000;
|
||||||
|
}
|
||||||
|
UBRRH = (unsigned char)(baudrate>>8);
|
||||||
|
UBRRL = (unsigned char) baudrate;
|
||||||
|
|
||||||
|
/* Enable USART receiver and transmitter and receive complete interrupt */
|
||||||
|
UART0_CONTROL = _BV(RXCIE)|(1<<RXEN)|(1<<TXEN);
|
||||||
|
|
||||||
|
/* Set frame format: asynchronous, 8data, no parity, 1stop bit */
|
||||||
|
#ifdef URSEL
|
||||||
|
UCSRC = (1<<URSEL)|(3<<UCSZ0);
|
||||||
|
#else
|
||||||
|
UCSRC = (3<<UCSZ0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined (ATMEGA_USART0 )
|
||||||
|
/* Set baud rate */
|
||||||
|
if ( baudrate & 0x8000 )
|
||||||
|
{
|
||||||
|
UART0_STATUS = (1<<U2X0); //Enable 2x speed
|
||||||
|
baudrate &= ~0x8000;
|
||||||
|
}
|
||||||
|
UBRR0H = (unsigned char)(baudrate>>8);
|
||||||
|
UBRR0L = (unsigned char) baudrate;
|
||||||
|
|
||||||
|
/* Enable USART receiver and transmitter and receive complete interrupt */
|
||||||
|
UART0_CONTROL = _BV(RXCIE0)|(1<<RXEN0)|(1<<TXEN0);
|
||||||
|
|
||||||
|
/* Set frame format: asynchronous, 8data, no parity, 1stop bit */
|
||||||
|
#ifdef URSEL0
|
||||||
|
UCSR0C = (1<<URSEL0)|(3<<UCSZ00);
|
||||||
|
#else
|
||||||
|
UCSR0C = (3<<UCSZ00);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined ( ATMEGA_UART )
|
||||||
|
/* set baud rate */
|
||||||
|
if ( baudrate & 0x8000 )
|
||||||
|
{
|
||||||
|
UART0_STATUS = (1<<U2X); //Enable 2x speed
|
||||||
|
baudrate &= ~0x8000;
|
||||||
|
}
|
||||||
|
UBRRHI = (unsigned char)(baudrate>>8);
|
||||||
|
UBRR = (unsigned char) baudrate;
|
||||||
|
|
||||||
|
/* Enable UART receiver and transmitter and receive complete interrupt */
|
||||||
|
UART0_CONTROL = _BV(RXCIE)|(1<<RXEN)|(1<<TXEN);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}/* uart_init */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_getc()
|
||||||
|
Purpose: return byte from ringbuffer
|
||||||
|
Returns: lower byte: received byte from ringbuffer
|
||||||
|
higher byte: last receive error
|
||||||
|
**************************************************************************/
|
||||||
|
unsigned int uart_getc(void)
|
||||||
|
{
|
||||||
|
unsigned char tmptail;
|
||||||
|
unsigned char data;
|
||||||
|
|
||||||
|
|
||||||
|
if ( UART_RxHead == UART_RxTail ) {
|
||||||
|
return UART_NO_DATA; /* no data available */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* calculate /store buffer index */
|
||||||
|
tmptail = (UART_RxTail + 1) & UART_RX_BUFFER_MASK;
|
||||||
|
UART_RxTail = tmptail;
|
||||||
|
|
||||||
|
/* get data from receive buffer */
|
||||||
|
data = UART_RxBuf[tmptail];
|
||||||
|
|
||||||
|
data = (UART_LastRxError << 8) + data;
|
||||||
|
UART_LastRxError = 0;
|
||||||
|
return data;
|
||||||
|
|
||||||
|
}/* uart_getc */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_putc()
|
||||||
|
Purpose: write byte to ringbuffer for transmitting via UART
|
||||||
|
Input: byte to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart_putc(unsigned char data)
|
||||||
|
{
|
||||||
|
unsigned char tmphead;
|
||||||
|
|
||||||
|
|
||||||
|
tmphead = (UART_TxHead + 1) & UART_TX_BUFFER_MASK;
|
||||||
|
|
||||||
|
while ( tmphead == UART_TxTail ){
|
||||||
|
;/* wait for free space in buffer */
|
||||||
|
}
|
||||||
|
|
||||||
|
UART_TxBuf[tmphead] = data;
|
||||||
|
UART_TxHead = tmphead;
|
||||||
|
|
||||||
|
/* enable UDRE interrupt */
|
||||||
|
UART0_CONTROL |= _BV(UART0_UDRIE);
|
||||||
|
|
||||||
|
}/* uart_putc */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_puts()
|
||||||
|
Purpose: transmit string to UART
|
||||||
|
Input: string to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart_puts(const char *s )
|
||||||
|
{
|
||||||
|
while (*s)
|
||||||
|
uart_putc(*s++);
|
||||||
|
|
||||||
|
}/* uart_puts */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart_puts_p()
|
||||||
|
Purpose: transmit string from program memory to UART
|
||||||
|
Input: program memory string to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart_puts_p(const char *progmem_s )
|
||||||
|
{
|
||||||
|
register char c;
|
||||||
|
|
||||||
|
while ( (c = pgm_read_byte(progmem_s++)) )
|
||||||
|
uart_putc(c);
|
||||||
|
|
||||||
|
}/* uart_puts_p */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* these functions are only for ATmegas with two USART
|
||||||
|
*/
|
||||||
|
#if defined( ATMEGA_USART1 )
|
||||||
|
|
||||||
|
ISR(UART1_RECEIVE_INTERRUPT)
|
||||||
|
/*************************************************************************
|
||||||
|
Function: UART1 Receive Complete interrupt
|
||||||
|
Purpose: called when the UART1 has received a character
|
||||||
|
**************************************************************************/
|
||||||
|
{
|
||||||
|
unsigned char tmphead;
|
||||||
|
unsigned char data;
|
||||||
|
unsigned char usr;
|
||||||
|
unsigned char lastRxError;
|
||||||
|
|
||||||
|
|
||||||
|
/* read UART status register and UART data register */
|
||||||
|
usr = UART1_STATUS;
|
||||||
|
data = UART1_DATA;
|
||||||
|
|
||||||
|
/* */
|
||||||
|
lastRxError = (usr & (_BV(FE1)|_BV(DOR1)) );
|
||||||
|
|
||||||
|
/* calculate buffer index */
|
||||||
|
tmphead = ( UART1_RxHead + 1) & UART_RX_BUFFER_MASK;
|
||||||
|
|
||||||
|
if ( tmphead == UART1_RxTail ) {
|
||||||
|
/* error: receive buffer overflow */
|
||||||
|
lastRxError = UART_BUFFER_OVERFLOW >> 8;
|
||||||
|
}else{
|
||||||
|
/* store new index */
|
||||||
|
UART1_RxHead = tmphead;
|
||||||
|
/* store received data in buffer */
|
||||||
|
UART1_RxBuf[tmphead] = data;
|
||||||
|
}
|
||||||
|
UART1_LastRxError |= lastRxError;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ISR(UART1_TRANSMIT_INTERRUPT)
|
||||||
|
/*************************************************************************
|
||||||
|
Function: UART1 Data Register Empty interrupt
|
||||||
|
Purpose: called when the UART1 is ready to transmit the next byte
|
||||||
|
**************************************************************************/
|
||||||
|
{
|
||||||
|
unsigned char tmptail;
|
||||||
|
|
||||||
|
|
||||||
|
if ( UART1_TxHead != UART1_TxTail) {
|
||||||
|
/* calculate and store new buffer index */
|
||||||
|
tmptail = (UART1_TxTail + 1) & UART_TX_BUFFER_MASK;
|
||||||
|
UART1_TxTail = tmptail;
|
||||||
|
/* get one byte from buffer and write it to UART */
|
||||||
|
UART1_DATA = UART1_TxBuf[tmptail]; /* start transmission */
|
||||||
|
}else{
|
||||||
|
/* tx buffer empty, disable UDRE interrupt */
|
||||||
|
UART1_CONTROL &= ~_BV(UART1_UDRIE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart1_init()
|
||||||
|
Purpose: initialize UART1 and set baudrate
|
||||||
|
Input: baudrate using macro UART_BAUD_SELECT()
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart1_init(unsigned int baudrate)
|
||||||
|
{
|
||||||
|
UART1_TxHead = 0;
|
||||||
|
UART1_TxTail = 0;
|
||||||
|
UART1_RxHead = 0;
|
||||||
|
UART1_RxTail = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/* Set baud rate */
|
||||||
|
if ( baudrate & 0x8000 )
|
||||||
|
{
|
||||||
|
UART1_STATUS = (1<<U2X1); //Enable 2x speed
|
||||||
|
baudrate &= ~0x8000;
|
||||||
|
}
|
||||||
|
UBRR1H = (unsigned char)(baudrate>>8);
|
||||||
|
UBRR1L = (unsigned char) baudrate;
|
||||||
|
|
||||||
|
/* Enable USART receiver and transmitter and receive complete interrupt */
|
||||||
|
UART1_CONTROL = _BV(RXCIE1)|(1<<RXEN1)|(1<<TXEN1);
|
||||||
|
|
||||||
|
/* Set frame format: asynchronous, 8data, no parity, 1stop bit */
|
||||||
|
#ifdef URSEL1
|
||||||
|
UCSR1C = (1<<URSEL1)|(3<<UCSZ10);
|
||||||
|
#else
|
||||||
|
UCSR1C = (3<<UCSZ10);
|
||||||
|
#endif
|
||||||
|
}/* uart_init */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart1_getc()
|
||||||
|
Purpose: return byte from ringbuffer
|
||||||
|
Returns: lower byte: received byte from ringbuffer
|
||||||
|
higher byte: last receive error
|
||||||
|
**************************************************************************/
|
||||||
|
unsigned int uart1_getc(void)
|
||||||
|
{
|
||||||
|
unsigned char tmptail;
|
||||||
|
unsigned char data;
|
||||||
|
|
||||||
|
|
||||||
|
if ( UART1_RxHead == UART1_RxTail ) {
|
||||||
|
return UART_NO_DATA; /* no data available */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* calculate /store buffer index */
|
||||||
|
tmptail = (UART1_RxTail + 1) & UART_RX_BUFFER_MASK;
|
||||||
|
UART1_RxTail = tmptail;
|
||||||
|
|
||||||
|
/* get data from receive buffer */
|
||||||
|
data = UART1_RxBuf[tmptail];
|
||||||
|
|
||||||
|
data = (UART1_LastRxError << 8) + data;
|
||||||
|
UART1_LastRxError = 0;
|
||||||
|
return data;
|
||||||
|
|
||||||
|
}/* uart1_getc */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart1_putc()
|
||||||
|
Purpose: write byte to ringbuffer for transmitting via UART
|
||||||
|
Input: byte to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart1_putc(unsigned char data)
|
||||||
|
{
|
||||||
|
unsigned char tmphead;
|
||||||
|
|
||||||
|
|
||||||
|
tmphead = (UART1_TxHead + 1) & UART_TX_BUFFER_MASK;
|
||||||
|
|
||||||
|
while ( tmphead == UART1_TxTail ){
|
||||||
|
;/* wait for free space in buffer */
|
||||||
|
}
|
||||||
|
|
||||||
|
UART1_TxBuf[tmphead] = data;
|
||||||
|
UART1_TxHead = tmphead;
|
||||||
|
|
||||||
|
/* enable UDRE interrupt */
|
||||||
|
UART1_CONTROL |= _BV(UART1_UDRIE);
|
||||||
|
|
||||||
|
}/* uart1_putc */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart1_puts()
|
||||||
|
Purpose: transmit string to UART1
|
||||||
|
Input: string to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart1_puts(const char *s )
|
||||||
|
{
|
||||||
|
while (*s)
|
||||||
|
uart1_putc(*s++);
|
||||||
|
|
||||||
|
}/* uart1_puts */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
Function: uart1_puts_p()
|
||||||
|
Purpose: transmit string from program memory to UART1
|
||||||
|
Input: program memory string to be transmitted
|
||||||
|
Returns: none
|
||||||
|
**************************************************************************/
|
||||||
|
void uart1_puts_p(const char *progmem_s )
|
||||||
|
{
|
||||||
|
register char c;
|
||||||
|
|
||||||
|
while ( (c = pgm_read_byte(progmem_s++)) )
|
||||||
|
uart1_putc(c);
|
||||||
|
|
||||||
|
}/* uart1_puts_p */
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,180 @@
|
||||||
|
#ifndef UART_H
|
||||||
|
#define UART_H
|
||||||
|
/************************************************************************
|
||||||
|
Title: Interrupt UART library with receive/transmit circular buffers
|
||||||
|
Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
|
||||||
|
File: $Id: uart.h,v 1.12 2012/11/19 19:52:27 peter Exp $
|
||||||
|
Software: AVR-GCC 4.1, AVR Libc 1.4
|
||||||
|
Hardware: any AVR with built-in UART, tested on AT90S8515 & ATmega8 at 4 Mhz
|
||||||
|
License: GNU General Public License
|
||||||
|
Usage: see Doxygen manual
|
||||||
|
|
||||||
|
LICENSE:
|
||||||
|
Copyright (C) 2006 Peter Fleury
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup pfleury_uart UART Library
|
||||||
|
* @code #include <uart.h> @endcode
|
||||||
|
*
|
||||||
|
* @brief Interrupt UART library using the built-in UART with transmit and receive circular buffers.
|
||||||
|
*
|
||||||
|
* This library can be used to transmit and receive data through the built in UART.
|
||||||
|
*
|
||||||
|
* An interrupt is generated when the UART has finished transmitting or
|
||||||
|
* receiving a byte. The interrupt handling routines use circular buffers
|
||||||
|
* for buffering received and transmitted data.
|
||||||
|
*
|
||||||
|
* The UART_RX_BUFFER_SIZE and UART_TX_BUFFER_SIZE constants define
|
||||||
|
* the size of the circular buffers in bytes. Note that these constants must be a power of 2.
|
||||||
|
* You may need to adapt this constants to your target and your application by adding
|
||||||
|
* CDEFS += -DUART_RX_BUFFER_SIZE=nn -DUART_RX_BUFFER_SIZE=nn to your Makefile.
|
||||||
|
*
|
||||||
|
* @note Based on Atmel Application Note AVR306
|
||||||
|
* @author Peter Fleury pfleury@gmx.ch http://jump.to/fleury
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**@{*/
|
||||||
|
|
||||||
|
|
||||||
|
#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304
|
||||||
|
#error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** constants and macros
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @brief UART Baudrate Expression
|
||||||
|
* @param xtalcpu system clock in Mhz, e.g. 4000000UL for 4Mhz
|
||||||
|
* @param baudrate baudrate in bps, e.g. 1200, 2400, 9600
|
||||||
|
*/
|
||||||
|
#define UART_BAUD_SELECT(baudRate,xtalCpu) (((xtalCpu) + 8UL * (baudRate)) / (16UL * (baudRate)) -1UL)
|
||||||
|
|
||||||
|
/** @brief UART Baudrate Expression for ATmega double speed mode
|
||||||
|
* @param xtalcpu system clock in Mhz, e.g. 4000000UL for 4Mhz
|
||||||
|
* @param baudrate baudrate in bps, e.g. 1200, 2400, 9600
|
||||||
|
*/
|
||||||
|
#define UART_BAUD_SELECT_DOUBLE_SPEED(baudRate,xtalCpu) ( ((((xtalCpu) + 4UL * (baudRate)) / (8UL * (baudRate)) -1UL)) | 0x8000)
|
||||||
|
|
||||||
|
|
||||||
|
/** Size of the circular receive buffer, must be power of 2 */
|
||||||
|
#ifndef UART_RX_BUFFER_SIZE
|
||||||
|
#define UART_RX_BUFFER_SIZE 32
|
||||||
|
#endif
|
||||||
|
/** Size of the circular transmit buffer, must be power of 2 */
|
||||||
|
#ifndef UART_TX_BUFFER_SIZE
|
||||||
|
#define UART_TX_BUFFER_SIZE 32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* test if the size of the circular buffers fits into SRAM */
|
||||||
|
#if ( (UART_RX_BUFFER_SIZE+UART_TX_BUFFER_SIZE) >= (RAMEND-0x60 ) )
|
||||||
|
#error "size of UART_RX_BUFFER_SIZE + UART_TX_BUFFER_SIZE larger than size of SRAM"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** high byte error return code of uart_getc()
|
||||||
|
*/
|
||||||
|
#define UART_FRAME_ERROR 0x1000 /* Framing Error by UART */
|
||||||
|
#define UART_OVERRUN_ERROR 0x0800 /* Overrun condition by UART */
|
||||||
|
#define UART_PARITY_ERROR 0x0400 /* Parity Error by UART */
|
||||||
|
#define UART_BUFFER_OVERFLOW 0x0200 /* receive ringbuffer overflow */
|
||||||
|
#define UART_NO_DATA 0x0100 /* no receive data available */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** function prototypes
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Initialize UART and set baudrate
|
||||||
|
@param baudrate Specify baudrate using macro UART_BAUD_SELECT()
|
||||||
|
@return none
|
||||||
|
*/
|
||||||
|
extern void uart_init(unsigned int baudrate);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get received byte from ringbuffer
|
||||||
|
*
|
||||||
|
* Returns in the lower byte the received character and in the
|
||||||
|
* higher byte the last receive error.
|
||||||
|
* UART_NO_DATA is returned when no data is available.
|
||||||
|
*
|
||||||
|
* @param void
|
||||||
|
* @return lower byte: received byte from ringbuffer
|
||||||
|
* @return higher byte: last receive status
|
||||||
|
* - \b 0 successfully received data from UART
|
||||||
|
* - \b UART_NO_DATA
|
||||||
|
* <br>no receive data available
|
||||||
|
* - \b UART_BUFFER_OVERFLOW
|
||||||
|
* <br>Receive ringbuffer overflow.
|
||||||
|
* We are not reading the receive buffer fast enough,
|
||||||
|
* one or more received character have been dropped
|
||||||
|
* - \b UART_OVERRUN_ERROR
|
||||||
|
* <br>Overrun condition by UART.
|
||||||
|
* A character already present in the UART UDR register was
|
||||||
|
* not read by the interrupt handler before the next character arrived,
|
||||||
|
* one or more received characters have been dropped.
|
||||||
|
* - \b UART_FRAME_ERROR
|
||||||
|
* <br>Framing Error by UART
|
||||||
|
*/
|
||||||
|
extern unsigned int uart_getc(void);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Put byte to ringbuffer for transmitting via UART
|
||||||
|
* @param data byte to be transmitted
|
||||||
|
* @return none
|
||||||
|
*/
|
||||||
|
extern void uart_putc(unsigned char data);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Put string to ringbuffer for transmitting via UART
|
||||||
|
*
|
||||||
|
* The string is buffered by the uart library in a circular buffer
|
||||||
|
* and one character at a time is transmitted to the UART using interrupts.
|
||||||
|
* Blocks if it can not write the whole string into the circular buffer.
|
||||||
|
*
|
||||||
|
* @param s string to be transmitted
|
||||||
|
* @return none
|
||||||
|
*/
|
||||||
|
extern void uart_puts(const char *s );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Put string from program memory to ringbuffer for transmitting via UART.
|
||||||
|
*
|
||||||
|
* The string is buffered by the uart library in a circular buffer
|
||||||
|
* and one character at a time is transmitted to the UART using interrupts.
|
||||||
|
* Blocks if it can not write the whole string into the circular buffer.
|
||||||
|
*
|
||||||
|
* @param s program memory string to be transmitted
|
||||||
|
* @return none
|
||||||
|
* @see uart_puts_P
|
||||||
|
*/
|
||||||
|
extern void uart_puts_p(const char *s );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Macro to automatically put a string constant into program memory
|
||||||
|
*/
|
||||||
|
#define uart_puts_P(__s) uart_puts_p(PSTR(__s))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // UART_H
|
||||||
|
|
|
@ -0,0 +1,256 @@
|
||||||
|
1 .file "uart.c"
|
||||||
|
2 __SP_H__ = 0x3e
|
||||||
|
3 __SP_L__ = 0x3d
|
||||||
|
4 __SREG__ = 0x3f
|
||||||
|
5 __tmp_reg__ = 0
|
||||||
|
6 __zero_reg__ = 1
|
||||||
|
7 .text
|
||||||
|
8 .global __vector_11
|
||||||
|
10 __vector_11:
|
||||||
|
11 0000 1F92 push r1
|
||||||
|
12 0002 0F92 push r0
|
||||||
|
13 0004 0FB6 in r0,__SREG__
|
||||||
|
14 0006 0F92 push r0
|
||||||
|
15 0008 1124 clr __zero_reg__
|
||||||
|
16 000a 2F93 push r18
|
||||||
|
17 000c 8F93 push r24
|
||||||
|
18 000e 9F93 push r25
|
||||||
|
19 0010 EF93 push r30
|
||||||
|
20 0012 FF93 push r31
|
||||||
|
21 /* prologue: Signal */
|
||||||
|
22 /* frame size = 0 */
|
||||||
|
23 /* stack size = 8 */
|
||||||
|
24 .L__stack_usage = 8
|
||||||
|
25 0014 8BB1 in r24,0xb
|
||||||
|
26 0016 9CB1 in r25,0xc
|
||||||
|
27 0018 8871 andi r24,lo8(24)
|
||||||
|
28 001a E091 0000 lds r30,UART_RxHead
|
||||||
|
29 001e EF5F subi r30,lo8(-(1))
|
||||||
|
30 0020 EF71 andi r30,lo8(31)
|
||||||
|
31 0022 2091 0000 lds r18,UART_RxTail
|
||||||
|
32 0026 E217 cp r30,r18
|
||||||
|
33 0028 01F0 breq .L3
|
||||||
|
34 002a E093 0000 sts UART_RxHead,r30
|
||||||
|
35 002e F0E0 ldi r31,0
|
||||||
|
36 0030 E050 subi r30,lo8(-(UART_RxBuf))
|
||||||
|
37 0032 F040 sbci r31,hi8(-(UART_RxBuf))
|
||||||
|
38 0034 9083 st Z,r25
|
||||||
|
39 0036 00C0 rjmp .L2
|
||||||
|
40 .L3:
|
||||||
|
41 0038 82E0 ldi r24,lo8(2)
|
||||||
|
42 .L2:
|
||||||
|
43 003a 9091 0000 lds r25,UART_LastRxError
|
||||||
|
44 003e 982B or r25,r24
|
||||||
|
45 0040 9093 0000 sts UART_LastRxError,r25
|
||||||
|
46 /* epilogue start */
|
||||||
|
47 0044 FF91 pop r31
|
||||||
|
48 0046 EF91 pop r30
|
||||||
|
49 0048 9F91 pop r25
|
||||||
|
50 004a 8F91 pop r24
|
||||||
|
51 004c 2F91 pop r18
|
||||||
|
52 004e 0F90 pop r0
|
||||||
|
53 0050 0FBE out __SREG__,r0
|
||||||
|
54 0052 0F90 pop r0
|
||||||
|
55 0054 1F90 pop r1
|
||||||
|
56 0056 1895 reti
|
||||||
|
58 .global __vector_12
|
||||||
|
60 __vector_12:
|
||||||
|
61 0058 1F92 push r1
|
||||||
|
62 005a 0F92 push r0
|
||||||
|
63 005c 0FB6 in r0,__SREG__
|
||||||
|
64 005e 0F92 push r0
|
||||||
|
65 0060 1124 clr __zero_reg__
|
||||||
|
66 0062 8F93 push r24
|
||||||
|
67 0064 9F93 push r25
|
||||||
|
68 0066 EF93 push r30
|
||||||
|
69 0068 FF93 push r31
|
||||||
|
70 /* prologue: Signal */
|
||||||
|
71 /* frame size = 0 */
|
||||||
|
72 /* stack size = 7 */
|
||||||
|
73 .L__stack_usage = 7
|
||||||
|
74 006a 9091 0000 lds r25,UART_TxHead
|
||||||
|
75 006e 8091 0000 lds r24,UART_TxTail
|
||||||
|
76 0072 9817 cp r25,r24
|
||||||
|
77 0074 01F0 breq .L5
|
||||||
|
78 0076 E091 0000 lds r30,UART_TxTail
|
||||||
|
79 007a EF5F subi r30,lo8(-(1))
|
||||||
|
80 007c EF71 andi r30,lo8(31)
|
||||||
|
81 007e E093 0000 sts UART_TxTail,r30
|
||||||
|
82 0082 F0E0 ldi r31,0
|
||||||
|
83 0084 E050 subi r30,lo8(-(UART_TxBuf))
|
||||||
|
84 0086 F040 sbci r31,hi8(-(UART_TxBuf))
|
||||||
|
85 0088 8081 ld r24,Z
|
||||||
|
86 008a 8CB9 out 0xc,r24
|
||||||
|
87 008c 00C0 rjmp .L4
|
||||||
|
88 .L5:
|
||||||
|
89 008e 5598 cbi 0xa,5
|
||||||
|
90 .L4:
|
||||||
|
91 /* epilogue start */
|
||||||
|
92 0090 FF91 pop r31
|
||||||
|
93 0092 EF91 pop r30
|
||||||
|
94 0094 9F91 pop r25
|
||||||
|
95 0096 8F91 pop r24
|
||||||
|
96 0098 0F90 pop r0
|
||||||
|
97 009a 0FBE out __SREG__,r0
|
||||||
|
98 009c 0F90 pop r0
|
||||||
|
99 009e 1F90 pop r1
|
||||||
|
100 00a0 1895 reti
|
||||||
|
102 .global uart_init
|
||||||
|
104 uart_init:
|
||||||
|
105 /* prologue: function */
|
||||||
|
106 /* frame size = 0 */
|
||||||
|
107 /* stack size = 0 */
|
||||||
|
108 .L__stack_usage = 0
|
||||||
|
109 00a2 1092 0000 sts UART_TxHead,__zero_reg__
|
||||||
|
110 00a6 1092 0000 sts UART_TxTail,__zero_reg__
|
||||||
|
111 00aa 1092 0000 sts UART_RxHead,__zero_reg__
|
||||||
|
112 00ae 1092 0000 sts UART_RxTail,__zero_reg__
|
||||||
|
113 00b2 97FF sbrs r25,7
|
||||||
|
114 00b4 00C0 rjmp .L8
|
||||||
|
115 00b6 22E0 ldi r18,lo8(2)
|
||||||
|
116 00b8 2BB9 out 0xb,r18
|
||||||
|
117 00ba 9F77 andi r25,127
|
||||||
|
118 .L8:
|
||||||
|
119 00bc 90BD out 0x20,r25
|
||||||
|
120 00be 89B9 out 0x9,r24
|
||||||
|
121 00c0 88E9 ldi r24,lo8(-104)
|
||||||
|
122 00c2 8AB9 out 0xa,r24
|
||||||
|
123 00c4 86E8 ldi r24,lo8(-122)
|
||||||
|
124 00c6 80BD out 0x20,r24
|
||||||
|
125 00c8 0895 ret
|
||||||
|
127 .global uart_getc
|
||||||
|
129 uart_getc:
|
||||||
|
130 /* prologue: function */
|
||||||
|
131 /* frame size = 0 */
|
||||||
|
132 /* stack size = 0 */
|
||||||
|
133 .L__stack_usage = 0
|
||||||
|
134 00ca 9091 0000 lds r25,UART_RxHead
|
||||||
|
135 00ce 8091 0000 lds r24,UART_RxTail
|
||||||
|
136 00d2 9817 cp r25,r24
|
||||||
|
137 00d4 01F0 breq .L11
|
||||||
|
138 00d6 E091 0000 lds r30,UART_RxTail
|
||||||
|
139 00da EF5F subi r30,lo8(-(1))
|
||||||
|
140 00dc EF71 andi r30,lo8(31)
|
||||||
|
141 00de E093 0000 sts UART_RxTail,r30
|
||||||
|
142 00e2 F0E0 ldi r31,0
|
||||||
|
143 00e4 E050 subi r30,lo8(-(UART_RxBuf))
|
||||||
|
144 00e6 F040 sbci r31,hi8(-(UART_RxBuf))
|
||||||
|
145 00e8 2081 ld r18,Z
|
||||||
|
146 00ea 8091 0000 lds r24,UART_LastRxError
|
||||||
|
147 00ee 1092 0000 sts UART_LastRxError,__zero_reg__
|
||||||
|
148 00f2 30E0 ldi r19,0
|
||||||
|
149 00f4 00C0 rjmp .L10
|
||||||
|
150 .L11:
|
||||||
|
151 00f6 20E0 ldi r18,0
|
||||||
|
152 00f8 31E0 ldi r19,lo8(1)
|
||||||
|
153 .L10:
|
||||||
|
154 00fa C901 movw r24,r18
|
||||||
|
155 00fc 0895 ret
|
||||||
|
157 .global uart_putc
|
||||||
|
159 uart_putc:
|
||||||
|
160 /* prologue: function */
|
||||||
|
161 /* frame size = 0 */
|
||||||
|
162 /* stack size = 0 */
|
||||||
|
163 .L__stack_usage = 0
|
||||||
|
164 00fe 9091 0000 lds r25,UART_TxHead
|
||||||
|
165 0102 9F5F subi r25,lo8(-(1))
|
||||||
|
166 0104 9F71 andi r25,lo8(31)
|
||||||
|
167 .L13:
|
||||||
|
168 0106 2091 0000 lds r18,UART_TxTail
|
||||||
|
169 010a 9217 cp r25,r18
|
||||||
|
170 010c 01F0 breq .L13
|
||||||
|
171 010e E92F mov r30,r25
|
||||||
|
172 0110 F0E0 ldi r31,0
|
||||||
|
173 0112 E050 subi r30,lo8(-(UART_TxBuf))
|
||||||
|
174 0114 F040 sbci r31,hi8(-(UART_TxBuf))
|
||||||
|
175 0116 8083 st Z,r24
|
||||||
|
176 0118 9093 0000 sts UART_TxHead,r25
|
||||||
|
177 011c 559A sbi 0xa,5
|
||||||
|
178 011e 0895 ret
|
||||||
|
180 .global uart_puts
|
||||||
|
182 uart_puts:
|
||||||
|
183 0120 CF93 push r28
|
||||||
|
184 0122 DF93 push r29
|
||||||
|
185 /* prologue: function */
|
||||||
|
186 /* frame size = 0 */
|
||||||
|
187 /* stack size = 2 */
|
||||||
|
188 .L__stack_usage = 2
|
||||||
|
189 0124 EC01 movw r28,r24
|
||||||
|
190 0126 00C0 rjmp .L16
|
||||||
|
191 .L17:
|
||||||
|
192 0128 00D0 rcall uart_putc
|
||||||
|
193 .L16:
|
||||||
|
194 012a 8991 ld r24,Y+
|
||||||
|
195 012c 8111 cpse r24,__zero_reg__
|
||||||
|
196 012e 00C0 rjmp .L17
|
||||||
|
197 /* epilogue start */
|
||||||
|
198 0130 DF91 pop r29
|
||||||
|
199 0132 CF91 pop r28
|
||||||
|
200 0134 0895 ret
|
||||||
|
202 .global uart_puts_p
|
||||||
|
204 uart_puts_p:
|
||||||
|
205 0136 CF93 push r28
|
||||||
|
206 0138 DF93 push r29
|
||||||
|
207 /* prologue: function */
|
||||||
|
208 /* frame size = 0 */
|
||||||
|
209 /* stack size = 2 */
|
||||||
|
210 .L__stack_usage = 2
|
||||||
|
211 013a EC01 movw r28,r24
|
||||||
|
212 013c 00C0 rjmp .L19
|
||||||
|
213 .L20:
|
||||||
|
214 013e 00D0 rcall uart_putc
|
||||||
|
215 .L19:
|
||||||
|
216 0140 FE01 movw r30,r28
|
||||||
|
217 0142 2196 adiw r28,1
|
||||||
|
218 /* #APP */
|
||||||
|
219 ; 474 "src/uart.c" 1
|
||||||
|
220 0144 8491 lpm r24, Z
|
||||||
|
221
|
||||||
|
222 ; 0 "" 2
|
||||||
|
223 /* #NOAPP */
|
||||||
|
224 0146 8111 cpse r24,__zero_reg__
|
||||||
|
225 0148 00C0 rjmp .L20
|
||||||
|
226 /* epilogue start */
|
||||||
|
227 014a DF91 pop r29
|
||||||
|
228 014c CF91 pop r28
|
||||||
|
229 014e 0895 ret
|
||||||
|
231 .local UART_LastRxError
|
||||||
|
232 .comm UART_LastRxError,1,1
|
||||||
|
233 .local UART_RxTail
|
||||||
|
234 .comm UART_RxTail,1,1
|
||||||
|
235 .local UART_RxHead
|
||||||
|
236 .comm UART_RxHead,1,1
|
||||||
|
237 .local UART_TxTail
|
||||||
|
238 .comm UART_TxTail,1,1
|
||||||
|
239 .local UART_TxHead
|
||||||
|
240 .comm UART_TxHead,1,1
|
||||||
|
241 .local UART_RxBuf
|
||||||
|
242 .comm UART_RxBuf,32,1
|
||||||
|
243 .local UART_TxBuf
|
||||||
|
244 .comm UART_TxBuf,32,1
|
||||||
|
245 .ident "GCC: (GNU) 4.7.2"
|
||||||
|
246 .global __do_clear_bss
|
||||||
|
DEFINED SYMBOLS
|
||||||
|
*ABS*:0000000000000000 uart.c
|
||||||
|
/tmp/ccbMxLMX.s:2 *ABS*:000000000000003e __SP_H__
|
||||||
|
/tmp/ccbMxLMX.s:3 *ABS*:000000000000003d __SP_L__
|
||||||
|
/tmp/ccbMxLMX.s:4 *ABS*:000000000000003f __SREG__
|
||||||
|
/tmp/ccbMxLMX.s:5 *ABS*:0000000000000000 __tmp_reg__
|
||||||
|
/tmp/ccbMxLMX.s:6 *ABS*:0000000000000001 __zero_reg__
|
||||||
|
/tmp/ccbMxLMX.s:10 .text:0000000000000000 __vector_11
|
||||||
|
/tmp/ccbMxLMX.s:234 .bss:0000000000000002 UART_RxHead
|
||||||
|
/tmp/ccbMxLMX.s:232 .bss:0000000000000001 UART_RxTail
|
||||||
|
/tmp/ccbMxLMX.s:240 .bss:0000000000000005 UART_RxBuf
|
||||||
|
.bss:0000000000000000 UART_LastRxError
|
||||||
|
/tmp/ccbMxLMX.s:60 .text:0000000000000058 __vector_12
|
||||||
|
/tmp/ccbMxLMX.s:238 .bss:0000000000000004 UART_TxHead
|
||||||
|
/tmp/ccbMxLMX.s:236 .bss:0000000000000003 UART_TxTail
|
||||||
|
/tmp/ccbMxLMX.s:242 .bss:0000000000000025 UART_TxBuf
|
||||||
|
/tmp/ccbMxLMX.s:104 .text:00000000000000a2 uart_init
|
||||||
|
/tmp/ccbMxLMX.s:129 .text:00000000000000ca uart_getc
|
||||||
|
/tmp/ccbMxLMX.s:159 .text:00000000000000fe uart_putc
|
||||||
|
/tmp/ccbMxLMX.s:182 .text:0000000000000120 uart_puts
|
||||||
|
/tmp/ccbMxLMX.s:204 .text:0000000000000136 uart_puts_p
|
||||||
|
|
||||||
|
UNDEFINED SYMBOLS
|
||||||
|
__do_clear_bss
|
Binary file not shown.
|
@ -0,0 +1,36 @@
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include "uart.h"
|
||||||
|
|
||||||
|
void wait(uint8_t count) {
|
||||||
|
uint8_t i;
|
||||||
|
if(count == 0) count = 100;
|
||||||
|
for(i=0;i<count;i++) {
|
||||||
|
_delay_ms(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_print_voltage(uint16_t x) {
|
||||||
|
uart_putc(48 + (x / 10000));
|
||||||
|
uart_putc(48 + (x % 10000 /1000));
|
||||||
|
uart_putc('.');
|
||||||
|
uart_putc(48 + (x % 1000 / 100 ));
|
||||||
|
//uart_putc(48 + (x % 100 / 10 ));
|
||||||
|
//uart_putc(48 + (x % 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_print_uint8(uint8_t x) {
|
||||||
|
uart_putc(48 + (x / 100 ));
|
||||||
|
uart_putc(48 + (x % 100 / 10 ));
|
||||||
|
uart_putc(48 + (x % 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
void uart_print_uint16(uint16_t x) {
|
||||||
|
uart_putc(48 + (x / 10000));
|
||||||
|
uart_putc(48 + (x % 10000 /1000));
|
||||||
|
uart_putc(48 + (x % 1000 / 100 ));
|
||||||
|
uart_putc(48 + (x % 100 / 10 ));
|
||||||
|
uart_putc(48 + (x % 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef _utils_h
|
||||||
|
#define _utils_h
|
||||||
|
|
||||||
|
extern void wait(uint8_t count);
|
||||||
|
extern void uart_print_voltage(uint16_t);
|
||||||
|
extern void uart_print_uint8_t(uint8_t);
|
||||||
|
extern void uart_print_uint16(uint16_t);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,191 @@
|
||||||
|
1 .file "utils.c"
|
||||||
|
2 __SP_H__ = 0x3e
|
||||||
|
3 __SP_L__ = 0x3d
|
||||||
|
4 __SREG__ = 0x3f
|
||||||
|
5 __tmp_reg__ = 0
|
||||||
|
6 __zero_reg__ = 1
|
||||||
|
7 .text
|
||||||
|
8 .global wait
|
||||||
|
10 wait:
|
||||||
|
11 /* prologue: function */
|
||||||
|
12 /* frame size = 0 */
|
||||||
|
13 /* stack size = 0 */
|
||||||
|
14 .L__stack_usage = 0
|
||||||
|
15 0000 8111 cpse r24,__zero_reg__
|
||||||
|
16 0002 00C0 rjmp .L2
|
||||||
|
17 0004 84E6 ldi r24,lo8(100)
|
||||||
|
18 .L2:
|
||||||
|
19 0006 90E0 ldi r25,0
|
||||||
|
20 .L3:
|
||||||
|
21 0008 EFE1 ldi r30,lo8(19999)
|
||||||
|
22 000a FEE4 ldi r31,hi8(19999)
|
||||||
|
23 000c 3197 1: sbiw r30,1
|
||||||
|
24 000e 01F4 brne 1b
|
||||||
|
25 0010 00C0 rjmp .
|
||||||
|
26 0012 0000 nop
|
||||||
|
27 0014 9F5F subi r25,lo8(-(1))
|
||||||
|
28 0016 9813 cpse r25,r24
|
||||||
|
29 0018 00C0 rjmp .L3
|
||||||
|
30 /* epilogue start */
|
||||||
|
31 001a 0895 ret
|
||||||
|
33 .global uart_print_voltage
|
||||||
|
35 uart_print_voltage:
|
||||||
|
36 001c EF92 push r14
|
||||||
|
37 001e FF92 push r15
|
||||||
|
38 0020 0F93 push r16
|
||||||
|
39 0022 1F93 push r17
|
||||||
|
40 0024 CF93 push r28
|
||||||
|
41 0026 DF93 push r29
|
||||||
|
42 /* prologue: function */
|
||||||
|
43 /* frame size = 0 */
|
||||||
|
44 /* stack size = 6 */
|
||||||
|
45 .L__stack_usage = 6
|
||||||
|
46 0028 8C01 movw r16,r24
|
||||||
|
47 002a 60E1 ldi r22,lo8(16)
|
||||||
|
48 002c 77E2 ldi r23,lo8(39)
|
||||||
|
49 002e 00D0 rcall __udivmodhi4
|
||||||
|
50 0030 7C01 movw r14,r24
|
||||||
|
51 0032 862F mov r24,r22
|
||||||
|
52 0034 805D subi r24,lo8(-(48))
|
||||||
|
53 0036 00D0 rcall uart_putc
|
||||||
|
54 0038 C8EE ldi r28,lo8(-24)
|
||||||
|
55 003a D3E0 ldi r29,lo8(3)
|
||||||
|
56 003c C701 movw r24,r14
|
||||||
|
57 003e BE01 movw r22,r28
|
||||||
|
58 0040 00D0 rcall __udivmodhi4
|
||||||
|
59 0042 862F mov r24,r22
|
||||||
|
60 0044 805D subi r24,lo8(-(48))
|
||||||
|
61 0046 00D0 rcall uart_putc
|
||||||
|
62 0048 8EE2 ldi r24,lo8(46)
|
||||||
|
63 004a 00D0 rcall uart_putc
|
||||||
|
64 004c C801 movw r24,r16
|
||||||
|
65 004e BE01 movw r22,r28
|
||||||
|
66 0050 00D0 rcall __udivmodhi4
|
||||||
|
67 0052 64E6 ldi r22,lo8(100)
|
||||||
|
68 0054 70E0 ldi r23,0
|
||||||
|
69 0056 00D0 rcall __udivmodhi4
|
||||||
|
70 0058 862F mov r24,r22
|
||||||
|
71 005a 805D subi r24,lo8(-(48))
|
||||||
|
72 /* epilogue start */
|
||||||
|
73 005c DF91 pop r29
|
||||||
|
74 005e CF91 pop r28
|
||||||
|
75 0060 1F91 pop r17
|
||||||
|
76 0062 0F91 pop r16
|
||||||
|
77 0064 FF90 pop r15
|
||||||
|
78 0066 EF90 pop r14
|
||||||
|
79 0068 00C0 rjmp uart_putc
|
||||||
|
81 .global uart_print_uint8
|
||||||
|
83 uart_print_uint8:
|
||||||
|
84 006a 0F93 push r16
|
||||||
|
85 006c 1F93 push r17
|
||||||
|
86 006e CF93 push r28
|
||||||
|
87 0070 DF93 push r29
|
||||||
|
88 0072 1F92 push __zero_reg__
|
||||||
|
89 0074 CDB7 in r28,__SP_L__
|
||||||
|
90 0076 DEB7 in r29,__SP_H__
|
||||||
|
91 /* prologue: function */
|
||||||
|
92 /* frame size = 1 */
|
||||||
|
93 /* stack size = 5 */
|
||||||
|
94 .L__stack_usage = 5
|
||||||
|
95 0078 082F mov r16,r24
|
||||||
|
96 007a 64E6 ldi r22,lo8(100)
|
||||||
|
97 007c 00D0 rcall __udivmodqi4
|
||||||
|
98 007e 805D subi r24,lo8(-(48))
|
||||||
|
99 0080 9983 std Y+1,r25
|
||||||
|
100 0082 00D0 rcall uart_putc
|
||||||
|
101 0084 1AE0 ldi r17,lo8(10)
|
||||||
|
102 0086 9981 ldd r25,Y+1
|
||||||
|
103 0088 892F mov r24,r25
|
||||||
|
104 008a 612F mov r22,r17
|
||||||
|
105 008c 00D0 rcall __udivmodqi4
|
||||||
|
106 008e 805D subi r24,lo8(-(48))
|
||||||
|
107 0090 00D0 rcall uart_putc
|
||||||
|
108 0092 802F mov r24,r16
|
||||||
|
109 0094 612F mov r22,r17
|
||||||
|
110 0096 00D0 rcall __udivmodqi4
|
||||||
|
111 0098 892F mov r24,r25
|
||||||
|
112 009a 805D subi r24,lo8(-(48))
|
||||||
|
113 /* epilogue start */
|
||||||
|
114 009c 0F90 pop __tmp_reg__
|
||||||
|
115 009e DF91 pop r29
|
||||||
|
116 00a0 CF91 pop r28
|
||||||
|
117 00a2 1F91 pop r17
|
||||||
|
118 00a4 0F91 pop r16
|
||||||
|
119 00a6 00C0 rjmp uart_putc
|
||||||
|
121 .global uart_print_uint16
|
||||||
|
123 uart_print_uint16:
|
||||||
|
124 00a8 EF92 push r14
|
||||||
|
125 00aa FF92 push r15
|
||||||
|
126 00ac 0F93 push r16
|
||||||
|
127 00ae 1F93 push r17
|
||||||
|
128 00b0 CF93 push r28
|
||||||
|
129 00b2 DF93 push r29
|
||||||
|
130 /* prologue: function */
|
||||||
|
131 /* frame size = 0 */
|
||||||
|
132 /* stack size = 6 */
|
||||||
|
133 .L__stack_usage = 6
|
||||||
|
134 00b4 EC01 movw r28,r24
|
||||||
|
135 00b6 60E1 ldi r22,lo8(16)
|
||||||
|
136 00b8 77E2 ldi r23,lo8(39)
|
||||||
|
137 00ba 00D0 rcall __udivmodhi4
|
||||||
|
138 00bc 7C01 movw r14,r24
|
||||||
|
139 00be 862F mov r24,r22
|
||||||
|
140 00c0 805D subi r24,lo8(-(48))
|
||||||
|
141 00c2 00D0 rcall uart_putc
|
||||||
|
142 00c4 08EE ldi r16,lo8(-24)
|
||||||
|
143 00c6 13E0 ldi r17,lo8(3)
|
||||||
|
144 00c8 C701 movw r24,r14
|
||||||
|
145 00ca B801 movw r22,r16
|
||||||
|
146 00cc 00D0 rcall __udivmodhi4
|
||||||
|
147 00ce 862F mov r24,r22
|
||||||
|
148 00d0 805D subi r24,lo8(-(48))
|
||||||
|
149 00d2 00D0 rcall uart_putc
|
||||||
|
150 00d4 CE01 movw r24,r28
|
||||||
|
151 00d6 B801 movw r22,r16
|
||||||
|
152 00d8 00D0 rcall __udivmodhi4
|
||||||
|
153 00da 04E6 ldi r16,lo8(100)
|
||||||
|
154 00dc 10E0 ldi r17,0
|
||||||
|
155 00de B801 movw r22,r16
|
||||||
|
156 00e0 00D0 rcall __udivmodhi4
|
||||||
|
157 00e2 862F mov r24,r22
|
||||||
|
158 00e4 805D subi r24,lo8(-(48))
|
||||||
|
159 00e6 00D0 rcall uart_putc
|
||||||
|
160 00e8 CE01 movw r24,r28
|
||||||
|
161 00ea B801 movw r22,r16
|
||||||
|
162 00ec 00D0 rcall __udivmodhi4
|
||||||
|
163 00ee 0AE0 ldi r16,lo8(10)
|
||||||
|
164 00f0 10E0 ldi r17,0
|
||||||
|
165 00f2 B801 movw r22,r16
|
||||||
|
166 00f4 00D0 rcall __udivmodhi4
|
||||||
|
167 00f6 862F mov r24,r22
|
||||||
|
168 00f8 805D subi r24,lo8(-(48))
|
||||||
|
169 00fa 00D0 rcall uart_putc
|
||||||
|
170 00fc CE01 movw r24,r28
|
||||||
|
171 00fe B801 movw r22,r16
|
||||||
|
172 0100 00D0 rcall __udivmodhi4
|
||||||
|
173 0102 805D subi r24,lo8(-(48))
|
||||||
|
174 /* epilogue start */
|
||||||
|
175 0104 DF91 pop r29
|
||||||
|
176 0106 CF91 pop r28
|
||||||
|
177 0108 1F91 pop r17
|
||||||
|
178 010a 0F91 pop r16
|
||||||
|
179 010c FF90 pop r15
|
||||||
|
180 010e EF90 pop r14
|
||||||
|
181 0110 00C0 rjmp uart_putc
|
||||||
|
183 .ident "GCC: (GNU) 4.7.2"
|
||||||
|
DEFINED SYMBOLS
|
||||||
|
*ABS*:0000000000000000 utils.c
|
||||||
|
/tmp/ccrqDXwV.s:2 *ABS*:000000000000003e __SP_H__
|
||||||
|
/tmp/ccrqDXwV.s:3 *ABS*:000000000000003d __SP_L__
|
||||||
|
/tmp/ccrqDXwV.s:4 *ABS*:000000000000003f __SREG__
|
||||||
|
/tmp/ccrqDXwV.s:5 *ABS*:0000000000000000 __tmp_reg__
|
||||||
|
/tmp/ccrqDXwV.s:6 *ABS*:0000000000000001 __zero_reg__
|
||||||
|
/tmp/ccrqDXwV.s:10 .text:0000000000000000 wait
|
||||||
|
/tmp/ccrqDXwV.s:35 .text:000000000000001c uart_print_voltage
|
||||||
|
/tmp/ccrqDXwV.s:83 .text:000000000000006a uart_print_uint8
|
||||||
|
/tmp/ccrqDXwV.s:123 .text:00000000000000a8 uart_print_uint16
|
||||||
|
|
||||||
|
UNDEFINED SYMBOLS
|
||||||
|
__udivmodhi4
|
||||||
|
uart_putc
|
||||||
|
__udivmodqi4
|
Binary file not shown.
Loading…
Reference in New Issue