Permalink
Browse files

First working version

  • Loading branch information...
1 parent c064339 commit 00f351e0878cd7fd3e47bf2abe1e936134019db7 @logandk committed Aug 24, 2013
Showing with 1,859 additions and 37 deletions.
  1. +978 −0 build/sous-vide.ewd
  2. +6 −16 build/sous-vide.ewp
  3. +17 −0 include/pid.h
  4. +2 −2 include/stm32f30x_lcd.h
  5. +9 −0 include/stm32f30x_timer.h
  6. +645 −0 schematic.dsn
  7. +82 −19 src/main.c
  8. +96 −0 src/pid.c
  9. +24 −0 src/stm32f30x_timer.c
  10. BIN symbols.TCLib
View
978 build/sous-vide.ewd
@@ -0,0 +1,978 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<project>
+ <fileVersion>2</fileVersion>
+ <configuration>
+ <name>sous-vide</name>
+ <toolchain>
+ <name>ARM</name>
+ </toolchain>
+ <debug>1</debug>
+ <settings>
+ <name>C-SPY</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>23</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>CInput</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CEndian</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OCVariant</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MacOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MacFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>MemOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>MemFile</name>
+ <state></state>
+ </option>
+ <option>
+ <name>RunToEnable</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>RunToName</name>
+ <state>main</state>
+ </option>
+ <option>
+ <name>CExtraOptionsCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CExtraOptions</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CFpuProcessor</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OCDDFArgumentProducer</name>
+ <state></state>
+ </option>
+ <option>
+ <name>OCDownloadSuppressDownload</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCDownloadVerifyAll</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCProductVersion</name>
+ <state>6.21.1.52845</state>
+ </option>
+ <option>
+ <name>OCDynDriverList</name>
+ <state>STLINK_ID</state>
+ </option>
+ <option>
+ <name>OCLastSavedByProductVersion</name>
+ <state>6.30.7.53437</state>
+ </option>
+ <option>
+ <name>OCDownloadAttachToProgram</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>UseFlashLoader</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CLowLevel</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OCBE8Slave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>MacFile2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CDevice</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>FlashLoadersV3</name>
+ <state>$TOOLKIT_DIR$\config\flashloader\</state>
+ </option>
+ <option>
+ <name>OCImagesSuppressCheck1</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCImagesPath1</name>
+ <state></state>
+ </option>
+ <option>
+ <name>OCImagesSuppressCheck2</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCImagesPath2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>OCImagesSuppressCheck3</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCImagesPath3</name>
+ <state></state>
+ </option>
+ <option>
+ <name>OverrideDefFlashBoard</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCImagesOffset1</name>
+ <state></state>
+ </option>
+ <option>
+ <name>OCImagesOffset2</name>
+ <state></state>
+ </option>
+ <option>
+ <name>OCImagesOffset3</name>
+ <state></state>
+ </option>
+ <option>
+ <name>OCImagesUse1</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCImagesUse2</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCImagesUse3</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCDeviceConfigMacroFile</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>ARMSIM_ID</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>1</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>OCSimDriverInfo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OCSimEnablePSP</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCSimPspOverrideConfig</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCSimPspConfigFile</name>
+ <state></state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>ANGEL_ID</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>0</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>CCAngelHeartbeat</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CAngelCommunication</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CAngelCommBaud</name>
+ <version>0</version>
+ <state>3</state>
+ </option>
+ <option>
+ <name>CAngelCommPort</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>ANGELTCPIP</name>
+ <state>aaa.bbb.ccc.ddd</state>
+ </option>
+ <option>
+ <name>DoAngelLogfile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>AngelLogFile</name>
+ <state>$PROJ_DIR$\cspycomm.log</state>
+ </option>
+ <option>
+ <name>OCDriverInfo</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>GDBSERVER_ID</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>0</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>OCDriverInfo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>TCPIP</name>
+ <state>aaa.bbb.ccc.ddd</state>
+ </option>
+ <option>
+ <name>DoLogfile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>LogFile</name>
+ <state>$PROJ_DIR$\cspycomm.log</state>
+ </option>
+ <option>
+ <name>CCJTagBreakpointRadio</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCJTagDoUpdateBreakpoints</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCJTagUpdateBreakpoints</name>
+ <state>_call_main</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>IARROM_ID</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>1</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>CRomLogFileCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CRomLogFileEditB</name>
+ <state>$PROJ_DIR$\cspycomm.log</state>
+ </option>
+ <option>
+ <name>CRomCommPort</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CRomCommBaud</name>
+ <version>0</version>
+ <state>7</state>
+ </option>
+ <option>
+ <name>OCDriverInfo</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>JLINK_ID</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>14</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>JLinkSpeed</name>
+ <state>32</state>
+ </option>
+ <option>
+ <name>CCJLinkDoLogfile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCJLinkLogFile</name>
+ <state>$PROJ_DIR$\cspycomm.log</state>
+ </option>
+ <option>
+ <name>CCJLinkHWResetDelay</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCDriverInfo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>JLinkInitialSpeed</name>
+ <state>32</state>
+ </option>
+ <option>
+ <name>CCDoJlinkMultiTarget</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCScanChainNonARMDevices</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCJLinkMultiTarget</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCJLinkIRLength</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCJLinkCommRadio</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCJLinkTCPIP</name>
+ <state>aaa.bbb.ccc.ddd</state>
+ </option>
+ <option>
+ <name>CCJLinkSpeedRadioV2</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCUSBDevice</name>
+ <version>1</version>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCRDICatchReset</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchUndef</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchSWI</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchData</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchPrefetch</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchIRQ</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchFIQ</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCJLinkBreakpointRadio</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCJLinkDoUpdateBreakpoints</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCJLinkUpdateBreakpoints</name>
+ <state>_call_main</state>
+ </option>
+ <option>
+ <name>CCJLinkInterfaceRadio</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCJLinkAttachSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCJLinkResetList</name>
+ <version>6</version>
+ <state>5</state>
+ </option>
+ <option>
+ <name>CCJLinkInterfaceCmdLine</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCatchCORERESET</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCatchMMERR</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCatchNOCPERR</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCatchCHRERR</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCatchSTATERR</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCatchBUSERR</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCatchINTERR</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCatchHARDERR</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCatchDummy</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCJLinkScriptFile</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCJLinkUsbSerialNo</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCTcpIpAlt</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCJLinkTcpIpSerialNo</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCCpuClockEdit</name>
+ <state>72.0</state>
+ </option>
+ <option>
+ <name>CCSwoClockAuto</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCSwoClockEdit</name>
+ <state>2000</state>
+ </option>
+ <option>
+ <name>OCJLinkTraceSource</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCJLinkTraceSourceDummy</name>
+ <state>0</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>LMIFTDI_ID</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>2</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>OCDriverInfo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>LmiftdiSpeed</name>
+ <state>500</state>
+ </option>
+ <option>
+ <name>CCLmiftdiDoLogfile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCLmiftdiLogFile</name>
+ <state>$PROJ_DIR$\cspycomm.log</state>
+ </option>
+ <option>
+ <name>CCLmiFtdiInterfaceRadio</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCLmiFtdiInterfaceCmdLine</name>
+ <state>0</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>MACRAIGOR_ID</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>3</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>jtag</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>EmuSpeed</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>TCPIP</name>
+ <state>aaa.bbb.ccc.ddd</state>
+ </option>
+ <option>
+ <name>DoLogfile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>LogFile</name>
+ <state>$PROJ_DIR$\cspycomm.log</state>
+ </option>
+ <option>
+ <name>DoEmuMultiTarget</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>EmuMultiTarget</name>
+ <state>0@ARM7TDMI</state>
+ </option>
+ <option>
+ <name>EmuHWReset</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CEmuCommBaud</name>
+ <version>0</version>
+ <state>4</state>
+ </option>
+ <option>
+ <name>CEmuCommPort</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>jtago</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCDriverInfo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>UnusedAddr</name>
+ <state>0x00800000</state>
+ </option>
+ <option>
+ <name>CCMacraigorHWResetDelay</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCJTagBreakpointRadio</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCJTagDoUpdateBreakpoints</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCJTagUpdateBreakpoints</name>
+ <state>_call_main</state>
+ </option>
+ <option>
+ <name>CCMacraigorInterfaceRadio</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCMacraigorInterfaceCmdLine</name>
+ <state>0</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>PEMICRO_ID</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>0</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>OCDriverInfo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OCPEMicroAttachSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCPEMicroInterfaceList</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPEMicroResetDelay</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCPEMicroJtagSpeed</name>
+ <state>#UNINITIALIZED#</state>
+ </option>
+ <option>
+ <name>CCJPEMicroShowSettings</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>DoLogfile</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>LogFile</name>
+ <state>$PROJ_DIR$\cspycomm.log</state>
+ </option>
+ <option>
+ <name>CCPEMicroUSBDevice</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCPEMicroSerialPort</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCJPEMicroTCPIPAutoScanNetwork</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCPEMicroTCPIP</name>
+ <state>10.0.0.1</state>
+ </option>
+ <option>
+ <name>CCPEMicroCommCmdLineProducer</name>
+ <state>0</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>RDI_ID</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>2</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>CRDIDriverDll</name>
+ <state>###Uninitialized###</state>
+ </option>
+ <option>
+ <name>CRDILogFileCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CRDILogFileEdit</name>
+ <state>$PROJ_DIR$\cspycomm.log</state>
+ </option>
+ <option>
+ <name>CCRDIHWReset</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchReset</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchUndef</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchSWI</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchData</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchPrefetch</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchIRQ</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchFIQ</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCDriverInfo</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>RDIJTAGJET_ID</name>
+ <archiveVersion>0</archiveVersion>
+ <data>
+ <version>1</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>CRDILogFileCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CRDILogFileEdit</name>
+ <state>$PROJ_DIR$\cspycomm.log</state>
+ </option>
+ <option>
+ <name>CCRDIHWReset</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchReset</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchUndef</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchSWI</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchData</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchPrefetch</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchIRQ</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCRDICatchFIQ</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>OCDriverInfo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>JTAGjetConfigure</name>
+ <state></state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>STLINK_ID</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>2</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>OCDriverInfo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCSTLinkInterfaceRadio</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>CCSTLinkInterfaceCmdLine</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCSTLinkResetList</name>
+ <version>1</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCCpuClockEdit</name>
+ <state>72.0</state>
+ </option>
+ <option>
+ <name>CCSwoClockAuto</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CCSwoClockEdit</name>
+ <state>2000</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>THIRDPARTY_ID</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>0</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>CThirdPartyDriverDll</name>
+ <state>###Uninitialized###</state>
+ </option>
+ <option>
+ <name>CThirdPartyLogFileCheck</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>CThirdPartyLogFileEditB</name>
+ <state>$PROJ_DIR$\cspycomm.log</state>
+ </option>
+ <option>
+ <name>OCDriverInfo</name>
+ <state>1</state>
+ </option>
+ </data>
+ </settings>
+ <settings>
+ <name>XDS100_ID</name>
+ <archiveVersion>2</archiveVersion>
+ <data>
+ <version>1</version>
+ <wantNonLocal>1</wantNonLocal>
+ <debug>1</debug>
+ <option>
+ <name>OCDriverInfo</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>OCXDS100AttachSlave</name>
+ <state>1</state>
+ </option>
+ <option>
+ <name>TIPackageOverride</name>
+ <state>0</state>
+ </option>
+ <option>
+ <name>TIPackage</name>
+ <state></state>
+ </option>
+ <option>
+ <name>CCXds100InterfaceList</name>
+ <version>0</version>
+ <state>0</state>
+ </option>
+ <option>
+ <name>BoardFile</name>
+ <state></state>
+ </option>
+ </data>
+ </settings>
+ <debuggerPlugins>
+ <plugin>
+ <file>$TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin</file>
+ <loadFlag>0</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin</file>
+ <loadFlag>0</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin</file>
+ <loadFlag>0</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>
+ <loadFlag>0</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin</file>
+ <loadFlag>0</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin</file>
+ <loadFlag>0</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin</file>
+ <loadFlag>0</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB6_Plugin.ewplugin</file>
+ <loadFlag>0</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin</file>
+ <loadFlag>0</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin</file>
+ <loadFlag>0</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file>
+ <loadFlag>0</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>
+ <loadFlag>0</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin</file>
+ <loadFlag>0</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file>
+ <loadFlag>1</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
+ <loadFlag>0</loadFlag>
+ </plugin>
+ <plugin>
+ <file>$EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin</file>
+ <loadFlag>1</loadFlag>
+ </plugin>
+ </debuggerPlugins>
+ </configuration>
+</project>
+
+
View
22 build/sous-vide.ewp
@@ -153,10 +153,6 @@
<name>OGUseCmsisDspLib</name>
<state>0</state>
</option>
- <option>
- <name>GRuntimeLibThreads</name>
- <state>0</state>
- </option>
</data>
</settings>
<settings>
@@ -398,10 +394,6 @@
<name>IccFloatSemantics</name>
<state>0</state>
</option>
- <option>
- <name>CCNoLiteralPool</name>
- <state>0</state>
- </option>
</data>
</settings>
<settings>
@@ -564,10 +556,6 @@
<name>AExtraOptionsV2</name>
<state></state>
</option>
- <option>
- <name>AsmNoLiteralPool</name>
- <state>0</state>
- </option>
</data>
</settings>
<settings>
@@ -905,10 +893,6 @@
<version>0</version>
<state>0</state>
</option>
- <option>
- <name>IlinkThreadsSlave</name>
- <state>1</state>
- </option>
</data>
</settings>
<settings>
@@ -971,6 +955,9 @@
<name>$PROJ_DIR$\..\src\main.c</name>
</file>
<file>
+ <name>$PROJ_DIR$\..\src\pid.c</name>
+ </file>
+ <file>
<name>$PROJ_DIR$\..\src\stm32f30x_lcd.c</name>
</file>
<file>
@@ -979,6 +966,9 @@
<file>
<name>$PROJ_DIR$\..\src\stm32f30x_temp.c</name>
</file>
+ <file>
+ <name>$PROJ_DIR$\..\src\stm32f30x_timer.c</name>
+ </file>
</group>
</project>
View
17 include/pid.h
@@ -0,0 +1,17 @@
+/**
+ * Ported from http://playground.arduino.cc/Code/PIDLibrary
+ */
+
+#ifndef PID_H
+#define PID_H
+
+#include "stm32f30x.h"
+
+uint8_t pid_compute(double input);
+double pid_get_output();
+void pid_set_target(double target);
+void pid_set_tuning(double k_p, double k_i, double k_d);
+void pid_set_interval(uint32_t interval);
+void pid_set_limits(double min, double max);
+
+#endif
View
4 include/stm32f30x_lcd.h
@@ -5,7 +5,7 @@
* Wiring:
* 1. ground
* 2. +5V (supply)
- * 3. X ohm to supply (contrast)
+ * 3. 2.7k ohm to supply (contrast)
* 4. pin_register_select
* 5. ground (read/write)
* 6. pin_enable
@@ -17,7 +17,7 @@
* 12. pin_d5 (data)
* 13. pin_d6 (data)
* 14. pin_d7 (data)
- * 15. X ohm to supply (led anode)
+ * 15. 670 ohm to supply (led anode)
* 16. ground (led cathode)
*/
View
9 include/stm32f30x_timer.h
@@ -0,0 +1,9 @@
+#ifndef STM32F30x_TIMER_H
+#define STM32F30x_TIMER_H
+
+#include "stm32f30x.h"
+
+void timer_init();
+uint32_t timer_now();
+
+#endif
View
645 schematic.dsn
@@ -0,0 +1,645 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--This file was written by TinyCAD Version 2.80.03 Build #514 Production Release
+If you wish to view this file go to http://tinycad.sourceforge.net to
+download a copy.-->
+<TinyCADSheets>
+ <TinyCAD>
+ <NAME>Sheet 1</NAME>
+ <DETAILS>
+ <Size width='1485' height='1050'/>
+ <GUIDES horiz='7' vert='5'/>
+ <TITLE></TITLE>
+ <AUTHOR></AUTHOR>
+ <REVISION>1.0</REVISION>
+ <DOCNUMBER></DOCNUMBER>
+ <ORGANISATION></ORGANISATION>
+ <SHEETS>1 of 1</SHEETS>
+ <SHOWS>1</SHOWS>
+ <DATE></DATE>
+ <GRID spacing='100.00000' snap='1'/>
+ </DETAILS>
+ <FONT id='1'>
+ <HEIGHT>-10</HEIGHT>
+ <WIDTH>0</WIDTH>
+ <WEIGHT>400</WEIGHT>
+ <ITALIC>0</ITALIC>
+ <UNDERLINE>0</UNDERLINE>
+ <STRIKEOUT>0</STRIKEOUT>
+ <CHARSET>0</CHARSET>
+ <FACENAME>Arial</FACENAME>
+ </FONT>
+ <FONT id='3'>
+ <HEIGHT>-13</HEIGHT>
+ <WIDTH>6</WIDTH>
+ <WEIGHT>400</WEIGHT>
+ <ITALIC>0</ITALIC>
+ <UNDERLINE>0</UNDERLINE>
+ <STRIKEOUT>0</STRIKEOUT>
+ <CHARSET>0</CHARSET>
+ <FACENAME>Arial</FACENAME>
+ </FONT>
+ <STYLE id='4'>
+ <STYLE>0</STYLE>
+ <COLOR>000000</COLOR>
+ <THICKNESS>2</THICKNESS>
+ </STYLE>
+ <STYLE id='5'>
+ <STYLE>0</STYLE>
+ <COLOR>000000</COLOR>
+ <THICKNESS>1</THICKNESS>
+ </STYLE>
+ <STYLE id='6'>
+ <STYLE>2</STYLE>
+ <COLOR>000000</COLOR>
+ <THICKNESS>1</THICKNESS>
+ </STYLE>
+ <STYLE id='7'>
+ <STYLE>0</STYLE>
+ <COLOR>000000</COLOR>
+ <THICKNESS>1</THICKNESS>
+ </STYLE>
+ <FILL id='0'>
+ <INDEX>-1</INDEX>
+ <COLOR>000000</COLOR>
+ </FILL>
+ <SYMBOLDEF id='1'>
+ <NAME type='0'>RELAY_SPST_NO</NAME>
+ <REF type='1'>REL?</REF>
+ <DESCRIPTION></DESCRIPTION>
+ <PPP>1</PPP>
+ <FIELD>
+ <NAME>Package</NAME>
+ <DEFAULT></DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>V_Max</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>I_Max</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>R_Max</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>V_Max_AC</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>I_Max_AC</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>V_Coil</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>I_Coil</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>V_Coil_Max</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>I_Coil_Max</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>P_Coil_Max</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Manufacturer</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Manufacturer Part</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Digi-Key Part</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Newark Part</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Mouser Part</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Cost</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <REF_POINT power='0' part='0' pos='50.00000,53.00000'/>
+ <TinyCAD>
+ <ELLIPSE a='43.00000,46.00000' b='45.00000,48.00000' style='4' fill='0'/>
+ <POLYGON pos='37.80000,45.00000' style='5' fill='0'>
+ <POINT pos='0.08264,1.68127' arc='0'/>
+ <POINT pos='5.20000,0.00000' arc='0'/>
+ </POLYGON>
+ <PIN pos='30.00000,47.00000' which='0' elec='4' direction='3' part='0' number='1' show='1' length='25' number_pos='0' centre_name='0'></PIN>
+ <PIN pos='50.00000,47.00000' which='0' elec='4' direction='2' part='0' number='2' show='1' length='20' number_pos='0' centre_name='0'></PIN>
+ <ELLIPSE a='36.00000,46.00000' b='38.00000,48.00000' style='4' fill='0'/>
+ <POLYGON pos='35.00000,47.00000' style='5' fill='0'>
+ <POINT pos='1.00000,0.00000' arc='0'/>
+ <POINT pos='0.00000,0.00000' arc='0'/>
+ </POLYGON>
+ <POLYGON pos='45.00000,47.00000' style='5' fill='0'>
+ <POINT pos='0.00000,0.00000' arc='0'/>
+ <POINT pos='1.00000,0.00000' arc='2'/>
+ </POLYGON>
+ <POLYGON pos='40.00000,44.00000' style='6' fill='0'>
+ <POINT pos='0.00000,0.00000' arc='0'/>
+ <POINT pos='0.00000,7.00000' arc='0'/>
+ </POLYGON>
+ <PIN pos='50.00000,41.00000' which='0' elec='4' direction='2' part='0' number='1' show='1' length='25' number_pos='0' centre_name='0'></PIN>
+ <PIN pos='30.00000,41.00000' which='0' elec='4' direction='3' part='0' number='2' show='1' length='25' number_pos='0' centre_name='0'></PIN>
+ <POLYGON pos='43.00000,40.00000' style='5' fill='0'>
+ <POINT pos='1.00000,0.00000' arc='0'/>
+ <POINT pos='0.00000,1.00000' arc='2'/>
+ </POLYGON>
+ <POLYGON pos='44.00000,40.00000' style='5' fill='0'>
+ <POINT pos='0.00000,0.00000' arc='0'/>
+ <POINT pos='1.00000,1.00000' arc='2'/>
+ </POLYGON>
+ <POLYGON pos='41.00000,40.00000' style='5' fill='0'>
+ <POINT pos='1.00000,0.00000' arc='0'/>
+ <POINT pos='0.00000,1.00000' arc='2'/>
+ </POLYGON>
+ <POLYGON pos='42.00000,40.00000' style='5' fill='0'>
+ <POINT pos='0.00000,0.00000' arc='0'/>
+ <POINT pos='1.00000,1.00000' arc='2'/>
+ </POLYGON>
+ <POLYGON pos='39.00000,40.00000' style='5' fill='0'>
+ <POINT pos='1.00000,0.00000' arc='0'/>
+ <POINT pos='0.00000,1.00000' arc='2'/>
+ </POLYGON>
+ <POLYGON pos='40.00000,40.00000' style='5' fill='0'>
+ <POINT pos='0.00000,0.00000' arc='0'/>
+ <POINT pos='1.00000,1.00000' arc='2'/>
+ </POLYGON>
+ <POLYGON pos='37.00000,40.00000' style='5' fill='0'>
+ <POINT pos='1.00000,0.00000' arc='0'/>
+ <POINT pos='0.00000,1.00000' arc='2'/>
+ </POLYGON>
+ <POLYGON pos='38.00000,40.00000' style='5' fill='0'>
+ <POINT pos='0.00000,0.00000' arc='0'/>
+ <POINT pos='1.00000,1.00000' arc='2'/>
+ </POLYGON>
+ <POLYGON pos='35.00000,40.00000' style='5' fill='0'>
+ <POINT pos='1.00000,0.00000' arc='0'/>
+ <POINT pos='0.00000,1.00000' arc='2'/>
+ </POLYGON>
+ <POLYGON pos='36.00000,40.00000' style='5' fill='0'>
+ <POINT pos='0.00000,0.00000' arc='0'/>
+ <POINT pos='1.00000,1.00000' arc='2'/>
+ </POLYGON>
+ <POLYGON pos='36.00000,43.00000' style='5' fill='0'>
+ <POINT pos='8.00000,0.00000' arc='0'/>
+ <POINT pos='0.00000,0.00000' arc='0'/>
+ </POLYGON>
+ <POLYGON pos='36.00000,42.00000' style='5' fill='0'>
+ <POINT pos='8.00000,0.00000' arc='0'/>
+ <POINT pos='0.00000,0.00000' arc='2'/>
+ </POLYGON>
+ <RECTANGLE a='33.00000,39.00000' b='47.00000,52.00000' style='5' fill='0'/>
+ </TinyCAD>
+ </SYMBOLDEF>
+ <SYMBOLDEF id='2'>
+ <NAME type='0'>DS18B20</NAME>
+ <REF type='0'>U?</REF>
+ <DESCRIPTION>DS18B20</DESCRIPTION>
+ <PPP>1</PPP>
+ <FIELD>
+ <NAME>$$SPICE_PROLOG_PRIORITY</NAME>
+ <DEFAULT>5</DEFAULT>
+ <FT>000002</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>$$SPICE_EPILOG_PRIORITY</NAME>
+ <DEFAULT>5</DEFAULT>
+ <FT>000002</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Package</NAME>
+ <DEFAULT>package name for PCB layout</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <REF_POINT power='0' part='0' pos='134.00000,64.00000'/>
+ <REF_POINT power='1' part='0' pos='134.00000,64.00000'/>
+ <TinyCAD>
+ <PIN pos='118.00000,64.00000' which='0' elec='0' direction='0' part='0' number='1' show='3' length='30' number_pos='0' centre_name='0'>RED</PIN>
+ <PIN pos='122.00000,64.00000' which='0' elec='0' direction='0' part='0' number='2' show='3' length='30' number_pos='0' centre_name='0'>BLUE</PIN>
+ <PIN pos='126.00000,64.00000' which='0' elec='0' direction='0' part='0' number='3' show='3' length='30' number_pos='0' centre_name='0'>BLACK</PIN>
+ <RECTANGLE a='110.00000,44.00000' b='134.00000,58.00000' style='5' fill='0'/>
+ <TEXT pos='116.00000,48.00000' direction='3' font='3' color='000000'>DS18B20</TEXT>
+ </TinyCAD>
+ </SYMBOLDEF>
+ <SYMBOLDEF id='3'>
+ <NAME type='0'>HD44780</NAME>
+ <REF type='0'>U?</REF>
+ <DESCRIPTION>HD44780</DESCRIPTION>
+ <PPP>1</PPP>
+ <FIELD>
+ <NAME>$$SPICE_PROLOG_PRIORITY</NAME>
+ <DEFAULT>5</DEFAULT>
+ <FT>000002</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>$$SPICE_EPILOG_PRIORITY</NAME>
+ <DEFAULT>5</DEFAULT>
+ <FT>000002</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Package</NAME>
+ <DEFAULT>package name for PCB layout</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <REF_POINT power='0' part='0' pos='122.00000,98.00000'/>
+ <TinyCAD>
+ <PIN pos='74.00000,98.00000' which='0' elec='0' direction='0' part='0' number='1' show='3' length='30' number_pos='0' centre_name='0'>VSS</PIN>
+ <PIN pos='78.00000,98.00000' which='0' elec='0' direction='0' part='0' number='2' show='3' length='30' number_pos='0' centre_name='0'>VDD</PIN>
+ <PIN pos='82.00000,98.00000' which='0' elec='0' direction='0' part='0' number='3' show='3' length='30' number_pos='0' centre_name='0'>V0</PIN>
+ <PIN pos='86.00000,98.00000' which='0' elec='0' direction='0' part='0' number='4' show='3' length='30' number_pos='0' centre_name='0'>RS</PIN>
+ <PIN pos='90.00000,98.00000' which='0' elec='0' direction='0' part='0' number='5' show='3' length='30' number_pos='0' centre_name='0'>RW</PIN>
+ <PIN pos='94.00000,98.00000' which='0' elec='0' direction='0' part='0' number='6' show='3' length='30' number_pos='0' centre_name='0'>E</PIN>
+ <PIN pos='98.00000,98.00000' which='0' elec='0' direction='0' part='0' number='7' show='3' length='30' number_pos='0' centre_name='0'>D4</PIN>
+ <PIN pos='102.00000,98.00000' which='0' elec='0' direction='0' part='0' number='8' show='3' length='30' number_pos='0' centre_name='0'>D5</PIN>
+ <PIN pos='106.00000,98.00000' which='0' elec='0' direction='0' part='0' number='9' show='3' length='30' number_pos='0' centre_name='0'>D6</PIN>
+ <PIN pos='110.00000,98.00000' which='0' elec='0' direction='0' part='0' number='10' show='3' length='30' number_pos='0' centre_name='0'>D7</PIN>
+ <PIN pos='114.00000,98.00000' which='0' elec='0' direction='0' part='0' number='11' show='3' length='30' number_pos='0' centre_name='0'>A</PIN>
+ <PIN pos='118.00000,98.00000' which='0' elec='0' direction='0' part='0' number='12' show='3' length='30' number_pos='0' centre_name='0'>K</PIN>
+ <TEXT pos='90.00000,82.00000' direction='3' font='3' color='000000'>HD44781</TEXT>
+ <RECTANGLE a='70.00000,78.00000' b='122.00000,92.00000' style='5' fill='0'/>
+ </TinyCAD>
+ </SYMBOLDEF>
+ <SYMBOLDEF id='4'>
+ <NAME type='0'>STM32F3DISCOVERY</NAME>
+ <REF type='0'>U?</REF>
+ <DESCRIPTION>STM32F3DISCOVERY</DESCRIPTION>
+ <PPP>1</PPP>
+ <FIELD>
+ <NAME>$$SPICE_PROLOG_PRIORITY</NAME>
+ <DEFAULT>5</DEFAULT>
+ <FT>000002</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>$$SPICE_EPILOG_PRIORITY</NAME>
+ <DEFAULT>5</DEFAULT>
+ <FT>000002</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Package</NAME>
+ <DEFAULT>package name for PCB layout</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <REF_POINT power='0' part='0' pos='114.00000,54.00000'/>
+ <TinyCAD>
+ <PIN pos='70.00000,38.00000' which='0' elec='0' direction='3' part='0' number='1' show='3' length='30' number_pos='0' centre_name='0'>PA8</PIN>
+ <PIN pos='70.00000,42.00000' which='0' elec='0' direction='3' part='0' number='2' show='3' length='30' number_pos='0' centre_name='0'>PC6</PIN>
+ <PIN pos='70.00000,46.00000' which='0' elec='0' direction='3' part='0' number='3' show='3' length='30' number_pos='0' centre_name='0'>PD8</PIN>
+ <PIN pos='70.00000,50.00000' which='0' elec='0' direction='3' part='0' number='4' show='3' length='30' number_pos='0' centre_name='0'>PD9</PIN>
+ <PIN pos='114.00000,38.00000' which='0' elec='0' direction='2' part='0' number='5' show='3' length='30' number_pos='0' centre_name='0'>PD10</PIN>
+ <PIN pos='114.00000,42.00000' which='0' elec='0' direction='2' part='0' number='6' show='3' length='30' number_pos='0' centre_name='0'>PD11</PIN>
+ <PIN pos='114.00000,46.00000' which='0' elec='0' direction='2' part='0' number='7' show='3' length='30' number_pos='0' centre_name='0'>PD12</PIN>
+ <PIN pos='114.00000,50.00000' which='0' elec='0' direction='2' part='0' number='8' show='3' length='30' number_pos='0' centre_name='0'>PD13</PIN>
+ <RECTANGLE a='76.00000,30.00000' b='108.00000,54.00000' style='5' fill='0'/>
+ <TEXT pos='78.00000,34.00000' direction='3' font='3' color='000000'>STM32F3DISCOVERY</TEXT>
+ </TinyCAD>
+ </SYMBOLDEF>
+ <SYMBOLDEF id='5'>
+ <NAME type='0'>R</NAME>
+ <REF type='0'>R?</REF>
+ <DESCRIPTION>Resistor</DESCRIPTION>
+ <PPP>1</PPP>
+ <REF_POINT power='0' part='0' pos='84.00000,53.00000'/>
+ <TinyCAD>
+ <PIN pos='82.00000,43.00000' which='5' elec='4' direction='1' part='0' number='1' show='0' length='30' number_pos='0' centre_name='0'></PIN>
+ <PIN pos='82.00000,51.00000' which='5' elec='4' direction='0' part='0' number='2' show='0' length='30' number_pos='0' centre_name='0'></PIN>
+ <POLYGON pos='82.00000,43.00000' style='7' fill='0'>
+ <POINT pos='0.00000,1.60000' arc='0'/>
+ <POINT pos='0.00000,0.00000' arc='0'/>
+ </POLYGON>
+ <POLYGON pos='82.00000,50.40000' style='7' fill='0'>
+ <POINT pos='0.00000,0.00000' arc='0'/>
+ <POINT pos='0.00000,1.60000' arc='0'/>
+ </POLYGON>
+ <RECTANGLE a='80.40000,44.60000' b='83.40000,50.40000' style='7' fill='0'/>
+ </TinyCAD>
+ </SYMBOLDEF>
+ <SYMBOLDEF id='6'>
+ <NAME type='0'>POST</NAME>
+ <REF type='1'>K?</REF>
+ <DESCRIPTION>Post for banana plugs</DESCRIPTION>
+ <PPP>1</PPP>
+ <FIELD>
+ <NAME>Package</NAME>
+ <DEFAULT>HOLE_125_RND_250</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Usage</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Datasheet</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Manufacturer</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Manufacturer Part</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Digi-Key Part</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Newark Part</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Mouser Part</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <FIELD>
+ <NAME>Cost</NAME>
+ <DEFAULT>..</DEFAULT>
+ <FT>000001</FT>
+ <VALUE></VALUE>
+ <POS>0.00000,0.00000</POS>
+ </FIELD>
+ <REF_POINT power='0' part='0' pos='55.00000,32.00000'/>
+ <TinyCAD>
+ <ELLIPSE a='51.00000,25.00000' b='55.00000,29.00000' style='5' fill='0'/>
+ <PIN pos='53.00000,32.00000' which='0' elec='0' direction='0' part='0' number='1' show='1' length='15' number_pos='0' centre_name='0'></PIN>
+ <ELLIPSE a='52.00000,26.00000' b='54.00000,28.00000' style='5' fill='0'/>
+ </TinyCAD>
+ </SYMBOLDEF>
+ <OPTIONS>
+ <GRID>0</GRID>
+ <UNITS>0</UNITS>
+ <COLOR_WIRE>FF0000</COLOR_WIRE>
+ <COLOR_BUS>0000FF</COLOR_BUS>
+ <COLOR_JUNCTION>000000</COLOR_JUNCTION>
+ <COLOR_NOCONNECT>000000</COLOR_NOCONNECT>
+ <COLOR_LABEL>208000</COLOR_LABEL>
+ <COLOR_POWER>000000</COLOR_POWER>
+ <COLOR_PIN>4040C0</COLOR_PIN>
+ <COLOR_HIDDEN_PIN>208020</COLOR_HIDDEN_PIN>
+ <COLOR_BACKGROUND>FFFFFF</COLOR_BACKGROUND>
+ </OPTIONS>
+ <TEXT pos='228.00000,182.00000' direction='3' font='3' color='000000'>sous-vide</TEXT>
+ <TEXT pos='228.00000,192.00000' direction='3' font='3' color='000000'>logandk</TEXT>
+ <SYMBOL id='1' pos='168.00000,44.00000' part='0' rotate='1' can_scale='0' show_power='0' scale_x='1.00000' scale_y='1.00000'>
+ <FIELD type='1' description='Ref' value='REL?' show='0' pos='1.00000,-12.00000'/>
+ <FIELD type='0' description='Name' value='RELAY_SPST_NO' show='0' pos='1.00000,-12.00000'/>
+ <FIELD type='1' description='Package' value='' show='0' pos='1.00000,-9.60000'/>
+ <FIELD type='1' description='V_Max' value='..' show='0' pos='1.00000,-7.20000'/>
+ <FIELD type='1' description='I_Max' value='..' show='0' pos='1.00000,-4.80000'/>
+ <FIELD type='1' description='R_Max' value='..' show='0' pos='1.00000,-2.40000'/>
+ <FIELD type='1' description='V_Max_AC' value='..' show='0' pos='1.00000,0.00000'/>
+ <FIELD type='1' description='I_Max_AC' value='..' show='0' pos='1.00000,2.40000'/>
+ <FIELD type='1' description='V_Coil' value='..' show='0' pos='1.00000,4.80000'/>
+ <FIELD type='1' description='I_Coil' value='..' show='0' pos='1.00000,7.20000'/>
+ <FIELD type='1' description='V_Coil_Max' value='..' show='0' pos='1.00000,9.60000'/>
+ <FIELD type='1' description='I_Coil_Max' value='..' show='0' pos='1.00000,12.00000'/>
+ <FIELD type='1' description='P_Coil_Max' value='..' show='0' pos='1.00000,14.40000'/>
+ <FIELD type='1' description='Manufacturer' value='..' show='0' pos='1.00000,16.80000'/>
+ <FIELD type='1' description='Manufacturer Part' value='..' show='0' pos='1.00000,19.20000'/>
+ <FIELD type='1' description='Digi-Key Part' value='..' show='0' pos='1.00000,21.60000'/>
+ <FIELD type='1' description='Newark Part' value='..' show='0' pos='1.00000,24.00000'/>
+ <FIELD type='1' description='Mouser Part' value='..' show='0' pos='1.00000,26.40000'/>
+ <FIELD type='1' description='Cost' value='..' show='0' pos='1.00000,28.80000'/>
+ </SYMBOL>
+ <POWER pos='58.00000,112.00000' which='4' direction='1'></POWER>
+ <POWER pos='58.00000,64.00000' which='0' direction='0'>5V</POWER>
+ <SYMBOL id='2' pos='130.00000,50.00000' part='0' rotate='0' can_scale='0' show_power='0' scale_x='1.00000' scale_y='1.00000'>
+ <FIELD type='0' description='Ref' value='U?' show='0' pos='1.00000,-15.60000'/>
+ <FIELD type='0' description='Name' value='DS18B20' show='0' pos='1.00000,-18.00000'/>
+ <FIELD type='2' description='$$SPICE_PROLOG_PRIORITY' value='5' show='0' pos='0.00000,0.00000'/>
+ <FIELD type='2' description='$$SPICE_EPILOG_PRIORITY' value='5' show='0' pos='0.00000,0.00000'/>
+ <FIELD type='1' description='Package' value='package name for PCB layout' show='0' pos='1.00000,-13.20000'/>
+ </SYMBOL>
+ <SYMBOL id='3' pos='238.00000,154.00000' part='0' rotate='1' can_scale='0' show_power='0' scale_x='1.00000' scale_y='1.00000'>
+ <FIELD type='0' description='Ref' value='U?' show='0' pos='1.00000,-18.00000'/>
+ <FIELD type='0' description='Name' value='HD44780' show='0' pos='1.00000,-18.00000'/>
+ <FIELD type='2' description='$$SPICE_PROLOG_PRIORITY' value='5' show='0' pos='0.00000,0.00000'/>
+ <FIELD type='2' description='$$SPICE_EPILOG_PRIORITY' value='5' show='0' pos='0.00000,0.00000'/>
+ <FIELD type='1' description='Package' value='package name for PCB layout' show='0' pos='1.00000,-15.60000'/>
+ </SYMBOL>
+ <SYMBOL id='4' pos='232.00000,58.00000' part='0' rotate='0' can_scale='0' show_power='0' scale_x='1.00000' scale_y='1.00000'>
+ <FIELD type='0' description='Ref' value='U?' show='0' pos='1.00000,-19.60000'/>
+ <FIELD type='0' description='Name' value='STM32F3DISCOVERY' show='0' pos='1.00000,-22.00000'/>
+ <FIELD type='2' description='$$SPICE_PROLOG_PRIORITY' value='5' show='0' pos='0.00000,0.00000'/>
+ <FIELD type='2' description='$$SPICE_EPILOG_PRIORITY' value='5' show='0' pos='0.00000,0.00000'/>
+ <FIELD type='1' description='Package' value='package name for PCB layout' show='0' pos='1.00000,-17.20000'/>
+ </SYMBOL>
+ <WIRE a='114.00000,50.00000' b='114.00000,64.00000'/>
+ <WIRE a='86.00000,64.00000' b='58.00000,64.00000'/>
+ <WIRE a='122.00000,50.00000' b='122.00000,112.00000'/>
+ <SYMBOL id='5' pos='232.00000,106.00000' part='0' rotate='0' can_scale='0' show_power='0' scale_x='1.00000' scale_y='1.00000'>
+ <FIELD type='0' description='Ref' value='670' show='1' pos='1.00000,-5.60000'/>
+ <FIELD type='0' description='Name' value='R' show='1' pos='1.00000,-8.00000'/>
+ </SYMBOL>
+ <SYMBOL id='5' pos='200.00000,130.00000' part='0' rotate='0' can_scale='0' show_power='0' scale_x='1.00000' scale_y='1.00000'>
+ <FIELD type='0' description='Ref' value='2.7k' show='1' pos='1.00000,-5.60000'/>
+ <FIELD type='0' description='Name' value='R' show='1' pos='1.00000,-8.00000'/>
+ </SYMBOL>
+ <SYMBOL id='5' pos='106.00000,74.00000' part='0' rotate='2' can_scale='0' show_power='0' scale_x='1.00000' scale_y='1.00000'>
+ <FIELD type='0' description='Ref' value='4.7k' show='1' pos='-10.00000,2.00000'/>
+ <FIELD type='0' description='Name' value='R' show='1' pos='-10.00000,-4.00000'/>
+ </SYMBOL>
+ <WIRE a='118.00000,50.00000' b='118.00000,72.00000'/>
+ <WIRE a='118.00000,72.00000' b='104.00000,72.00000'/>
+ <WIRE a='96.00000,72.00000' b='86.00000,72.00000'/>
+ <WIRE a='86.00000,72.00000' b='86.00000,64.00000'/>
+ <WIRE a='148.00000,42.00000' b='140.00000,42.00000'/>
+ <WIRE a='140.00000,42.00000' b='140.00000,112.00000'/>
+ <WIRE a='122.00000,112.00000' b='58.00000,112.00000'/>
+ <WIRE a='168.00000,42.00000' b='188.00000,42.00000'/>
+ <WIRE a='234.00000,134.00000' b='234.00000,112.00000'/>
+ <WIRE a='140.00000,112.00000' b='122.00000,112.00000'/>
+ <WIRE a='190.00000,112.00000' b='140.00000,112.00000'/>
+ <WIRE a='230.00000,134.00000' b='230.00000,104.00000'/>
+ <WIRE a='230.00000,96.00000' b='230.00000,64.00000'/>
+ <WIRE a='114.00000,64.00000' b='86.00000,64.00000'/>
+ <WIRE a='194.00000,64.00000' b='114.00000,64.00000'/>
+ <JUNCTION pos='86.00000,64.00000'/>
+ <JUNCTION pos='114.00000,64.00000'/>
+ <JUNCTION pos='122.00000,112.00000'/>
+ <JUNCTION pos='140.00000,112.00000'/>
+ <WIRE a='198.00000,134.00000' b='198.00000,128.00000'/>
+ <WIRE a='198.00000,120.00000' b='198.00000,112.00000'/>
+ <JUNCTION pos='198.00000,112.00000'/>
+ <WIRE a='206.00000,112.00000' b='198.00000,112.00000'/>
+ <WIRE a='190.00000,134.00000' b='190.00000,112.00000'/>
+ <JUNCTION pos='190.00000,112.00000'/>
+ <WIRE a='198.00000,112.00000' b='190.00000,112.00000'/>
+ <WIRE a='194.00000,134.00000' b='194.00000,64.00000'/>
+ <JUNCTION pos='194.00000,64.00000'/>
+ <WIRE a='230.00000,64.00000' b='194.00000,64.00000'/>
+ <WIRE a='202.00000,134.00000' b='202.00000,80.00000'/>
+ <WIRE a='202.00000,80.00000' b='180.00000,80.00000'/>
+ <WIRE a='180.00000,80.00000' b='180.00000,54.00000'/>
+ <WIRE a='180.00000,54.00000' b='188.00000,54.00000'/>
+ <WIRE a='206.00000,134.00000' b='206.00000,112.00000'/>
+ <JUNCTION pos='206.00000,112.00000'/>
+ <WIRE a='234.00000,112.00000' b='206.00000,112.00000'/>
+ <WIRE a='210.00000,134.00000' b='210.00000,76.00000'/>
+ <WIRE a='210.00000,76.00000' b='176.00000,76.00000'/>
+ <WIRE a='176.00000,76.00000' b='176.00000,50.00000'/>
+ <WIRE a='176.00000,50.00000' b='188.00000,50.00000'/>
+ <JUNCTION pos='118.00000,72.00000'/>
+ <WIRE a='118.00000,72.00000' b='172.00000,72.00000'/>
+ <WIRE a='172.00000,72.00000' b='172.00000,46.00000'/>
+ <WIRE a='172.00000,46.00000' b='188.00000,46.00000'/>
+ <WIRE a='214.00000,134.00000' b='214.00000,76.00000'/>
+ <WIRE a='214.00000,76.00000' b='236.00000,76.00000'/>
+ <WIRE a='236.00000,76.00000' b='236.00000,54.00000'/>
+ <WIRE a='236.00000,54.00000' b='232.00000,54.00000'/>
+ <WIRE a='218.00000,134.00000' b='218.00000,80.00000'/>
+ <WIRE a='218.00000,80.00000' b='240.00000,80.00000'/>
+ <WIRE a='240.00000,80.00000' b='240.00000,50.00000'/>
+ <WIRE a='240.00000,50.00000' b='232.00000,50.00000'/>
+ <WIRE a='222.00000,134.00000' b='222.00000,84.00000'/>
+ <WIRE a='222.00000,84.00000' b='244.00000,84.00000'/>
+ <WIRE a='244.00000,84.00000' b='244.00000,46.00000'/>
+ <WIRE a='244.00000,46.00000' b='232.00000,46.00000'/>
+ <WIRE a='226.00000,134.00000' b='226.00000,88.00000'/>
+ <WIRE a='226.00000,88.00000' b='248.00000,88.00000'/>
+ <WIRE a='248.00000,88.00000' b='248.00000,42.00000'/>
+ <WIRE a='248.00000,42.00000' b='232.00000,42.00000'/>
+ <SYMBOL id='6' pos='148.00000,24.00000' part='0' rotate='0' can_scale='0' show_power='0' scale_x='1.00000' scale_y='1.00000'>
+ <FIELD type='1' description='Ref' value='K?' show='0' pos='1.00000,-3.60000'/>
+ <FIELD type='0' description='Name' value='POST' show='0' pos='1.00000,-6.00000'/>
+ <FIELD type='1' description='Package' value='HOLE_125_RND_250' show='0' pos='1.00000,-1.20000'/>
+ <FIELD type='1' description='Usage' value='..' show='0' pos='1.00000,1.20000'/>
+ <FIELD type='1' description='Datasheet' value='..' show='0' pos='1.00000,3.60000'/>
+ <FIELD type='1' description='Manufacturer' value='..' show='0' pos='1.00000,6.00000'/>
+ <FIELD type='1' description='Manufacturer Part' value='..' show='0' pos='1.00000,8.40000'/>
+ <FIELD type='1' description='Digi-Key Part' value='..' show='0' pos='1.00000,10.80000'/>
+ <FIELD type='1' description='Newark Part' value='..' show='0' pos='1.00000,13.20000'/>
+ <FIELD type='1' description='Mouser Part' value='..' show='0' pos='1.00000,15.60000'/>
+ <FIELD type='1' description='Cost' value='..' show='0' pos='1.00000,18.00000'/>
+ </SYMBOL>
+ <SYMBOL id='6' pos='174.00000,24.00000' part='0' rotate='0' can_scale='0' show_power='0' scale_x='1.00000' scale_y='1.00000'>
+ <FIELD type='1' description='Ref' value='K?' show='0' pos='1.00000,-3.60000'/>
+ <FIELD type='0' description='Name' value='POST' show='0' pos='1.00000,-6.00000'/>
+ <FIELD type='1' description='Package' value='HOLE_125_RND_250' show='0' pos='1.00000,-1.20000'/>
+ <FIELD type='1' description='Usage' value='..' show='0' pos='1.00000,1.20000'/>
+ <FIELD type='1' description='Datasheet' value='..' show='0' pos='1.00000,3.60000'/>
+ <FIELD type='1' description='Manufacturer' value='..' show='0' pos='1.00000,6.00000'/>
+ <FIELD type='1' description='Manufacturer Part' value='..' show='0' pos='1.00000,8.40000'/>
+ <FIELD type='1' description='Digi-Key Part' value='..' show='0' pos='1.00000,10.80000'/>
+ <FIELD type='1' description='Newark Part' value='..' show='0' pos='1.00000,13.20000'/>
+ <FIELD type='1' description='Mouser Part' value='..' show='0' pos='1.00000,15.60000'/>
+ <FIELD type='1' description='Cost' value='..' show='0' pos='1.00000,18.00000'/>
+ </SYMBOL>
+ <WIRE a='146.00000,24.00000' b='146.00000,36.00000'/>
+ <WIRE a='146.00000,36.00000' b='148.00000,36.00000'/>
+ <WIRE a='168.00000,36.00000' b='172.00000,36.00000'/>
+ <WIRE a='172.00000,36.00000' b='172.00000,24.00000'/>
+ </TinyCAD>
+</TinyCADSheets>
View
101 src/main.c
@@ -1,48 +1,111 @@
#include "stm32f30x_lcd.h"
#include "stm32f30x_temp.h"
#include "stm32f30x_sleep.h"
+#include "stm32f30x_timer.h"
+#include "pid.h"
+#include <math.h>
+
+#define TARGET_TEMP 34
+#define DUTY_CYCLE 5000
int main(void)
{
- temp_def temperature;
+ // Initialize systick timer
+ timer_init();
+ // Configure temperature sensor DS18B20
+ temp_def temperature;
temperature.port = GPIOC;
temperature.pin = GPIO_Pin_6;
- uint16_t temp = 0;
- temp = temp_read(&temperature);
-
+ // Configure LCD display HD44780
lcd_def display;
-
display.port = GPIOD;
display.pin_enable = GPIO_Pin_8;
display.pin_register_select = GPIO_Pin_9;
display.pin_d4 = GPIO_Pin_13;
display.pin_d5 = GPIO_Pin_12;
display.pin_d6 = GPIO_Pin_11;
display.pin_d7 = GPIO_Pin_10;
-
lcd_init(&display);
- lcd_printf(&display, "det virker!");
- lcd_set_pos(&display, 2, 1);
- lcd_printf(&display, "hej %c", 0xdf);
- int i = 1;
+
+ // Configure PID control
+ pid_set_target(TARGET_TEMP);
+ pid_set_tuning(2, 5, 1);
+ pid_set_interval(1000);
+ pid_set_limits(0, DUTY_CYCLE);
+
+ // Configure relay
+ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
+
+ GPIO_InitTypeDef gpio_init;
+
+ gpio_init.GPIO_Pin = GPIO_Pin_8;
+
+ gpio_init.GPIO_Mode = GPIO_Mode_OUT;
+ gpio_init.GPIO_OType = GPIO_OType_PP;
+ gpio_init.GPIO_Speed = GPIO_Speed_10MHz;
+ gpio_init.GPIO_PuPd = GPIO_PuPd_NOPULL;
+
+ GPIO_Init(GPIOA, &gpio_init);
+ GPIO_ResetBits(GPIOA, GPIO_Pin_8);
+
+ // Set cycle start time
+ uint32_t cycle_start = timer_now();
+
+ // Loop forever
while (1)
{
- temp = temp_read(&temperature);
+ // Convert temperature to degrees celcius
+ double temp = temp_read(&temperature);
+ temp *= 0.0625;
+
+ // Calculate with new parameters
+ pid_compute(temp);
+ uint32_t output = (uint32_t) pid_get_output();
- //lcd_clear(&display);
+ uint32_t delta_t = timer_now() - cycle_start;
+
+ if (delta_t > DUTY_CYCLE)
+ {
+ cycle_start += DUTY_CYCLE;
+ delta_t -= DUTY_CYCLE;
+ }
+
+ if (output > delta_t)
+ {
+ // Turn on relay
+ GPIO_SetBits(GPIOA, GPIO_Pin_8);
+ }
+ else
+ {
+ // Turn off relay
+ GPIO_ResetBits(GPIOA, GPIO_Pin_8);
+ }
+
+ // Clear display
lcd_home(&display);
- //uint16_t temp = 20435;
- float temp2 = (float) temp * 62.5;
+ // Split at decimal point
+ double f_part, i_part;
+ int target_i, target_f;
+ int current_i, current_f;
+
+ f_part = modf(TARGET_TEMP, &i_part);
+ target_i = (int) i_part;
+ target_f = (int) (f_part * 100);
+
+ f_part = modf(temp, &i_part);
+ current_i = (int) i_part;
+ current_f = (int) (f_part * 100);
- lcd_printf(&display, "okay? %d%c", (uint32_t) temp2, 0xdf);
- lcd_set_pos(&display, 2, 1);
- lcd_printf(&display, "hej %d%c", i * 10000, 0xdf);
- sleep_ms(500);
+ // Print current temperature
+ lcd_printf(&display, "%c%02d.%02d%c %c%02d.%02d%c",
+ 0xa5, current_i, current_f, 0xdf,
+ 0x7e, target_i, target_f, 0xdf);
- i++;
+ lcd_set_pos(&display, 0, 1);
+ lcd_printf(&display, "Duty cycle: %d", output);
}
}
View
96 src/pid.c
@@ -0,0 +1,96 @@
+#include "pid.h"
+#include "stm32f30x_timer.h"
+
+// Interval
+uint32_t interval_ = 1000; // [ms]
+
+// Tuning
+double k_p_;
+double k_i_;
+double k_d_;
+
+// Limits
+double min_;
+double max_;
+
+// Process variables
+uint32_t last_time_;
+double last_input_;
+double target_;
+double i_term_;
+double output_;
+
+uint8_t pid_compute(double input)
+{
+ uint32_t now = timer_now();
+ uint32_t delta_t = (now - last_time_);
+
+ if (delta_t >= interval_)
+ {
+ // Compute all the working error variables
+ double error = target_ - input;
+
+ i_term_ += (k_i_ * error);
+
+ if (i_term_ > max_) i_term_= max_;
+ else if (i_term_ < min_) i_term_= min_;
+
+ double delta_i = (input - last_input_);
+
+ // Compute PID output
+ output_ = k_p_ * error + i_term_ - k_d_ * delta_i;
+
+ // Remember some variables for next time
+ last_input_ = input;
+ last_time_ = now;
+
+ return 1;
+ }
+
+ return 0;
+}
+
+double pid_get_output()
+{
+ if (output_ > max_) output_ = max_;
+ else if (output_ < min_) output_ = min_;
+
+ return output_;
+}
+
+void pid_set_target(double target)
+{
+ target_ = target;
+}
+
+void pid_set_tuning(double k_p, double k_i, double k_d)
+{
+ double interval_s = (double) interval_ / 1000.0;
+
+ k_p_ = k_p;
+ k_i_ = k_i * interval_s;
+ k_d_ = k_d / interval_s;
+}
+
+void pid_set_interval(uint32_t interval)
+{
+ if (interval > 0)
+ {
+ double ratio = (double) interval / (double) interval_;
+
+ k_i_ *= ratio;
+ k_d_ /= ratio;
+
+ interval_ = interval;
+ }
+}
+
+void pid_set_limits(double min, double max)
+{
+ if (max > min)
+ {
+ min_ = min;
+ max_ = max;
+ }
+}
+
View
24 src/stm32f30x_timer.c
@@ -0,0 +1,24 @@
+#include "stm32f30x_timer.h"
+
+static volatile uint32_t timer_count_;
+
+void timer_init()
+{
+ timer_count_ = 0;
+
+ if (SysTick_Config(SystemCoreClock / 1000))
+ {
+ // Capture error
+ while (1);
+ }
+}
+
+uint32_t timer_now()
+{
+ return timer_count_;
+}
+
+void SysTick_Handler(void)
+{
+ timer_count_++;
+}
View
BIN symbols.TCLib
Binary file not shown.

0 comments on commit 00f351e

Please sign in to comment.