├── 7-Segment-Clock-ATMEGA328P ├── Debug │ ├── 7-Segment-Clock-ATMEGA328P.eep │ ├── main.o │ ├── 7-Segment-Clock-ATMEGA328P.elf │ ├── makedep.mk │ ├── main.d │ ├── 7-Segment-Clock-ATMEGA328P.srec │ ├── 7-Segment-Clock-ATMEGA328P.hex │ ├── Makefile │ ├── 7-Segment-Clock-ATMEGA328P.map │ └── 7-Segment-Clock-ATMEGA328P.lss ├── 7-Segment-Clock-ATMEGA328P.componentinfo.xml ├── 7-Segment-Clock-ATMEGA328P.cproj └── main.c ├── Proteus ├── 7-Segment-Clock-ATMEGA328P.pdsprj ├── Backup Of 7-Segment-Clock-ATMEGA328P.pdsbak ├── Last Loaded 7-Segment-Clock-ATMEGA328P.pdsbak ├── 7-Segment-Clock-ATMEGA328P.pdsprj.ASUS-WEG.Guilherme.workspace └── 7-Segments-Clock-ATMEGA328.pdsprj.ASUS-WEG.Guilherme.workspace ├── 7-Segment-Clock-ATMEGA328P.atsln ├── README.md └── README-PT.md /7-Segment-Clock-ATMEGA328P/Debug/7-Segment-Clock-ATMEGA328P.eep: -------------------------------------------------------------------------------- 1 | :00000001FF 2 | -------------------------------------------------------------------------------- /7-Segment-Clock-ATMEGA328P/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hollweg/7-Segments-Clock/HEAD/7-Segment-Clock-ATMEGA328P/Debug/main.o -------------------------------------------------------------------------------- /Proteus/7-Segment-Clock-ATMEGA328P.pdsprj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hollweg/7-Segments-Clock/HEAD/Proteus/7-Segment-Clock-ATMEGA328P.pdsprj -------------------------------------------------------------------------------- /Proteus/Backup Of 7-Segment-Clock-ATMEGA328P.pdsbak: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hollweg/7-Segments-Clock/HEAD/Proteus/Backup Of 7-Segment-Clock-ATMEGA328P.pdsbak -------------------------------------------------------------------------------- /Proteus/Last Loaded 7-Segment-Clock-ATMEGA328P.pdsbak: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hollweg/7-Segments-Clock/HEAD/Proteus/Last Loaded 7-Segment-Clock-ATMEGA328P.pdsbak -------------------------------------------------------------------------------- /7-Segment-Clock-ATMEGA328P/Debug/7-Segment-Clock-ATMEGA328P.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hollweg/7-Segments-Clock/HEAD/7-Segment-Clock-ATMEGA328P/Debug/7-Segment-Clock-ATMEGA328P.elf -------------------------------------------------------------------------------- /7-Segment-Clock-ATMEGA328P/Debug/makedep.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit or delete the file 3 | ################################################################################ 4 | 5 | main.c 6 | 7 | -------------------------------------------------------------------------------- /Proteus/7-Segment-Clock-ATMEGA328P.pdsprj.ASUS-WEG.Guilherme.workspace: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 2c0000000200000003000000ffffffffffffffffffffffffffffffff6400000009000000f2040000f7020000 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Proteus/7-Segments-Clock-ATMEGA328.pdsprj.ASUS-WEG.Guilherme.workspace: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 2c00000002000000030000000083ffff0083ffffffffffffffffffff6400000009000000f2040000f7020000 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /7-Segment-Clock-ATMEGA328P.atsln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Atmel Studio Solution File, Format Version 11.00 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "7-Segment-Clock-ATMEGA328P", "7-Segment-Clock-ATMEGA328P\7-Segment-Clock-ATMEGA328P.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|AVR = Debug|AVR 11 | Release|AVR = Release|AVR 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR 15 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR 16 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR 17 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /7-Segment-Clock-ATMEGA328P/Debug/main.d: -------------------------------------------------------------------------------- 1 | main.d main.o: .././main.c \ 2 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ 3 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ 4 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ 5 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\4.9.2\include\stdint.h \ 6 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ 7 | C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.1.130\include/avr/iom328p.h \ 8 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ 9 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ 10 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ 11 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ 12 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ 13 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ 14 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ 15 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ 16 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ 17 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\4.9.2\include\stdbool.h 18 | 19 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: 20 | 21 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: 22 | 23 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: 24 | 25 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\4.9.2\include\stdint.h: 26 | 27 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: 28 | 29 | C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.1.130\include/avr/iom328p.h: 30 | 31 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: 32 | 33 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: 34 | 35 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: 36 | 37 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: 38 | 39 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: 40 | 41 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: 42 | 43 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: 44 | 45 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: 46 | 47 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: 48 | 49 | c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\4.9.2\include\stdbool.h: 50 | -------------------------------------------------------------------------------- /7-Segment-Clock-ATMEGA328P/7-Segment-Clock-ATMEGA328P.componentinfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Device 8 | Startup 9 | 10 | 11 | Atmel 12 | 1.1.0 13 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs 14 | 15 | 16 | 17 | 18 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.1.130\include 19 | 20 | include 21 | C 22 | 23 | 24 | include 25 | 26 | 27 | 28 | 29 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.1.130\include\avr\iom328p.h 30 | 31 | header 32 | C 33 | UMk4QUzkkuShabuoYtNl/Q== 34 | 35 | include/avr/iom328p.h 36 | 37 | 38 | 39 | 40 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.1.130\templates\main.c 41 | template 42 | source 43 | C Exe 44 | WxJO0ShdjKBxNwwnWxKWBQ== 45 | 46 | templates/main.c 47 | Main file (.c) 48 | 49 | 50 | 51 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.1.130\templates\main.cpp 52 | template 53 | source 54 | C Exe 55 | YXFphlh0CtZJU+ebktABgQ== 56 | 57 | templates/main.cpp 58 | Main file (.cpp) 59 | 60 | 61 | 62 | C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.1.130\gcc\dev\atmega328p 63 | 64 | libraryPrefix 65 | GCC 66 | 67 | 68 | gcc/dev/atmega328p 69 | 70 | 71 | 72 | 73 | ATmega_DFP 74 | C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/Atmel.ATmega_DFP.pdsc 75 | 1.1.130 76 | true 77 | ATmega328P 78 | 79 | 80 | 81 | Resolved 82 | Fixed 83 | true 84 | 85 | 86 | -------------------------------------------------------------------------------- /7-Segment-Clock-ATMEGA328P/Debug/7-Segment-Clock-ATMEGA328P.srec: -------------------------------------------------------------------------------- 1 | S0220000372D5365676D656E742D436C6F636B2D41544D454741333238502E73726563E9 2 | S11300000C9434000C9451000C9451000C94510045 3 | S11300100C9451000C9451000C9451000C94510018 4 | S11300200C9451000C9451000C9451000C94520205 5 | S11300300C9451000C9451000C9451000C945100F8 6 | S11300400C9451000C9451000C9451000C945100E8 7 | S11300500C9451000C9451000C9451000C945100D8 8 | S11300600C9451000C94510011241FBECFEFD8E022 9 | S1130070DEBFCDBF11E0A0E0B1E0E2E0F5E002C0F8 10 | S113008005900D92A634B107D9F721E0A6E4B1E0BA 11 | S113009001C01D92A934B207E1F70E94F1010C944A 12 | S11300A07F020C9400009BB11BB895B115B895B1B3 13 | S11300B015B8611106C095B115B82B9A2C9A2D9AD2 14 | S11300C032C0613031F495B115B82A9A2C9A2D9A20 15 | S11300D02AC0623031F495B115B82A9A2B9A2D9A18 16 | S11300E022C0633001F595B115B82A9A2B9A2C9A3F 17 | S11300F01AC0483068F48BB19081292F30E0062E65 18 | S113010002C0220F331F0A94E2F7282B2BB904C034 19 | S113011095B18081892B85B94F5F31966F5F7F4F91 20 | S1130120493039F7089597E0899FF0011124E05090 21 | S1130130FF4F62E070E042E0DCCFCF93813009F4FE 22 | S113014047C0809147018A3050F461E080E00E940A 23 | S1130150530060E0809147010E945300B5C09DECBC 24 | S1130160899F912D1124969596959695990F292FEF 25 | S1130170220F220F920F89130FC09DEC899F812DAE 26 | S1130180112461E08695869586950E94530060E06F 27 | S113019080E00E94530098C0CDEC8C9F812D1124E7 28 | S11301A061E08695869586950E945300809147016B 29 | S11301B08C9FC12D1124C695C695C695CC0F9C2F36 30 | S11301C0990F990FC90F60E08C1B0E9453007CC0EB 31 | S11301D0809147018A30E0F461E080E00E9453009E 32 | S11301E02FE788E391E0215080409040E1F700C080 33 | S11301F0000060E0809147010E9453002FE788E3EC 34 | S113020091E0215080409040E1F700C000005CC0C4 35 | S11302109DEC899F912D1124969596959695990F0D 36 | S1130220292F220F220F920F891321C09DEC899F41 37 | S1130230812D112461E08695869586950E94530050 38 | S11302402FE788E391E0215080409040E1F700C01F 39 | S1130250000060E080E00E9453002FE788E391E013 40 | S1130260215080409040E1F700C000002DC0CDEC4B 41 | S11302708C9F812D112461E08695869586950E9438 42 | S113028053002FE788E391E0215080409040E1F74C 43 | S113029000C00000809147018C9FC12D1124C69598 44 | S11302A0C695C695CC0F9C2F990F990FC90F60E086 45 | S11302B08C1B0E9453002FE788E391E0215080407B 46 | S11302C09040E1F700C00000CF910895813029F1FA 47 | S11302D0809148018A3050F463E080E00E9453002A 48 | S11302E062E0809148010E945300089563E081E038 49 | S11302F00E945300809148019DEC899F912D112407 50 | S1130300969596959695990F292F220F220F920F65 51 | S113031062E0891B0E9453000895809148018A304D 52 | S1130320E0F463E080E00E9453002FEF80E792E066 53 | S1130330215080409040E1F700C0000062E08091CD 54 | S113034048010E9453002FEF80E792E02150804043 55 | S11303509040E1F700C00000089563E081E00E944E 56 | S113036053002FEF80E792E0215080409040E1F766 57 | S113037000C00000809148019DEC899F912D1124BB 58 | S1130380969596959695990F292F220F220F920FE5 59 | S113039062E0891B0E9453002FEF80E792E0215016 60 | S11303A080409040E1F700C00000089585E8809304 61 | S11303B07A0080E480937C000895ECE7F0E090817B 62 | S11303C0907F908380648083EAE7F0E0808180649A 63 | S11303D08083808186FDFDCF8091780090917900A3 64 | S11303E008958CEF8AB98FE384B985B185B92B9AC6 65 | S11303F02C9A2D9A0E94D60188E09DE3909389005F 66 | S113040080938800E1E8F0E0808188608083AFE633 67 | S1130410B0E08C9182608C93808185608083789435 68 | S1130420299881E00E94DD018F3E9240E0F0F8942B 69 | S1130430809147018F5F809347018C3338F080911E 70 | S113044048018F5F809348011092470180914801D1 71 | S11304508C3010F01092480181E00E949D0081E0F0 72 | S11304600E946601789482E00E94DD018F3E9240F2 73 | S113047090F0F894809148018F5F8C3018F4809349 74 | S1130480480102C01092480181E00E949D0081E071 75 | S11304900E946601789480E00E949D0080E00E94A2 76 | S11304A06601BFCF1F920F920FB60F9211248F9344 77 | S11304B0809146018C3338F0809147018F5F80939F 78 | S11304C0470110924601809147018C3338F08091A6 79 | S11304D048018F5F80934801109247018091480141 80 | S11304E08C3010F010924801809146018F5F809308 81 | S11304F046018F910F900FBE0F901F901895F8949E 82 | S1050500FFCF27 83 | S113050201010101010100000101000000000101DB 84 | S113051200010100010101010100000100010100CB 85 | S113052200010101000101000101010001010101B9 86 | S113053201010101000000000101010101010101A9 87 | S1090542010100000101AB 88 | S9030000FC 89 | -------------------------------------------------------------------------------- /7-Segment-Clock-ATMEGA328P/Debug/7-Segment-Clock-ATMEGA328P.hex: -------------------------------------------------------------------------------- 1 | :100000000C9434000C9451000C9451000C94510049 2 | :100010000C9451000C9451000C9451000C9451001C 3 | :100020000C9451000C9451000C9451000C94520209 4 | :100030000C9451000C9451000C9451000C945100FC 5 | :100040000C9451000C9451000C9451000C945100EC 6 | :100050000C9451000C9451000C9451000C945100DC 7 | :100060000C9451000C94510011241FBECFEFD8E026 8 | :10007000DEBFCDBF11E0A0E0B1E0E2E0F5E002C0FC 9 | :1000800005900D92A634B107D9F721E0A6E4B1E0BE 10 | :1000900001C01D92A934B207E1F70E94F1010C944E 11 | :1000A0007F020C9400009BB11BB895B115B895B1B7 12 | :1000B00015B8611106C095B115B82B9A2C9A2D9AD6 13 | :1000C00032C0613031F495B115B82A9A2C9A2D9A24 14 | :1000D0002AC0623031F495B115B82A9A2B9A2D9A1C 15 | :1000E00022C0633001F595B115B82A9A2B9A2C9A43 16 | :1000F0001AC0483068F48BB19081292F30E0062E69 17 | :1001000002C0220F331F0A94E2F7282B2BB904C038 18 | :1001100095B18081892B85B94F5F31966F5F7F4F95 19 | :10012000493039F7089597E0899FF0011124E05094 20 | :10013000FF4F62E070E042E0DCCFCF93813009F402 21 | :1001400047C0809147018A3050F461E080E00E940E 22 | :10015000530060E0809147010E945300B5C09DECC0 23 | :10016000899F912D1124969596959695990F292FF3 24 | :10017000220F220F920F89130FC09DEC899F812DB2 25 | :10018000112461E08695869586950E94530060E073 26 | :1001900080E00E94530098C0CDEC8C9F812D1124EB 27 | :1001A00061E08695869586950E945300809147016F 28 | :1001B0008C9FC12D1124C695C695C695CC0F9C2F3A 29 | :1001C000990F990FC90F60E08C1B0E9453007CC0EF 30 | :1001D000809147018A30E0F461E080E00E945300A2 31 | :1001E0002FE788E391E0215080409040E1F700C084 32 | :1001F000000060E0809147010E9453002FE788E3F0 33 | :1002000091E0215080409040E1F700C000005CC0C8 34 | :100210009DEC899F912D1124969596959695990F11 35 | :10022000292F220F220F920F891321C09DEC899F45 36 | :10023000812D112461E08695869586950E94530054 37 | :100240002FE788E391E0215080409040E1F700C023 38 | :10025000000060E080E00E9453002FE788E391E017 39 | :10026000215080409040E1F700C000002DC0CDEC4F 40 | :100270008C9F812D112461E08695869586950E943C 41 | :1002800053002FE788E391E0215080409040E1F750 42 | :1002900000C00000809147018C9FC12D1124C6959C 43 | :1002A000C695C695CC0F9C2F990F990FC90F60E08A 44 | :1002B0008C1B0E9453002FE788E391E0215080407F 45 | :1002C0009040E1F700C00000CF910895813029F1FE 46 | :1002D000809148018A3050F463E080E00E9453002E 47 | :1002E00062E0809148010E945300089563E081E03C 48 | :1002F0000E945300809148019DEC899F912D11240B 49 | :10030000969596959695990F292F220F220F920F69 50 | :1003100062E0891B0E9453000895809148018A3051 51 | :10032000E0F463E080E00E9453002FEF80E792E06A 52 | :10033000215080409040E1F700C0000062E08091D1 53 | :1003400048010E9453002FEF80E792E02150804047 54 | :100350009040E1F700C00000089563E081E00E9452 55 | :1003600053002FEF80E792E0215080409040E1F76A 56 | :1003700000C00000809148019DEC899F912D1124BF 57 | :10038000969596959695990F292F220F220F920FE9 58 | :1003900062E0891B0E9453002FEF80E792E021501A 59 | :1003A00080409040E1F700C00000089585E8809308 60 | :1003B0007A0080E480937C000895ECE7F0E090817F 61 | :1003C000907F908380648083EAE7F0E0808180649E 62 | :1003D0008083808186FDFDCF8091780090917900A7 63 | :1003E00008958CEF8AB98FE384B985B185B92B9ACA 64 | :1003F0002C9A2D9A0E94D60188E09DE39093890063 65 | :1004000080938800E1E8F0E0808188608083AFE637 66 | :10041000B0E08C9182608C93808185608083789439 67 | :10042000299881E00E94DD018F3E9240E0F0F8942F 68 | :10043000809147018F5F809347018C3338F0809122 69 | :1004400048018F5F809348011092470180914801D5 70 | :100450008C3010F01092480181E00E949D0081E0F4 71 | :100460000E946601789482E00E94DD018F3E9240F6 72 | :1004700090F0F894809148018F5F8C3018F480934D 73 | :10048000480102C01092480181E00E949D0081E075 74 | :100490000E946601789480E00E949D0080E00E94A6 75 | :1004A0006601BFCF1F920F920FB60F9211248F9348 76 | :1004B000809146018C3338F0809147018F5F8093A3 77 | :1004C000470110924601809147018C3338F08091AA 78 | :1004D00048018F5F80934801109247018091480145 79 | :1004E0008C3010F010924801809146018F5F80930C 80 | :1004F00046018F910F900FBE0F901F901895F894A2 81 | :02050000FFCF2B 82 | :1005020001010101010100000101000000000101DF 83 | :1005120000010100010101010100000100010100CF 84 | :1005220000010101000101000101010001010101BD 85 | :1005320001010101000000000101010101010101AD 86 | :06054200010100000101AF 87 | :00000001FF 88 | -------------------------------------------------------------------------------- /7-Segment-Clock-ATMEGA328P/Debug/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | SHELL := cmd.exe 6 | RM := rm -rf 7 | 8 | USER_OBJS := 9 | 10 | LIBS := 11 | PROJ := 12 | 13 | O_SRCS := 14 | C_SRCS := 15 | S_SRCS := 16 | S_UPPER_SRCS := 17 | OBJ_SRCS := 18 | ASM_SRCS := 19 | PREPROCESSING_SRCS := 20 | OBJS := 21 | OBJS_AS_ARGS := 22 | C_DEPS := 23 | C_DEPS_AS_ARGS := 24 | EXECUTABLES := 25 | OUTPUT_FILE_PATH := 26 | OUTPUT_FILE_PATH_AS_ARGS := 27 | AVR_APP_PATH :=$$$AVR_APP_PATH$$$ 28 | QUOTE := " 29 | ADDITIONAL_DEPENDENCIES:= 30 | OUTPUT_FILE_DEP:= 31 | LIB_DEP:= 32 | LINKER_SCRIPT_DEP:= 33 | 34 | # Every subdirectory with source files must be described here 35 | SUBDIRS := 36 | 37 | 38 | # Add inputs and outputs from these tool invocations to the build variables 39 | C_SRCS += \ 40 | ../main.c 41 | 42 | 43 | PREPROCESSING_SRCS += 44 | 45 | 46 | ASM_SRCS += 47 | 48 | 49 | OBJS += \ 50 | main.o 51 | 52 | OBJS_AS_ARGS += \ 53 | main.o 54 | 55 | C_DEPS += \ 56 | main.d 57 | 58 | C_DEPS_AS_ARGS += \ 59 | main.d 60 | 61 | OUTPUT_FILE_PATH +=7-Segment-Clock-ATMEGA328P.elf 62 | 63 | OUTPUT_FILE_PATH_AS_ARGS +=7-Segment-Clock-ATMEGA328P.elf 64 | 65 | ADDITIONAL_DEPENDENCIES:= 66 | 67 | OUTPUT_FILE_DEP:= ./makedep.mk 68 | 69 | LIB_DEP+= 70 | 71 | LINKER_SCRIPT_DEP+= 72 | 73 | 74 | # AVR32/GNU C Compiler 75 | 76 | 77 | 78 | ./%.o: .././%.c 79 | @echo Building file: $< 80 | @echo Invoking: AVR/GNU C Compiler : 4.9.2 81 | $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.1.130\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.1.130\gcc\dev\atmega328p" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" 82 | @echo Finished building: $< 83 | 84 | 85 | 86 | 87 | # AVR32/GNU Preprocessing Assembler 88 | 89 | 90 | 91 | # AVR32/GNU Assembler 92 | 93 | 94 | 95 | 96 | ifneq ($(MAKECMDGOALS),clean) 97 | ifneq ($(strip $(C_DEPS)),) 98 | -include $(C_DEPS) 99 | endif 100 | endif 101 | 102 | # Add inputs and outputs from these tool invocations to the build variables 103 | 104 | # All Target 105 | all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES) 106 | 107 | $(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) $(LINKER_SCRIPT_DEP) 108 | @echo Building target: $@ 109 | @echo Invoking: AVR/GNU Linker : 4.9.2 110 | $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="7-Segment-Clock-ATMEGA328P.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.1.130\gcc\dev\atmega328p" 111 | @echo Finished building target: $@ 112 | "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "7-Segment-Clock-ATMEGA328P.elf" "7-Segment-Clock-ATMEGA328P.hex" 113 | "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "7-Segment-Clock-ATMEGA328P.elf" "7-Segment-Clock-ATMEGA328P.eep" || exit 0 114 | "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "7-Segment-Clock-ATMEGA328P.elf" > "7-Segment-Clock-ATMEGA328P.lss" 115 | "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "7-Segment-Clock-ATMEGA328P.elf" "7-Segment-Clock-ATMEGA328P.srec" 116 | "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "7-Segment-Clock-ATMEGA328P.elf" 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | # Other Targets 125 | clean: 126 | -$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES) 127 | -$(RM) $(C_DEPS_AS_ARGS) 128 | rm -rf "7-Segment-Clock-ATMEGA328P.elf" "7-Segment-Clock-ATMEGA328P.a" "7-Segment-Clock-ATMEGA328P.hex" "7-Segment-Clock-ATMEGA328P.lss" "7-Segment-Clock-ATMEGA328P.eep" "7-Segment-Clock-ATMEGA328P.map" "7-Segment-Clock-ATMEGA328P.srec" "7-Segment-Clock-ATMEGA328P.usersignatures" 129 | -------------------------------------------------------------------------------- /7-Segment-Clock-ATMEGA328P/7-Segment-Clock-ATMEGA328P.cproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 2.0 5 | 7.0 6 | com.Atmel.AVRGCC8.C 7 | dce6c7e3-ee26-4d79-826b-08594b9ad897 8 | ATmega328P 9 | none 10 | Executable 11 | C 12 | $(MSBuildProjectName) 13 | .elf 14 | $(MSBuildProjectDirectory)\$(Configuration) 15 | 7-Segment-Clock-ATMEGA328P 16 | 7-Segment-Clock-ATMEGA328P 17 | 7-Segment-Clock-ATMEGA328P 18 | Native 19 | true 20 | false 21 | true 22 | true 23 | 24 | 25 | true 26 | 27 | 2 28 | 0 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.1.130\gcc\dev\atmega328p" 46 | True 47 | True 48 | True 49 | True 50 | False 51 | True 52 | True 53 | 54 | 55 | NDEBUG 56 | 57 | 58 | 59 | 60 | %24(PackRepoDir)\atmel\ATmega_DFP\1.1.130\include 61 | 62 | 63 | Optimize for size (-Os) 64 | True 65 | True 66 | True 67 | 68 | 69 | libm 70 | 71 | 72 | 73 | 74 | %24(PackRepoDir)\atmel\ATmega_DFP\1.1.130\include 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.1.130\gcc\dev\atmega328p" 84 | True 85 | True 86 | True 87 | True 88 | False 89 | True 90 | True 91 | 92 | 93 | DEBUG 94 | 95 | 96 | 97 | 98 | %24(PackRepoDir)\atmel\ATmega_DFP\1.1.130\include 99 | 100 | 101 | Optimize (-O1) 102 | True 103 | True 104 | Default (-g2) 105 | True 106 | 107 | 108 | libm 109 | 110 | 111 | 112 | 113 | %24(PackRepoDir)\atmel\ATmega_DFP\1.1.130\include 114 | 115 | 116 | Default (-Wa,-g) 117 | 118 | 119 | 120 | 121 | 122 | compile 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 7-Segments-Clock 2 | 3 | ## The purpose 4 | 5 | This is a 7 Segments Clock project, developed from zero, using authoral **hardware and software**. The clock marks **hours, minutes and seconds, using an ATMEGA328P microcontroller**, from ATMEL. The 7 Segments Clock was developed as a personal project and it was built on an **universal soldering breadboard**, according with Proteus folder schematics inside this project. During this README I'll explain how to develop your own 7 Segments Clock. :) 6 | 7 | *Here is an image about the project final result:* 8 | 9 | ![Imgur](http://i.imgur.com/BjCu3v1.jpg) 10 | 11 | ## Utility 12 | 13 | The code was developed specifically to **ATMEGA328P microcontroller** using **ATMEL Studio IDE**. However, if some changes were made, mainly in initialization, configuration and some registers, **the project can be adapted to other microcontroller families, from other manufacturers** and IDEs. The idea to build a 7 Segments Clock is the same, but some things will change, like timer registers, I/O and ADC configurations. 14 | 15 | ## How it works? 16 | 17 | The clock starts marking time from 00:00, in the moment that it's powered. **To adjust time until desired hour and minute you have to use the circuit push buttons** (in the right side of microcontroller). We have two push buttons, one to increment hours and another one to increment minutes. 18 | 19 | **This project algorithm marks hours, minutes and seconds, but it was built only with 4 displays, marking hours and minutes. However, if you want to build a full clock (using seconds markers too) it is only necessary to add two 7 Segments displays and connect it on 2 non used microcontroller ports.** 20 | 21 | **The code was developed with the full clock logic, but when I burn it to microcontroller I comment one of markers (seconds, for example - "CalculateSeconds" function) and it marks Hours + Minutes. In the other hand, if I want to see Minutes + Seconds you need to comment "CalculateHours" function and it will display Minutes + Seconds.** 22 | 23 | In the moment that the circuit is **de-energized**, the clock **loses its reference** and the current time because it does not have a memory hardware implemented in circuit. 24 | 25 | However, if you need to store the **last marked time, even with the circuit de-energized, you can use a RTC hardware and only read its time variables, than display it in the 7 Segments array.** In other way, according to what I said during Binary Clock project (here in github.com/hollwe/binary-clock), I think that this kind of "upgrade" is not interesting to this kind of project because it **makes you miss the essence of build a real clock, since thinking in clock logic, counters, timers, until software otimization and implementation.** 26 | 27 | *- The .c file contains the developed code in C.*
28 | *- The .asm file contains the code translated to assembly*
29 | *- The .hex file is the ready to burn file, containing the code in hexadecimal language.*
30 | *- The other files are configuration files, created by compiler.*
31 | *- Inside /Proteus folder it is the project hardware schematic*
32 | 33 | *Below there is an image of the project hardware described in Proteus (using four 7 Segments Display):* 34 | 35 | ![Imgur](http://i.imgur.com/T5LGVun.png) 36 | 37 | You can acess the hardware files in the project folder /Proteus. 38 | 39 | ## Using four 7-Segments Displays 40 | 41 | You can see in the final result project image that I used a **7 Segments Display array** (model CAI5461AH), **already multiplexed and easier to be used.** 42 | 43 | However, you can develop the same project **using four 7 Segments Displays.**
44 | Before use the 7 Segments Array I tested the circuit and the code in a breadboard with four 7 Segments Displays.
45 | The only difference is that **you need to multiplex the pins manually and connect a resistor between microcontroller port and display control pins** (there is 2 control pins (shared) by display).
46 | **In the other hand, using the 7 Segments Display array it is not necessary to connect the display resistors because they are considered in its internal circuit.** 47 | 48 | *Below there is an image of a single 7 Segments Display schematic pins:* 49 | 50 | ![Imgur](http://i.imgur.com/6OF4lW5.gif) 51 | 52 | ![Imgur](http://i.imgur.com/uOHj8T3.gif) 53 | 54 | *Here you can see four 7 Segments Display multiplexed .gif:* 55 | 56 | [Imgur](http://i.imgur.com/3Io3QAH.gifv) 57 | 58 | **In the image you can see that it was used transistors to enable each display control pin, but this is not necessary.**
59 | I developed the **control switch system by software.** Every time when a display is enabled (5V - common cathode), the microcontroller sends to the other display control pins 0V, assuring that we will have only one display active at a time.
60 | This control signal is enable for a short period of time, very fast, then it enables another, sharing the bus time between all 4 digits. So, as the signal varies a lot of times per second, our eyes have the impression that all 4 digits are ON simultaneously, what is fake. 61 | 62 | *Here is an image of the circuit using four 7 Segments Display (the code burned for an array or separated displays is exactly the same):* 63 | 64 | ![Imgur](http://i.imgur.com/Zn7HhOp.jpg) 65 | 66 | There is not necessary to build your own hardware to see the project working. **If you want to build it on an Arduino UNO board** (or another Arduino board that uses ATMEGA328P) **you need to burn the code to ATMEGA328P via ATMEL Studio** (you can see this link to configure Atmel Studio to burn code for Arduino) **and connect the display and buttons directly in Arduino I/O board pins.** 67 | 68 | **Below, I described the hardware connections to make it easy to build the project. Take a look. :)** 69 | 70 | **7 Segments LEDs:** 71 | 72 | Segment a - ATMEGA328P PD2 - Arduino Uno Digital pin 2
73 | Segment b - ATMEGA328P PD3 - Arduino Uno Digital pin 3
74 | Segment c - ATMEGA328P PD4 - Arduino Uno Digital pin 4
75 | Segment d - ATMEGA328P PD5 - Arduino Uno Digital pin 5
76 | Segment e - ATMEGA328P PD6 - Arduino Uno Digital pin 6
77 | Segment f - ATMEGA328P PD7 - Arduino Uno Digital pin 7
78 | Segment g - ATMEGA328P PB0 - Arduino Uno Digital pin 8
79 | Minutes right display control - ATMEGA328P PB2 - Arduino Uno Digital pin 10
80 | Minutes left display control - ATMEGA328P PB3 - Arduino Uno Digital pin 11
81 | Hours right display control - ATMEGA328P PB4 - Arduino Uno Digital pin 12
82 | Hours left display control - ATMEGA328P PB5 - Arduino Uno Digital pin 13
83 | 84 | **Push Buttons:** 85 | 86 | Reset - ATMEGA328P PC6 - Arduino UNO Reset pin
87 | Minutes increment - ATMEGA328P PC1 - Arduino UNO Analog Input 1 (take care: Input pin 1, not Input pin 0)
88 | Hours increment - ATMEGA328P PC2 - Arduino UNO Analog Input 2
89 | 90 | **Obs.1**: If you use four 7 Segments Display all the 7 Segments LEDs are connected together.
91 | **Obs.2**: If you use four 7 Segments Display, every display needs its own input resistor (~~270 ohms --- ~~1k ohms).
92 | In addition, the control pins must be connected in its two COM pins.
93 | **Obs.3**: Be careful with the type of 7 Segments Display you'll be using.
94 | There are two different types: Common Anode and Common Cathode.
95 | Common Cathode has its control pin ON using HIGH (5V) logical signal.
96 | Common Anode has its control pin ON using LOW (0V) logical signal.
97 | 98 | ## Which was used in project? 99 | 100 | **Bill of materials**: 101 | 102 | 1. 1 x ATMEGA328P microcontroller
103 | 2. 1 x 28 pins header
104 | 3. 3 x Push button
105 | 4. 3 x Resistor 1k ohm (+4 if you use four 7 Segments Display)
106 | 5. 1 x 16MHz Crystal
107 | 6. 2 x 22pF Capacitors
108 | 7. 1 x 100nF Capacitors
109 | 8. 1 x 7 Segments Display Array
110 | 9. 1 x Female P4 Jack
111 | 10. 1 x 10x5cm Universal Soldering Board
112 | 113 | ## Circuit Voltage 114 | 115 | The developed circuit is energized with 5V.
116 | You can adapt a simple 9V battery + 7805 voltage regulator or connect it directly on smartphone charger using a P4 jack. 117 | 118 | **How to do it?** 119 | 120 | **Step 1:** Take a 5V power source and cut the USB cable (assuming that its does not have a P4 jack), letting only these 2 pins available: VCC and GND (the only ones you'll need).
121 | **Step 2:** Connect VCC and GND directly into P4 jack (be careful with the polarity). 122 | 123 | Your power suplly is ready! :)
124 | 125 | *There is below an image of the power supply I used:* 126 | 127 | ![Imgur](http://i.imgur.com/477PfSB.jpg)
128 | 129 | *Finally, there is an image of the circuit working very well:* 130 | 131 | ![Imgur](http://i.imgur.com/myghT7r.jpg) 132 | 133 | ## Copyrigths 134 | 135 | **The project can be reproduced without any problems.**
136 | However, I only ask you to **keep author credits.** :) 137 | 138 | 139 | Enjoy! 140 | 141 | **Hollweg** 142 | 143 | -------------------------------------------------------------------------------- /README-PT.md: -------------------------------------------------------------------------------- 1 | 2 | # 7-Segments-Clock 3 | 4 | ## A Proposta 5 | 6 | Esse é um projeto de um display de 7 segmentos, desenvolvido do zero, usando hardware e software autorais.
7 | O relógio marca **horas, minutos e segundos, usando um microcontrolador ATMEGA328P**, desenvolvido pela ATMEL.
8 | O 7 Segments Clock foi desenvolvido como um projeto pessoal e foi construído em uma placa universal, de acordo com os esquemas da pasta Proteus, dentro deste projeto.
9 | 10 | Durante este README vou explicar como desenvolver o seu próprio Relógio de 7 segmentos. :D 11 | 12 | *Aqui está uma imagem sobre o resultado final do projeto:* 13 | 14 | ![Imgur](http://i.imgur.com/BjCu3v1.jpg) 15 | 16 | ## Utilidade 17 | 18 | O código foi desenvolvido especificamente para o microcontrolador ATMEGA328P, usando a IDE ATMEL Studio. No entanto, **se algumas alterações forem feitas, principalmente na inicialização, configuração e alguns registradores, o projeto pode ser adaptado para outras famílias de microcontroladores, de outros fabricantes** e IDEs. A ideia de construir um Relógio de 7 Segmentos é a mesma, mas algumas coisas vão mudar, como registradores, timer, I/Os e ADCs. 19 | 20 | ## Como funciona? 21 | 22 | O relógio começa a marcar o tempo a partir das 00:00, no momento em que está ligado. **Para ajustar o tempo até a hora e o minuto desejados, é necessário usar os push buttons do circuito (no lado direito do microcontrolador)**. Temos dois botões, um para incrementar horas e outro para incrementar minutos. 23 | 24 | **O algoritmo desenvolvido marca horas, minutos e segundos, mas foi construído apenas com 4 Displays, configurado para marcar horas e minutos. No entanto, se você quiser construir um relógio completo (usando marcadores de segundos também), é necessário apenas adicionar mais dois displays 7 segmentos e conectá-lo em 2 portas do microcontrolador não utilizadas.** 25 | 26 | **O código foi desenvolvido com a lógica do relógio completa, mas quando eu gravo no microcontrolador, comento um dos marcadores (segundos, por exemplo - função "CalculateSeconds") e assim, marca horas + minutos. Por outro lado, se eu quiser ver Minutos + Segundos você precisa comentar a função "CalculateHours" e exibirá Minutos + Segundos.** 27 | 28 | No momento em que o circuito é **desenergizado**, o relógio **perde sua referência** e o tempo atual porque ele não tem um hardware de memória implementado no circuito. 29 | 30 | No entanto, se você precisar armazenar o **último tempo marcado, mesmo com o circuito desenergizado, você pode usar um hardware RTC e ler suas variáveis de tempo, exibindo-os no display de 7 Segmentos**. De qualquer forma, de acordo com o que eu disse durante o desenvolvimento do projeto Binary Clock (disponível aqui em github.com/hollweg/binary-clock), eu acho que esse "upgrade" não é interessante para este tipo de projeto, justamente porque se faz **perder o desafio de desenvolver sua própria rotina, seu próprio hardware, a essência de construir um relógio real, pensar na lógica, contadores, temporizadores, até otimização de software e implementação.** 31 | 32 | Tipos de arquivos encontrados no projeto: 33 | 34 | *- O arquivo .c contém o código desenvolvido, em C.*
35 | *- O arquivo .asm contém o código traduzido para Assembly.*
36 | *- O arquivo .hex é o arquivo pronto para ser gravado, contendo o código em linguagem hexadecimal.*
37 | *- Os outros arquivos são arquivos de configuração, criados pelo compilador.*
38 | *- Dentro da pasta /Proteus está o esquemático do projeto.*
39 | 40 | *Abaixo, está a imagem do hardware do projeto 41 | 42 | ![Imgur](http://i.imgur.com/T5LGVun.png) 43 | 44 | Você pode acessar os arquivos de hardware na pasta /Proteus. 45 | 46 | ## Usando 4 Displays de 7 Segmentos 47 | 48 | Você pode ver no resultado final do projeto que foi usado um **array de 7 Segmentos** (modelo CAI5461AH), **já multiplexado e fácil de ser usado.** 49 | 50 | No entanto, você pode usar o mesmo código **através de 4 Displays de 7 Segmentos.**
51 | Antes de usar o Array de 7 Segmentos, hardware e software foram testados em uma protobard com quatro displays de 7 segmentos. A única diferença é que **você precisa multiplexar os pinos manualmente e conectar um resistor entre a porta do microcontrolador e o pino de controle em cada display** (há 2 pinos de controle (compartilhados) por display).
52 | **Por outro lado, usando o array não é necessário conectar os resistores porque eles já são considerados no circuito do array.** 53 | 54 | *Abaixo, está uma imagem do esquemático de um único display de 7 Segmentos:* 55 | 56 | ![Imgur](http://i.imgur.com/6OF4lW5.gif) 57 | 58 | ![Imgur](http://i.imgur.com/uOHj8T3.gif) 59 | 60 | *Aqui você pode ver quatro Displays de 7 Segmentos multiplexados em um .gif:* 61 | 62 | [Imgur](http://i.imgur.com/3Io3QAH.gifv) 63 | 64 | **Na imagem se pode notar que foram usados transistores para habilitar cada pino de controle do display, mas isso não é necessário.** 65 | 66 | Eu desenvolvi o **sistema de chaveamento do controle de displays por software.**
67 | Cada vez que um display é habilitado (5V - catodo comum), o microcontrolador manda para os outros sinais de controle dos displays 0V, garantindo que nós teremos apenas um display ativo a cada momento. 68 | 69 | Esse sinal de controle é habilitado por um curto período de tempo, muito rápido, então habilita-se outro display, compartilhando o barramento entre os 4 displays de 7 segmentos. Então, como os displays são habilitados centenas de vezes por segundo, nossos olhos tem a impressão que todos os 4 displays estão ativos simultaneamente, o que não é verdade. 70 | 71 | *Aqui está uma imagem do circuito usando quatro Displays de 7 Segmentos (o código usando para o array e para os displays separados é exatamente o mesmo):* 72 | 73 | ![Imgur](http://i.imgur.com/Zn7HhOp.jpg) 74 | 75 | Não é necessário montar o hardware em uma plaquinha para ver seu projeto funcionando.
76 | **Se você quer fazer o projeto rodar usando uma placa do Arduino UNO** (ou alguma outra placa da Arduino que use o microcontrolador ATMEGA328P) **você precisa gravar o código no ATMEGA328P via ATMEL Studio** (você pode ver nesse link aqui como configurar o Atmel Studio para gravar os códigos em plataformas Arduino) **e conectar o display e os botões diretamente nas I/Os da placa do Arduino.** 77 | 78 | **Abaixo, eu descrevi as conexões de hardware para facilitar a construlão do projeto. Dê uma olhada :)** 79 | 80 | **7 Segments LEDs:** 81 | 82 | Segmento a - ATMEGA328P PD2 - Arduino Uno pino Digital 2
83 | Segmento b - ATMEGA328P PD3 - Arduino Uno pino Digital 3
84 | Segmento c - ATMEGA328P PD4 - Arduino Uno pino Digital 4
85 | Segmento d - ATMEGA328P PD5 - Arduino Uno pino Digital 5
86 | Segmento e - ATMEGA328P PD6 - Arduino Uno pino Digital 6
87 | Segmento f - ATMEGA328P PD7 - Arduino Uno pino Digital 7
88 | Segmento g - ATMEGA328P PB0 - Arduino Uno pino Digital 8
89 | Sinal de Controle do display de Minutos (direita) - ATMEGA328P PB2 - Arduino Uno pino Digital 10
90 | Sinal de Controle do display de Minutos (esquerda) - ATMEGA328P PB3 - Arduino Uno pino Digital 11
91 | Sinal de Controle do display de Horas (direita) - ATMEGA328P PB4 - Arduino Uno pino Digital 12
92 | Sinal de Controle do display de Horas (esquerda) - ATMEGA328P PB5 - Arduino Uno pino Digital 13
93 | 94 | **Push Buttons:** 95 | 96 | Reset - ATMEGA328P PC6 - Arduino UNO pino Reset
97 | Incremento de minutos - ATMEGA328P PC1 - Arduino UNO Entrada Analógica 1 (cuidado: Pino de entrada 1, não pino 0)
98 | Incremento de horas - ATMEGA328P PC2 - Arduino UNO Entrada Analógica 2
99 | 100 | **Obs.1**: Se você usar quatro Displays de 7 segmentos, todos os 7 LEDs devem ser multiplexados.
101 | **Obs.2**: Se você usar quatro Displays de 7 segmentos, cada display precisa de seu próprio resistor de entrada (~~270 ohms --- ~~1k ohms).
102 | Além disso, os pinos de controle devem ser conectados em seus dois pinos COM.
103 | **Obs.3**: Cuidado com o tipo de displays de 7 Segments que você estiver usando!
104 | Existem dois tipos diferentes: Anodo Comum e Catodo Comum
105 | Catodo Comum tem seus pinos de controle ON usando nível lógico alto (5V).
106 | Anodo Comum tem seus pinos de controle ON usando nível lógico baixo (0V).
107 | 108 | ## O que foi usado neste projeto? 109 | 110 | **Lista de materiais**: 111 | 112 | 1. 1 x microcontrolador ATMEGA328P
113 | 2. 1 x header de 28 pinos
114 | 3. 3 x Push button
115 | 4. 3 x Resistor 1k ohm (+4 if you use four 7 Segments Display)
116 | 5. 1 x Cristal de 16MHz
117 | 6. 2 x Capacitores de 22pF
118 | 7. 1 x Capacitores de 100nF
119 | 8. 1 x Array 7 Segments Display
120 | 9. 1 x Jack P4 fêmea
121 | 10. 1 x Placa universal 10x5cm
122 | 123 | ## Tensão de alimentação do circuito 124 | 125 | O circuito desenvolvido é energizado com 5V.
126 | Você pode adaptar uma simples bateria de 9V + regulador de tensão 7805, ou então conectá-lo diretamente a uma fonte de alimentação de um smartphone, com um jack P4. 127 | 128 | **Como fazer?** 129 | 130 | **Passo 1:** Pegue uma fonte de alimentação de 5V e corte o cabo USB (assumindo que ele não tenha na extremidade um Jack P4), deixando apenas 2 pinos disponíveis: VCC e GND (os únicos que você precisa).
131 | **Passo 2:** Conecte VCC e GND diretamente dentro do jack P4 (seja cuidado com a polaridade). 132 | 133 | Sua fonte de alimentação está pronta! :)
134 | 135 | *Abaixo, segue uma imagem da fonte de alimentação que eu usei no projeto:* 136 | 137 | ![Imgur](http://i.imgur.com/477PfSB.jpg)
138 | 139 | *Finalmente, aí está uma imagem do circuito funcionando perfeitamente.:* 140 | 141 | ![Imgur](http://i.imgur.com/myghT7r.jpg) 142 | 143 | ## Copyrigths 144 | 145 | **O projeto pode ser reproduzido sem problemas.**
146 | No entanto, eu somente peço que **mantenha os créditos ao autor.** :) 147 | 148 | 149 | Enjoy! 150 | 151 | **Hollweg** 152 | 153 | -------------------------------------------------------------------------------- /7-Segment-Clock-ATMEGA328P/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 7-Segments-Display-ATMEGA328P.c 3 | * 4 | * Created: 29/11/2016 17:52:26 5 | * Author : Hollweg 6 | * Available on www.github.com/hollweg 7 | */ 8 | 9 | #define F_CPU 16000000UL 10 | #define PORT_ON(port,pin) port |= (1< 16 | #include 17 | #include "util/delay.h" 18 | #include 19 | 20 | void CalculateSeconds (bool time_display); 21 | void CalculateMinutes (bool time_display); 22 | void CalculateHours (bool time_display); 23 | void WriteDisplays(uint8_t digit, uint8_t displaynum); 24 | void InitADC(); 25 | uint16_t ReadADC(uint8_t channel); 26 | 27 | uint8_t hour = 0; 28 | uint8_t minutes = 0; 29 | uint8_t seconds = 0; 30 | 31 | uint8_t seven_seg_digits[10][7] = { 32 | { 1,1,1,1,1,1,0 }, // = 0 33 | { 0,1,1,0,0,0,0 }, // = 1 34 | { 1,1,0,1,1,0,1 }, // = 2 35 | { 1,1,1,1,0,0,1 }, // = 3 36 | { 0,1,1,0,0,1,1 }, // = 4 37 | { 1,0,1,1,0,1,1 }, // = 5 38 | { 1,0,1,1,1,1,1 }, // = 6 39 | { 1,1,1,0,0,0,0 }, // = 7 40 | { 1,1,1,1,1,1,1 }, // = 8 41 | { 1,1,1,0,0,1,1 } // = 9 42 | }; 43 | 44 | /*********************************************** 45 | * Name: 46 | * CalculateSeconds 47 | * In: 48 | * -- 49 | * Out: 50 | * -- 51 | * Description: 52 | * Function to write on 7 segments display 53 | * It receives two arguments: the digit 54 | * and the display number to to be writed 55 | * 56 | ************************************************/ 57 | void CalculateSeconds (bool time_display) 58 | { 59 | switch (time_display){ 60 | case 0: 61 | if (seconds/10 == 0 && seconds < 10){ 62 | WriteDisplays(0,1); 63 | WriteDisplays(seconds,0); 64 | } 65 | 66 | else if (seconds%10 != 0){ 67 | WriteDisplays(seconds/10,1); 68 | WriteDisplays(seconds%10,0); 69 | } 70 | 71 | else if (seconds%10 == 0){ 72 | WriteDisplays(seconds/10,1); 73 | WriteDisplays(0,0); 74 | } 75 | break; 76 | 77 | case 1: 78 | if (seconds/10 == 0 && seconds < 10){ 79 | WriteDisplays(0,1); 80 | _delay_ms(25); 81 | WriteDisplays(seconds,0); 82 | _delay_ms(25); 83 | } 84 | 85 | else if (seconds%10 != 0){ 86 | WriteDisplays(seconds/10,1); 87 | _delay_ms(25); 88 | WriteDisplays(seconds%10,0); 89 | _delay_ms(25); 90 | } 91 | 92 | else if (seconds%10 == 0){ 93 | WriteDisplays(seconds/10,1); 94 | _delay_ms(25); 95 | WriteDisplays(0,0); 96 | _delay_ms(25); 97 | } 98 | break; 99 | } 100 | }//~~ end of CalculateSeconds 101 | 102 | /*********************************************** 103 | * Name: 104 | * CalculateMinutes 105 | * In: 106 | * -- 107 | * Out: 108 | * -- 109 | * Description: 110 | * Function to write on 7 segments display 111 | * It receives two arguments: the digit 112 | * and the display number to to be writed 113 | * 114 | ************************************************/ 115 | void CalculateMinutes (bool time_display) 116 | { 117 | switch (time_display){ 118 | case 0: 119 | if (minutes/10 == 0 && minutes < 10){ 120 | WriteDisplays(0,1); 121 | WriteDisplays(minutes, 0); 122 | } 123 | 124 | else if (minutes%10 == 0){ 125 | WriteDisplays(minutes/10, 1); 126 | WriteDisplays(0,0); 127 | } 128 | 129 | else if (minutes%10 != 0){ 130 | WriteDisplays(minutes/10, 1); 131 | WriteDisplays(minutes%10,0); 132 | } 133 | break; 134 | 135 | case 1: 136 | if (minutes/10 == 0 && minutes < 10){ 137 | WriteDisplays(0,1); 138 | _delay_ms(25); 139 | WriteDisplays(minutes, 0); 140 | _delay_ms(25); 141 | } 142 | 143 | else if (minutes%10 == 0){ 144 | WriteDisplays(minutes/10, 1); 145 | _delay_ms(25); 146 | WriteDisplays(0,0); 147 | _delay_ms(25); 148 | } 149 | 150 | else if (minutes%10 != 0){ 151 | WriteDisplays(minutes/10, 1); 152 | _delay_ms(25); 153 | WriteDisplays(minutes%10,0); 154 | _delay_ms(25); 155 | } 156 | break; 157 | } 158 | }//~~ end of CalculateMinutes 159 | 160 | /*********************************************** 161 | * Name: 162 | * CalculateHours 163 | * In: 164 | * -- 165 | * Out: 166 | * -- 167 | * Description: 168 | * Function to write on 7 segments display 169 | * It receives two arguments: the digit 170 | * and the display number to to be writed 171 | * 172 | ************************************************/ 173 | void CalculateHours (bool time_display) 174 | { 175 | switch (time_display){ 176 | case 0: 177 | if (hour/10 == 0){ 178 | WriteDisplays(0,3); 179 | WriteDisplays(hour,2); 180 | } 181 | 182 | else{ 183 | WriteDisplays(1,3); 184 | WriteDisplays(hour%10,2); 185 | } 186 | break; 187 | 188 | case 1: 189 | if (hour/10 == 0){ 190 | WriteDisplays(0,3); 191 | _delay_ms(50); 192 | WriteDisplays(hour,2); 193 | _delay_ms(50); 194 | } 195 | 196 | else{ 197 | WriteDisplays(1,3); 198 | _delay_ms(50); 199 | WriteDisplays(hour%10,2); 200 | _delay_ms(50); 201 | } 202 | break; 203 | } 204 | }//~~ end of CalculateHours 205 | 206 | /*********************************************** 207 | * Name: 208 | * WriteDisplays 209 | * In: 210 | * int digit, int displayNum 211 | * Out: 212 | * -- 213 | * Description: 214 | * Function to write on 7 segments display 215 | * It receives two arguments: the digit 216 | * and the display number to to be writed 217 | * 218 | ************************************************/ 219 | void WriteDisplays(uint8_t digit, uint8_t display_num) 220 | { 221 | uint8_t pin = 2; 222 | PORTD &= 0b00000000; 223 | PORTB &= (0< 750){ 346 | cli(); 347 | seconds += 1; 348 | if (seconds > 59){ 349 | minutes += 1; 350 | seconds = 0; 351 | } 352 | 353 | if (minutes > 59){ 354 | hour += 1; 355 | minutes = 0; 356 | } 357 | 358 | if (hour > 12){ 359 | hour = 0; 360 | } 361 | 362 | //CalculateSeconds(1); 363 | CalculateMinutes(1); 364 | CalculateHours(1); 365 | sei(); 366 | }*/ 367 | 368 | adc_value = ReadADC(1); 369 | if (adc_value > 750) { 370 | cli(); 371 | minutes += 1; 372 | 373 | if (minutes > 59){ 374 | hour += 1; 375 | minutes = 0; 376 | } 377 | 378 | if (hour > 11){ 379 | hour = 0; 380 | } 381 | 382 | //CalculateSeconds(1); 383 | CalculateMinutes(1); 384 | CalculateHours(1); 385 | sei(); 386 | } 387 | 388 | adc_value = ReadADC(2); 389 | if (adc_value > 750) { 390 | cli(); 391 | hour += 1; 392 | 393 | if (hour > 11){ 394 | hour = 0; 395 | } 396 | 397 | //CalculateSeconds(1); 398 | CalculateMinutes(1); 399 | CalculateHours(1); 400 | sei(); 401 | } 402 | 403 | //CalculateSeconds(0); 404 | CalculateMinutes(0); 405 | CalculateHours(0); 406 | } 407 | } 408 | 409 | ISR (TIMER1_COMPA_vect) 410 | { 411 | //action to be done every 1 sec 412 | 413 | if (seconds > 59){ 414 | minutes += 1; 415 | seconds = 0; 416 | } 417 | 418 | if (minutes > 59){ 419 | hour += 1; 420 | minutes = 0; 421 | } 422 | 423 | if (hour > 11){ 424 | hour = 0; 425 | } 426 | seconds += 1; 427 | }//~~ end of interruption 428 | -------------------------------------------------------------------------------- /7-Segment-Clock-ATMEGA328P/Debug/7-Segment-Clock-ATMEGA328P.map: -------------------------------------------------------------------------------- 1 | Archive member included to satisfy reference by file (symbol) 2 | 3 | c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_exit.o) 4 | C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5/crtatmega328p.o (exit) 5 | c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_copy_data.o) 6 | main.o (__do_copy_data) 7 | c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_clear_bss.o) 8 | main.o (__do_clear_bss) 9 | 10 | Discarded input sections 11 | 12 | .data 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5/crtatmega328p.o 13 | .bss 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5/crtatmega328p.o 14 | .text 0x00000000 0x0 main.o 15 | .data 0x00000000 0x0 main.o 16 | .bss 0x00000000 0x0 main.o 17 | .text.CalculateSeconds 18 | 0x00000000 0x192 main.o 19 | .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_exit.o) 20 | .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_exit.o) 21 | .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_exit.o) 22 | .text.libgcc.mul 23 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_exit.o) 24 | .text.libgcc.div 25 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_exit.o) 26 | .text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_exit.o) 27 | .text.libgcc.prologue 28 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_exit.o) 29 | .text.libgcc.builtins 30 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_exit.o) 31 | .text.libgcc.fmul 32 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_exit.o) 33 | .text.libgcc.fixed 34 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_exit.o) 35 | .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_copy_data.o) 36 | .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_copy_data.o) 37 | .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_copy_data.o) 38 | .text.libgcc.mul 39 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_copy_data.o) 40 | .text.libgcc.div 41 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_copy_data.o) 42 | .text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_copy_data.o) 43 | .text.libgcc.prologue 44 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_copy_data.o) 45 | .text.libgcc.builtins 46 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_copy_data.o) 47 | .text.libgcc.fmul 48 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_copy_data.o) 49 | .text.libgcc.fixed 50 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_copy_data.o) 51 | .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_clear_bss.o) 52 | .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_clear_bss.o) 53 | .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_clear_bss.o) 54 | .text.libgcc.mul 55 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_clear_bss.o) 56 | .text.libgcc.div 57 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_clear_bss.o) 58 | .text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_clear_bss.o) 59 | .text.libgcc.prologue 60 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_clear_bss.o) 61 | .text.libgcc.builtins 62 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_clear_bss.o) 63 | .text.libgcc.fmul 64 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_clear_bss.o) 65 | .text.libgcc.fixed 66 | 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_clear_bss.o) 67 | 68 | Memory Configuration 69 | 70 | Name Origin Length Attributes 71 | text 0x00000000 0x00020000 xr 72 | data 0x00800060 0x0000ffa0 rw !x 73 | eeprom 0x00810000 0x00010000 rw !x 74 | fuse 0x00820000 0x00000003 rw !x 75 | lock 0x00830000 0x00000400 rw !x 76 | signature 0x00840000 0x00000400 rw !x 77 | user_signatures 0x00850000 0x00000400 rw !x 78 | *default* 0x00000000 0xffffffff 79 | 80 | Linker script and memory map 81 | 82 | Address of section .data set to 0x800100 83 | LOAD C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5/crtatmega328p.o 84 | LOAD main.o 85 | START GROUP 86 | LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr5\libm.a 87 | END GROUP 88 | START GROUP 89 | LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a 90 | LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr5\libm.a 91 | LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr5\libc.a 92 | LOAD C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5\libatmega328p.a 93 | END GROUP 94 | 0x00020000 __TEXT_REGION_LENGTH__ = DEFINED (__TEXT_REGION_LENGTH__)?__TEXT_REGION_LENGTH__:0x20000 95 | 0x0000ffa0 __DATA_REGION_LENGTH__ = DEFINED (__DATA_REGION_LENGTH__)?__DATA_REGION_LENGTH__:0xffa0 96 | 0x00010000 __EEPROM_REGION_LENGTH__ = DEFINED (__EEPROM_REGION_LENGTH__)?__EEPROM_REGION_LENGTH__:0x10000 97 | [0x00000003] __FUSE_REGION_LENGTH__ = DEFINED (__FUSE_REGION_LENGTH__)?__FUSE_REGION_LENGTH__:0x400 98 | 0x00000400 __LOCK_REGION_LENGTH__ = DEFINED (__LOCK_REGION_LENGTH__)?__LOCK_REGION_LENGTH__:0x400 99 | 0x00000400 __SIGNATURE_REGION_LENGTH__ = DEFINED (__SIGNATURE_REGION_LENGTH__)?__SIGNATURE_REGION_LENGTH__:0x400 100 | 0x00000400 __USER_SIGNATURE_REGION_LENGTH__ = DEFINED (__USER_SIGNATURE_REGION_LENGTH__)?__USER_SIGNATURE_REGION_LENGTH__:0x400 101 | 102 | .hash 103 | *(.hash) 104 | 105 | .dynsym 106 | *(.dynsym) 107 | 108 | .dynstr 109 | *(.dynstr) 110 | 111 | .gnu.version 112 | *(.gnu.version) 113 | 114 | .gnu.version_d 115 | *(.gnu.version_d) 116 | 117 | .gnu.version_r 118 | *(.gnu.version_r) 119 | 120 | .rel.init 121 | *(.rel.init) 122 | 123 | .rela.init 124 | *(.rela.init) 125 | 126 | .rel.text 127 | *(.rel.text) 128 | *(.rel.text.*) 129 | *(.rel.gnu.linkonce.t*) 130 | 131 | .rela.text 132 | *(.rela.text) 133 | *(.rela.text.*) 134 | *(.rela.gnu.linkonce.t*) 135 | 136 | .rel.fini 137 | *(.rel.fini) 138 | 139 | .rela.fini 140 | *(.rela.fini) 141 | 142 | .rel.rodata 143 | *(.rel.rodata) 144 | *(.rel.rodata.*) 145 | *(.rel.gnu.linkonce.r*) 146 | 147 | .rela.rodata 148 | *(.rela.rodata) 149 | *(.rela.rodata.*) 150 | *(.rela.gnu.linkonce.r*) 151 | 152 | .rel.data 153 | *(.rel.data) 154 | *(.rel.data.*) 155 | *(.rel.gnu.linkonce.d*) 156 | 157 | .rela.data 158 | *(.rela.data) 159 | *(.rela.data.*) 160 | *(.rela.gnu.linkonce.d*) 161 | 162 | .rel.ctors 163 | *(.rel.ctors) 164 | 165 | .rela.ctors 166 | *(.rela.ctors) 167 | 168 | .rel.dtors 169 | *(.rel.dtors) 170 | 171 | .rela.dtors 172 | *(.rela.dtors) 173 | 174 | .rel.got 175 | *(.rel.got) 176 | 177 | .rela.got 178 | *(.rela.got) 179 | 180 | .rel.bss 181 | *(.rel.bss) 182 | 183 | .rela.bss 184 | *(.rela.bss) 185 | 186 | .rel.plt 187 | *(.rel.plt) 188 | 189 | .rela.plt 190 | *(.rela.plt) 191 | 192 | .text 0x00000000 0x502 193 | *(.vectors) 194 | .vectors 0x00000000 0x68 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5/crtatmega328p.o 195 | 0x00000000 __vector_default 196 | 0x00000000 __vectors 197 | *(.vectors) 198 | *(.progmem.gcc*) 199 | 0x00000068 . = ALIGN (0x2) 200 | 0x00000068 __trampolines_start = . 201 | *(.trampolines) 202 | .trampolines 0x00000068 0x0 linker stubs 203 | *(.trampolines*) 204 | 0x00000068 __trampolines_end = . 205 | *libprintf_flt.a:*(.progmem.data) 206 | *libc.a:*(.progmem.data) 207 | *(.progmem*) 208 | 0x00000068 . = ALIGN (0x2) 209 | *(.jumptables) 210 | *(.jumptables*) 211 | *(.lowtext) 212 | *(.lowtext*) 213 | 0x00000068 __ctors_start = . 214 | *(.ctors) 215 | 0x00000068 __ctors_end = . 216 | 0x00000068 __dtors_start = . 217 | *(.dtors) 218 | 0x00000068 __dtors_end = . 219 | SORT(*)(.ctors) 220 | SORT(*)(.dtors) 221 | *(.init0) 222 | .init0 0x00000068 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5/crtatmega328p.o 223 | 0x00000068 __init 224 | *(.init0) 225 | *(.init1) 226 | *(.init1) 227 | *(.init2) 228 | .init2 0x00000068 0xc C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5/crtatmega328p.o 229 | *(.init2) 230 | *(.init3) 231 | *(.init3) 232 | *(.init4) 233 | .init4 0x00000074 0x16 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_copy_data.o) 234 | 0x00000074 __do_copy_data 235 | .init4 0x0000008a 0x10 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_clear_bss.o) 236 | 0x0000008a __do_clear_bss 237 | *(.init4) 238 | *(.init5) 239 | *(.init5) 240 | *(.init6) 241 | *(.init6) 242 | *(.init7) 243 | *(.init7) 244 | *(.init8) 245 | *(.init8) 246 | *(.init9) 247 | .init9 0x0000009a 0x8 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5/crtatmega328p.o 248 | *(.init9) 249 | *(.text) 250 | .text 0x000000a2 0x4 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5/crtatmega328p.o 251 | 0x000000a2 __vector_22 252 | 0x000000a2 __vector_1 253 | 0x000000a2 __vector_24 254 | 0x000000a2 __vector_12 255 | 0x000000a2 __bad_interrupt 256 | 0x000000a2 __vector_6 257 | 0x000000a2 __vector_3 258 | 0x000000a2 __vector_23 259 | 0x000000a2 __vector_25 260 | 0x000000a2 __vector_13 261 | 0x000000a2 __vector_17 262 | 0x000000a2 __vector_19 263 | 0x000000a2 __vector_7 264 | 0x000000a2 __vector_5 265 | 0x000000a2 __vector_4 266 | 0x000000a2 __vector_9 267 | 0x000000a2 __vector_2 268 | 0x000000a2 __vector_21 269 | 0x000000a2 __vector_15 270 | 0x000000a2 __vector_8 271 | 0x000000a2 __vector_14 272 | 0x000000a2 __vector_10 273 | 0x000000a2 __vector_16 274 | 0x000000a2 __vector_18 275 | 0x000000a2 __vector_20 276 | 0x000000a6 . = ALIGN (0x2) 277 | *(.text.*) 278 | .text.WriteDisplays 279 | 0x000000a6 0x94 main.o 280 | 0x000000a6 WriteDisplays 281 | .text.CalculateMinutes 282 | 0x0000013a 0x192 main.o 283 | 0x0000013a CalculateMinutes 284 | .text.CalculateHours 285 | 0x000002cc 0xe0 main.o 286 | 0x000002cc CalculateHours 287 | .text.InitADC 0x000003ac 0xe main.o 288 | 0x000003ac InitADC 289 | .text.ReadADC 0x000003ba 0x28 main.o 290 | 0x000003ba ReadADC 291 | .text.main 0x000003e2 0xc2 main.o 292 | 0x000003e2 main 293 | .text.__vector_11 294 | 0x000004a4 0x5a main.o 295 | 0x000004a4 __vector_11 296 | 0x000004fe . = ALIGN (0x2) 297 | *(.fini9) 298 | .fini9 0x000004fe 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_exit.o) 299 | 0x000004fe _exit 300 | 0x000004fe exit 301 | *(.fini9) 302 | *(.fini8) 303 | *(.fini8) 304 | *(.fini7) 305 | *(.fini7) 306 | *(.fini6) 307 | *(.fini6) 308 | *(.fini5) 309 | *(.fini5) 310 | *(.fini4) 311 | *(.fini4) 312 | *(.fini3) 313 | *(.fini3) 314 | *(.fini2) 315 | *(.fini2) 316 | *(.fini1) 317 | *(.fini1) 318 | *(.fini0) 319 | .fini0 0x000004fe 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr5\libgcc.a(_exit.o) 320 | *(.fini0) 321 | 0x00000502 _etext = . 322 | 323 | .data 0x00800100 0x46 load address 0x00000502 324 | 0x00800100 PROVIDE (__data_start, .) 325 | *(.data) 326 | *(.data*) 327 | .data.seven_seg_digits 328 | 0x00800100 0x46 main.o 329 | 0x00800100 seven_seg_digits 330 | *(.rodata) 331 | *(.rodata*) 332 | *(.gnu.linkonce.d*) 333 | 0x00800146 . = ALIGN (0x2) 334 | 0x00800146 _edata = . 335 | 0x00800146 PROVIDE (__data_end, .) 336 | 337 | .bss 0x00800146 0x3 338 | 0x00800146 PROVIDE (__bss_start, .) 339 | *(.bss) 340 | *(.bss*) 341 | .bss.seconds 0x00800146 0x1 main.o 342 | 0x00800146 seconds 343 | .bss.minutes 0x00800147 0x1 main.o 344 | 0x00800147 minutes 345 | .bss.hour 0x00800148 0x1 main.o 346 | 0x00800148 hour 347 | *(COMMON) 348 | 0x00800149 PROVIDE (__bss_end, .) 349 | 0x00000502 __data_load_start = LOADADDR (.data) 350 | 0x00000548 __data_load_end = (__data_load_start + SIZEOF (.data)) 351 | 352 | .noinit 0x00800149 0x0 353 | [!provide] PROVIDE (__noinit_start, .) 354 | *(.noinit*) 355 | [!provide] PROVIDE (__noinit_end, .) 356 | 0x00800149 _end = . 357 | [!provide] PROVIDE (__heap_start, .) 358 | 359 | .eeprom 0x00810000 0x0 360 | *(.eeprom*) 361 | 0x00810000 __eeprom_end = . 362 | 363 | .fuse 364 | *(.fuse) 365 | *(.lfuse) 366 | *(.hfuse) 367 | *(.efuse) 368 | 369 | .lock 370 | *(.lock*) 371 | 372 | .signature 373 | *(.signature*) 374 | 375 | .user_signatures 376 | *(.user_signatures*) 377 | 378 | .stab 379 | *(.stab) 380 | 381 | .stabstr 382 | *(.stabstr) 383 | 384 | .stab.excl 385 | *(.stab.excl) 386 | 387 | .stab.exclstr 388 | *(.stab.exclstr) 389 | 390 | .stab.index 391 | *(.stab.index) 392 | 393 | .stab.indexstr 394 | *(.stab.indexstr) 395 | 396 | .comment 0x00000000 0x30 397 | *(.comment) 398 | .comment 0x00000000 0x30 main.o 399 | 0x31 (size before relaxing) 400 | 401 | .note.gnu.avr.deviceinfo 402 | 0x00000000 0x40 403 | .note.gnu.avr.deviceinfo 404 | 0x00000000 0x40 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5/crtatmega328p.o 405 | 406 | .note.gnu.build-id 407 | *(.note.gnu.build-id) 408 | 409 | .debug 410 | *(.debug) 411 | 412 | .line 413 | *(.line) 414 | 415 | .debug_srcinfo 416 | *(.debug_srcinfo) 417 | 418 | .debug_sfnames 419 | *(.debug_sfnames) 420 | 421 | .debug_aranges 0x00000000 0x58 422 | *(.debug_aranges) 423 | .debug_aranges 424 | 0x00000000 0x58 main.o 425 | 426 | .debug_pubnames 427 | *(.debug_pubnames) 428 | 429 | .debug_info 0x00000000 0xf7b 430 | *(.debug_info .gnu.linkonce.wi.*) 431 | .debug_info 0x00000000 0x5f4 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5/crtatmega328p.o 432 | .debug_info 0x000005f4 0x987 main.o 433 | 434 | .debug_abbrev 0x00000000 0x7a2 435 | *(.debug_abbrev) 436 | .debug_abbrev 0x00000000 0x5a2 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5/crtatmega328p.o 437 | .debug_abbrev 0x000005a2 0x200 main.o 438 | 439 | .debug_line 0x00000000 0x679 440 | *(.debug_line .debug_line.* .debug_line_end) 441 | .debug_line 0x00000000 0x133 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5/crtatmega328p.o 442 | .debug_line 0x00000133 0x546 main.o 443 | 444 | .debug_frame 0x00000000 0xb4 445 | *(.debug_frame) 446 | .debug_frame 0x00000000 0xb4 main.o 447 | 448 | .debug_str 0x00000000 0x485 449 | *(.debug_str) 450 | .debug_str 0x00000000 0x208 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.1.130/gcc/dev/atmega328p/avr5/crtatmega328p.o 451 | .debug_str 0x00000208 0x27d main.o 452 | 0x2b1 (size before relaxing) 453 | 454 | .debug_loc 0x00000000 0x633 455 | *(.debug_loc) 456 | .debug_loc 0x00000000 0x633 main.o 457 | 458 | .debug_macinfo 459 | *(.debug_macinfo) 460 | 461 | .debug_weaknames 462 | *(.debug_weaknames) 463 | 464 | .debug_funcnames 465 | *(.debug_funcnames) 466 | 467 | .debug_typenames 468 | *(.debug_typenames) 469 | 470 | .debug_varnames 471 | *(.debug_varnames) 472 | 473 | .debug_pubtypes 474 | *(.debug_pubtypes) 475 | 476 | .debug_ranges 0x00000000 0x48 477 | *(.debug_ranges) 478 | .debug_ranges 0x00000000 0x48 main.o 479 | 480 | .debug_macro 481 | *(.debug_macro) 482 | OUTPUT(7-Segment-Clock-ATMEGA328P.elf elf32-avr) 483 | LOAD linker stubs 484 | -------------------------------------------------------------------------------- /7-Segment-Clock-ATMEGA328P/Debug/7-Segment-Clock-ATMEGA328P.lss: -------------------------------------------------------------------------------- 1 | 2 | 7-Segment-Clock-ATMEGA328P.elf: file format elf32-avr 3 | 4 | Sections: 5 | Idx Name Size VMA LMA File off Algn 6 | 0 .data 00000046 00800100 00000502 00000596 2**0 7 | CONTENTS, ALLOC, LOAD, DATA 8 | 1 .text 00000502 00000000 00000000 00000094 2**1 9 | CONTENTS, ALLOC, LOAD, READONLY, CODE 10 | 2 .bss 00000003 00800146 00800146 000005dc 2**0 11 | ALLOC 12 | 3 .comment 00000030 00000000 00000000 000005dc 2**0 13 | CONTENTS, READONLY 14 | 4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 0000060c 2**2 15 | CONTENTS, READONLY 16 | 5 .debug_aranges 00000058 00000000 00000000 0000064c 2**0 17 | CONTENTS, READONLY, DEBUGGING 18 | 6 .debug_info 00000f7b 00000000 00000000 000006a4 2**0 19 | CONTENTS, READONLY, DEBUGGING 20 | 7 .debug_abbrev 000007a2 00000000 00000000 0000161f 2**0 21 | CONTENTS, READONLY, DEBUGGING 22 | 8 .debug_line 00000679 00000000 00000000 00001dc1 2**0 23 | CONTENTS, READONLY, DEBUGGING 24 | 9 .debug_frame 000000b4 00000000 00000000 0000243c 2**2 25 | CONTENTS, READONLY, DEBUGGING 26 | 10 .debug_str 00000485 00000000 00000000 000024f0 2**0 27 | CONTENTS, READONLY, DEBUGGING 28 | 11 .debug_loc 00000633 00000000 00000000 00002975 2**0 29 | CONTENTS, READONLY, DEBUGGING 30 | 12 .debug_ranges 00000048 00000000 00000000 00002fa8 2**0 31 | CONTENTS, READONLY, DEBUGGING 32 | 33 | Disassembly of section .text: 34 | 35 | 00000000 <__vectors>: 36 | 0: 0c 94 34 00 jmp 0x68 ; 0x68 <__ctors_end> 37 | 4: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 38 | 8: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 39 | c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 40 | 10: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 41 | 14: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 42 | 18: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 43 | 1c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 44 | 20: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 45 | 24: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 46 | 28: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 47 | 2c: 0c 94 52 02 jmp 0x4a4 ; 0x4a4 <__vector_11> 48 | 30: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 49 | 34: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 50 | 38: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 51 | 3c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 52 | 40: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 53 | 44: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 54 | 48: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 55 | 4c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 56 | 50: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 57 | 54: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 58 | 58: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 59 | 5c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 60 | 60: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 61 | 64: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt> 62 | 63 | 00000068 <__ctors_end>: 64 | 68: 11 24 eor r1, r1 65 | 6a: 1f be out 0x3f, r1 ; 63 66 | 6c: cf ef ldi r28, 0xFF ; 255 67 | 6e: d8 e0 ldi r29, 0x08 ; 8 68 | 70: de bf out 0x3e, r29 ; 62 69 | 72: cd bf out 0x3d, r28 ; 61 70 | 71 | 00000074 <__do_copy_data>: 72 | 74: 11 e0 ldi r17, 0x01 ; 1 73 | 76: a0 e0 ldi r26, 0x00 ; 0 74 | 78: b1 e0 ldi r27, 0x01 ; 1 75 | 7a: e2 e0 ldi r30, 0x02 ; 2 76 | 7c: f5 e0 ldi r31, 0x05 ; 5 77 | 7e: 02 c0 rjmp .+4 ; 0x84 <__do_copy_data+0x10> 78 | 80: 05 90 lpm r0, Z+ 79 | 82: 0d 92 st X+, r0 80 | 84: a6 34 cpi r26, 0x46 ; 70 81 | 86: b1 07 cpc r27, r17 82 | 88: d9 f7 brne .-10 ; 0x80 <__do_copy_data+0xc> 83 | 84 | 0000008a <__do_clear_bss>: 85 | 8a: 21 e0 ldi r18, 0x01 ; 1 86 | 8c: a6 e4 ldi r26, 0x46 ; 70 87 | 8e: b1 e0 ldi r27, 0x01 ; 1 88 | 90: 01 c0 rjmp .+2 ; 0x94 <.do_clear_bss_start> 89 | 90 | 00000092 <.do_clear_bss_loop>: 91 | 92: 1d 92 st X+, r1 92 | 93 | 00000094 <.do_clear_bss_start>: 94 | 94: a9 34 cpi r26, 0x49 ; 73 95 | 96: b2 07 cpc r27, r18 96 | 98: e1 f7 brne .-8 ; 0x92 <.do_clear_bss_loop> 97 | 9a: 0e 94 f1 01 call 0x3e2 ; 0x3e2
98 | 9e: 0c 94 7f 02 jmp 0x4fe ; 0x4fe <_exit> 99 | 100 | 000000a2 <__bad_interrupt>: 101 | a2: 0c 94 00 00 jmp 0 ; 0x0 <__vectors> 102 | 103 | 000000a6 : 104 | WriteDisplays(0,0); 105 | _delay_ms(25); 106 | } 107 | break; 108 | } 109 | }//~~ end of CalculateSeconds 110 | a6: 9b b1 in r25, 0x0b ; 11 111 | a8: 1b b8 out 0x0b, r1 ; 11 112 | aa: 95 b1 in r25, 0x05 ; 5 113 | ac: 15 b8 out 0x05, r1 ; 5 114 | ae: 95 b1 in r25, 0x05 ; 5 115 | b0: 15 b8 out 0x05, r1 ; 5 116 | b2: 61 11 cpse r22, r1 117 | b4: 06 c0 rjmp .+12 ; 0xc2 118 | b6: 95 b1 in r25, 0x05 ; 5 119 | b8: 15 b8 out 0x05, r1 ; 5 120 | ba: 2b 9a sbi 0x05, 3 ; 5 121 | bc: 2c 9a sbi 0x05, 4 ; 5 122 | be: 2d 9a sbi 0x05, 5 ; 5 123 | c0: 32 c0 rjmp .+100 ; 0x126 124 | c2: 61 30 cpi r22, 0x01 ; 1 125 | c4: 31 f4 brne .+12 ; 0xd2 126 | c6: 95 b1 in r25, 0x05 ; 5 127 | c8: 15 b8 out 0x05, r1 ; 5 128 | ca: 2a 9a sbi 0x05, 2 ; 5 129 | cc: 2c 9a sbi 0x05, 4 ; 5 130 | ce: 2d 9a sbi 0x05, 5 ; 5 131 | d0: 2a c0 rjmp .+84 ; 0x126 132 | d2: 62 30 cpi r22, 0x02 ; 2 133 | d4: 31 f4 brne .+12 ; 0xe2 134 | d6: 95 b1 in r25, 0x05 ; 5 135 | d8: 15 b8 out 0x05, r1 ; 5 136 | da: 2a 9a sbi 0x05, 2 ; 5 137 | dc: 2b 9a sbi 0x05, 3 ; 5 138 | de: 2d 9a sbi 0x05, 5 ; 5 139 | e0: 22 c0 rjmp .+68 ; 0x126 140 | e2: 63 30 cpi r22, 0x03 ; 3 141 | e4: 01 f5 brne .+64 ; 0x126 142 | e6: 95 b1 in r25, 0x05 ; 5 143 | e8: 15 b8 out 0x05, r1 ; 5 144 | ea: 2a 9a sbi 0x05, 2 ; 5 145 | ec: 2b 9a sbi 0x05, 3 ; 5 146 | ee: 2c 9a sbi 0x05, 4 ; 5 147 | f0: 1a c0 rjmp .+52 ; 0x126 148 | f2: 48 30 cpi r20, 0x08 ; 8 149 | f4: 68 f4 brcc .+26 ; 0x110 150 | f6: 8b b1 in r24, 0x0b ; 11 151 | f8: 90 81 ld r25, Z 152 | fa: 29 2f mov r18, r25 153 | fc: 30 e0 ldi r19, 0x00 ; 0 154 | fe: 06 2e mov r0, r22 155 | 100: 02 c0 rjmp .+4 ; 0x106 156 | 102: 22 0f add r18, r18 157 | 104: 33 1f adc r19, r19 158 | 106: 0a 94 dec r0 159 | 108: e2 f7 brpl .-8 ; 0x102 160 | 10a: 28 2b or r18, r24 161 | 10c: 2b b9 out 0x0b, r18 ; 11 162 | 10e: 04 c0 rjmp .+8 ; 0x118 163 | 110: 95 b1 in r25, 0x05 ; 5 164 | 112: 80 81 ld r24, Z 165 | 114: 89 2b or r24, r25 166 | 116: 85 b9 out 0x05, r24 ; 5 167 | 118: 4f 5f subi r20, 0xFF ; 255 168 | 11a: 31 96 adiw r30, 0x01 ; 1 169 | 11c: 6f 5f subi r22, 0xFF ; 255 170 | 11e: 7f 4f sbci r23, 0xFF ; 255 171 | 120: 49 30 cpi r20, 0x09 ; 9 172 | 122: 39 f7 brne .-50 ; 0xf2 173 | 124: 08 95 ret 174 | 126: 97 e0 ldi r25, 0x07 ; 7 175 | 128: 89 9f mul r24, r25 176 | 12a: f0 01 movw r30, r0 177 | 12c: 11 24 eor r1, r1 178 | 12e: e0 50 subi r30, 0x00 ; 0 179 | 130: ff 4f sbci r31, 0xFF ; 255 180 | 132: 62 e0 ldi r22, 0x02 ; 2 181 | 134: 70 e0 ldi r23, 0x00 ; 0 182 | 136: 42 e0 ldi r20, 0x02 ; 2 183 | 138: dc cf rjmp .-72 ; 0xf2 184 | 185 | 0000013a : 186 | * It receives two arguments: the digit 187 | * and the display number to to be writed 188 | * 189 | ************************************************/ 190 | void CalculateMinutes (bool time_display) 191 | { 192 | 13a: cf 93 push r28 193 | switch (time_display){ 194 | 13c: 81 30 cpi r24, 0x01 ; 1 195 | 13e: 09 f4 brne .+2 ; 0x142 196 | 140: 47 c0 rjmp .+142 ; 0x1d0 197 | case 0: 198 | if (minutes/10 == 0 && minutes < 10){ 199 | 142: 80 91 47 01 lds r24, 0x0147 ; 0x800147 200 | 146: 8a 30 cpi r24, 0x0A ; 10 201 | 148: 50 f4 brcc .+20 ; 0x15e 202 | WriteDisplays(0,1); 203 | 14a: 61 e0 ldi r22, 0x01 ; 1 204 | 14c: 80 e0 ldi r24, 0x00 ; 0 205 | 14e: 0e 94 53 00 call 0xa6 ; 0xa6 206 | WriteDisplays(minutes, 0); 207 | 152: 60 e0 ldi r22, 0x00 ; 0 208 | 154: 80 91 47 01 lds r24, 0x0147 ; 0x800147 209 | 158: 0e 94 53 00 call 0xa6 ; 0xa6 210 | 15c: b5 c0 rjmp .+362 ; 0x2c8 211 | } 212 | 213 | else if (minutes%10 == 0){ 214 | 15e: 9d ec ldi r25, 0xCD ; 205 215 | 160: 89 9f mul r24, r25 216 | 162: 91 2d mov r25, r1 217 | 164: 11 24 eor r1, r1 218 | 166: 96 95 lsr r25 219 | 168: 96 95 lsr r25 220 | 16a: 96 95 lsr r25 221 | 16c: 99 0f add r25, r25 222 | 16e: 29 2f mov r18, r25 223 | 170: 22 0f add r18, r18 224 | 172: 22 0f add r18, r18 225 | 174: 92 0f add r25, r18 226 | 176: 89 13 cpse r24, r25 227 | 178: 0f c0 rjmp .+30 ; 0x198 228 | WriteDisplays(minutes/10, 1); 229 | 17a: 9d ec ldi r25, 0xCD ; 205 230 | 17c: 89 9f mul r24, r25 231 | 17e: 81 2d mov r24, r1 232 | 180: 11 24 eor r1, r1 233 | 182: 61 e0 ldi r22, 0x01 ; 1 234 | 184: 86 95 lsr r24 235 | 186: 86 95 lsr r24 236 | 188: 86 95 lsr r24 237 | 18a: 0e 94 53 00 call 0xa6 ; 0xa6 238 | WriteDisplays(0,0); 239 | 18e: 60 e0 ldi r22, 0x00 ; 0 240 | 190: 80 e0 ldi r24, 0x00 ; 0 241 | 192: 0e 94 53 00 call 0xa6 ; 0xa6 242 | 196: 98 c0 rjmp .+304 ; 0x2c8 243 | } 244 | 245 | else if (minutes%10 != 0){ 246 | WriteDisplays(minutes/10, 1); 247 | 198: cd ec ldi r28, 0xCD ; 205 248 | 19a: 8c 9f mul r24, r28 249 | 19c: 81 2d mov r24, r1 250 | 19e: 11 24 eor r1, r1 251 | 1a0: 61 e0 ldi r22, 0x01 ; 1 252 | 1a2: 86 95 lsr r24 253 | 1a4: 86 95 lsr r24 254 | 1a6: 86 95 lsr r24 255 | 1a8: 0e 94 53 00 call 0xa6 ; 0xa6 256 | WriteDisplays(minutes%10,0); 257 | 1ac: 80 91 47 01 lds r24, 0x0147 ; 0x800147 258 | 1b0: 8c 9f mul r24, r28 259 | 1b2: c1 2d mov r28, r1 260 | 1b4: 11 24 eor r1, r1 261 | 1b6: c6 95 lsr r28 262 | 1b8: c6 95 lsr r28 263 | 1ba: c6 95 lsr r28 264 | 1bc: cc 0f add r28, r28 265 | 1be: 9c 2f mov r25, r28 266 | 1c0: 99 0f add r25, r25 267 | 1c2: 99 0f add r25, r25 268 | 1c4: c9 0f add r28, r25 269 | 1c6: 60 e0 ldi r22, 0x00 ; 0 270 | 1c8: 8c 1b sub r24, r28 271 | 1ca: 0e 94 53 00 call 0xa6 ; 0xa6 272 | 1ce: 7c c0 rjmp .+248 ; 0x2c8 273 | } 274 | break; 275 | 276 | case 1: 277 | if (minutes/10 == 0 && minutes < 10){ 278 | 1d0: 80 91 47 01 lds r24, 0x0147 ; 0x800147 279 | 1d4: 8a 30 cpi r24, 0x0A ; 10 280 | 1d6: e0 f4 brcc .+56 ; 0x210 281 | WriteDisplays(0,1); 282 | 1d8: 61 e0 ldi r22, 0x01 ; 1 283 | 1da: 80 e0 ldi r24, 0x00 ; 0 284 | 1dc: 0e 94 53 00 call 0xa6 ; 0xa6 285 | #else 286 | //round up by default 287 | __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); 288 | #endif 289 | 290 | __builtin_avr_delay_cycles(__ticks_dc); 291 | 1e0: 2f e7 ldi r18, 0x7F ; 127 292 | 1e2: 88 e3 ldi r24, 0x38 ; 56 293 | 1e4: 91 e0 ldi r25, 0x01 ; 1 294 | 1e6: 21 50 subi r18, 0x01 ; 1 295 | 1e8: 80 40 sbci r24, 0x00 ; 0 296 | 1ea: 90 40 sbci r25, 0x00 ; 0 297 | 1ec: e1 f7 brne .-8 ; 0x1e6 298 | 1ee: 00 c0 rjmp .+0 ; 0x1f0 299 | 1f0: 00 00 nop 300 | _delay_ms(25); 301 | WriteDisplays(minutes, 0); 302 | 1f2: 60 e0 ldi r22, 0x00 ; 0 303 | 1f4: 80 91 47 01 lds r24, 0x0147 ; 0x800147 304 | 1f8: 0e 94 53 00 call 0xa6 ; 0xa6 305 | 1fc: 2f e7 ldi r18, 0x7F ; 127 306 | 1fe: 88 e3 ldi r24, 0x38 ; 56 307 | 200: 91 e0 ldi r25, 0x01 ; 1 308 | 202: 21 50 subi r18, 0x01 ; 1 309 | 204: 80 40 sbci r24, 0x00 ; 0 310 | 206: 90 40 sbci r25, 0x00 ; 0 311 | 208: e1 f7 brne .-8 ; 0x202 312 | 20a: 00 c0 rjmp .+0 ; 0x20c 313 | 20c: 00 00 nop 314 | 20e: 5c c0 rjmp .+184 ; 0x2c8 315 | _delay_ms(25); 316 | } 317 | 318 | else if (minutes%10 == 0){ 319 | 210: 9d ec ldi r25, 0xCD ; 205 320 | 212: 89 9f mul r24, r25 321 | 214: 91 2d mov r25, r1 322 | 216: 11 24 eor r1, r1 323 | 218: 96 95 lsr r25 324 | 21a: 96 95 lsr r25 325 | 21c: 96 95 lsr r25 326 | 21e: 99 0f add r25, r25 327 | 220: 29 2f mov r18, r25 328 | 222: 22 0f add r18, r18 329 | 224: 22 0f add r18, r18 330 | 226: 92 0f add r25, r18 331 | 228: 89 13 cpse r24, r25 332 | 22a: 21 c0 rjmp .+66 ; 0x26e 333 | WriteDisplays(minutes/10, 1); 334 | 22c: 9d ec ldi r25, 0xCD ; 205 335 | 22e: 89 9f mul r24, r25 336 | 230: 81 2d mov r24, r1 337 | 232: 11 24 eor r1, r1 338 | 234: 61 e0 ldi r22, 0x01 ; 1 339 | 236: 86 95 lsr r24 340 | 238: 86 95 lsr r24 341 | 23a: 86 95 lsr r24 342 | 23c: 0e 94 53 00 call 0xa6 ; 0xa6 343 | 240: 2f e7 ldi r18, 0x7F ; 127 344 | 242: 88 e3 ldi r24, 0x38 ; 56 345 | 244: 91 e0 ldi r25, 0x01 ; 1 346 | 246: 21 50 subi r18, 0x01 ; 1 347 | 248: 80 40 sbci r24, 0x00 ; 0 348 | 24a: 90 40 sbci r25, 0x00 ; 0 349 | 24c: e1 f7 brne .-8 ; 0x246 350 | 24e: 00 c0 rjmp .+0 ; 0x250 351 | 250: 00 00 nop 352 | _delay_ms(25); 353 | WriteDisplays(0,0); 354 | 252: 60 e0 ldi r22, 0x00 ; 0 355 | 254: 80 e0 ldi r24, 0x00 ; 0 356 | 256: 0e 94 53 00 call 0xa6 ; 0xa6 357 | 25a: 2f e7 ldi r18, 0x7F ; 127 358 | 25c: 88 e3 ldi r24, 0x38 ; 56 359 | 25e: 91 e0 ldi r25, 0x01 ; 1 360 | 260: 21 50 subi r18, 0x01 ; 1 361 | 262: 80 40 sbci r24, 0x00 ; 0 362 | 264: 90 40 sbci r25, 0x00 ; 0 363 | 266: e1 f7 brne .-8 ; 0x260 364 | 268: 00 c0 rjmp .+0 ; 0x26a 365 | 26a: 00 00 nop 366 | 26c: 2d c0 rjmp .+90 ; 0x2c8 367 | _delay_ms(25); 368 | } 369 | 370 | else if (minutes%10 != 0){ 371 | WriteDisplays(minutes/10, 1); 372 | 26e: cd ec ldi r28, 0xCD ; 205 373 | 270: 8c 9f mul r24, r28 374 | 272: 81 2d mov r24, r1 375 | 274: 11 24 eor r1, r1 376 | 276: 61 e0 ldi r22, 0x01 ; 1 377 | 278: 86 95 lsr r24 378 | 27a: 86 95 lsr r24 379 | 27c: 86 95 lsr r24 380 | 27e: 0e 94 53 00 call 0xa6 ; 0xa6 381 | 282: 2f e7 ldi r18, 0x7F ; 127 382 | 284: 88 e3 ldi r24, 0x38 ; 56 383 | 286: 91 e0 ldi r25, 0x01 ; 1 384 | 288: 21 50 subi r18, 0x01 ; 1 385 | 28a: 80 40 sbci r24, 0x00 ; 0 386 | 28c: 90 40 sbci r25, 0x00 ; 0 387 | 28e: e1 f7 brne .-8 ; 0x288 388 | 290: 00 c0 rjmp .+0 ; 0x292 389 | 292: 00 00 nop 390 | _delay_ms(25); 391 | WriteDisplays(minutes%10,0); 392 | 294: 80 91 47 01 lds r24, 0x0147 ; 0x800147 393 | 298: 8c 9f mul r24, r28 394 | 29a: c1 2d mov r28, r1 395 | 29c: 11 24 eor r1, r1 396 | 29e: c6 95 lsr r28 397 | 2a0: c6 95 lsr r28 398 | 2a2: c6 95 lsr r28 399 | 2a4: cc 0f add r28, r28 400 | 2a6: 9c 2f mov r25, r28 401 | 2a8: 99 0f add r25, r25 402 | 2aa: 99 0f add r25, r25 403 | 2ac: c9 0f add r28, r25 404 | 2ae: 60 e0 ldi r22, 0x00 ; 0 405 | 2b0: 8c 1b sub r24, r28 406 | 2b2: 0e 94 53 00 call 0xa6 ; 0xa6 407 | 2b6: 2f e7 ldi r18, 0x7F ; 127 408 | 2b8: 88 e3 ldi r24, 0x38 ; 56 409 | 2ba: 91 e0 ldi r25, 0x01 ; 1 410 | 2bc: 21 50 subi r18, 0x01 ; 1 411 | 2be: 80 40 sbci r24, 0x00 ; 0 412 | 2c0: 90 40 sbci r25, 0x00 ; 0 413 | 2c2: e1 f7 brne .-8 ; 0x2bc 414 | 2c4: 00 c0 rjmp .+0 ; 0x2c6 415 | 2c6: 00 00 nop 416 | _delay_ms(25); 417 | } 418 | break; 419 | } 420 | }//~~ end of CalculateMinutes 421 | 2c8: cf 91 pop r28 422 | 2ca: 08 95 ret 423 | 424 | 000002cc : 425 | * and the display number to to be writed 426 | * 427 | ************************************************/ 428 | void CalculateHours (bool time_display) 429 | { 430 | switch (time_display){ 431 | 2cc: 81 30 cpi r24, 0x01 ; 1 432 | 2ce: 29 f1 breq .+74 ; 0x31a 433 | case 0: 434 | if (hour/10 == 0){ 435 | 2d0: 80 91 48 01 lds r24, 0x0148 ; 0x800148 436 | 2d4: 8a 30 cpi r24, 0x0A ; 10 437 | 2d6: 50 f4 brcc .+20 ; 0x2ec 438 | WriteDisplays(0,3); 439 | 2d8: 63 e0 ldi r22, 0x03 ; 3 440 | 2da: 80 e0 ldi r24, 0x00 ; 0 441 | 2dc: 0e 94 53 00 call 0xa6 ; 0xa6 442 | WriteDisplays(hour,2); 443 | 2e0: 62 e0 ldi r22, 0x02 ; 2 444 | 2e2: 80 91 48 01 lds r24, 0x0148 ; 0x800148 445 | 2e6: 0e 94 53 00 call 0xa6 ; 0xa6 446 | 2ea: 08 95 ret 447 | } 448 | 449 | else{ 450 | WriteDisplays(1,3); 451 | 2ec: 63 e0 ldi r22, 0x03 ; 3 452 | 2ee: 81 e0 ldi r24, 0x01 ; 1 453 | 2f0: 0e 94 53 00 call 0xa6 ; 0xa6 454 | WriteDisplays(hour%10,2); 455 | 2f4: 80 91 48 01 lds r24, 0x0148 ; 0x800148 456 | 2f8: 9d ec ldi r25, 0xCD ; 205 457 | 2fa: 89 9f mul r24, r25 458 | 2fc: 91 2d mov r25, r1 459 | 2fe: 11 24 eor r1, r1 460 | 300: 96 95 lsr r25 461 | 302: 96 95 lsr r25 462 | 304: 96 95 lsr r25 463 | 306: 99 0f add r25, r25 464 | 308: 29 2f mov r18, r25 465 | 30a: 22 0f add r18, r18 466 | 30c: 22 0f add r18, r18 467 | 30e: 92 0f add r25, r18 468 | 310: 62 e0 ldi r22, 0x02 ; 2 469 | 312: 89 1b sub r24, r25 470 | 314: 0e 94 53 00 call 0xa6 ; 0xa6 471 | 318: 08 95 ret 472 | } 473 | break; 474 | 475 | case 1: 476 | if (hour/10 == 0){ 477 | 31a: 80 91 48 01 lds r24, 0x0148 ; 0x800148 478 | 31e: 8a 30 cpi r24, 0x0A ; 10 479 | 320: e0 f4 brcc .+56 ; 0x35a 480 | WriteDisplays(0,3); 481 | 322: 63 e0 ldi r22, 0x03 ; 3 482 | 324: 80 e0 ldi r24, 0x00 ; 0 483 | 326: 0e 94 53 00 call 0xa6 ; 0xa6 484 | 32a: 2f ef ldi r18, 0xFF ; 255 485 | 32c: 80 e7 ldi r24, 0x70 ; 112 486 | 32e: 92 e0 ldi r25, 0x02 ; 2 487 | 330: 21 50 subi r18, 0x01 ; 1 488 | 332: 80 40 sbci r24, 0x00 ; 0 489 | 334: 90 40 sbci r25, 0x00 ; 0 490 | 336: e1 f7 brne .-8 ; 0x330 491 | 338: 00 c0 rjmp .+0 ; 0x33a 492 | 33a: 00 00 nop 493 | _delay_ms(50); 494 | WriteDisplays(hour,2); 495 | 33c: 62 e0 ldi r22, 0x02 ; 2 496 | 33e: 80 91 48 01 lds r24, 0x0148 ; 0x800148 497 | 342: 0e 94 53 00 call 0xa6 ; 0xa6 498 | 346: 2f ef ldi r18, 0xFF ; 255 499 | 348: 80 e7 ldi r24, 0x70 ; 112 500 | 34a: 92 e0 ldi r25, 0x02 ; 2 501 | 34c: 21 50 subi r18, 0x01 ; 1 502 | 34e: 80 40 sbci r24, 0x00 ; 0 503 | 350: 90 40 sbci r25, 0x00 ; 0 504 | 352: e1 f7 brne .-8 ; 0x34c 505 | 354: 00 c0 rjmp .+0 ; 0x356 506 | 356: 00 00 nop 507 | 358: 08 95 ret 508 | _delay_ms(50); 509 | } 510 | 511 | else{ 512 | WriteDisplays(1,3); 513 | 35a: 63 e0 ldi r22, 0x03 ; 3 514 | 35c: 81 e0 ldi r24, 0x01 ; 1 515 | 35e: 0e 94 53 00 call 0xa6 ; 0xa6 516 | 362: 2f ef ldi r18, 0xFF ; 255 517 | 364: 80 e7 ldi r24, 0x70 ; 112 518 | 366: 92 e0 ldi r25, 0x02 ; 2 519 | 368: 21 50 subi r18, 0x01 ; 1 520 | 36a: 80 40 sbci r24, 0x00 ; 0 521 | 36c: 90 40 sbci r25, 0x00 ; 0 522 | 36e: e1 f7 brne .-8 ; 0x368 523 | 370: 00 c0 rjmp .+0 ; 0x372 524 | 372: 00 00 nop 525 | _delay_ms(50); 526 | WriteDisplays(hour%10,2); 527 | 374: 80 91 48 01 lds r24, 0x0148 ; 0x800148 528 | 378: 9d ec ldi r25, 0xCD ; 205 529 | 37a: 89 9f mul r24, r25 530 | 37c: 91 2d mov r25, r1 531 | 37e: 11 24 eor r1, r1 532 | 380: 96 95 lsr r25 533 | 382: 96 95 lsr r25 534 | 384: 96 95 lsr r25 535 | 386: 99 0f add r25, r25 536 | 388: 29 2f mov r18, r25 537 | 38a: 22 0f add r18, r18 538 | 38c: 22 0f add r18, r18 539 | 38e: 92 0f add r25, r18 540 | 390: 62 e0 ldi r22, 0x02 ; 2 541 | 392: 89 1b sub r24, r25 542 | 394: 0e 94 53 00 call 0xa6 ; 0xa6 543 | 398: 2f ef ldi r18, 0xFF ; 255 544 | 39a: 80 e7 ldi r24, 0x70 ; 112 545 | 39c: 92 e0 ldi r25, 0x02 ; 2 546 | 39e: 21 50 subi r18, 0x01 ; 1 547 | 3a0: 80 40 sbci r24, 0x00 ; 0 548 | 3a2: 90 40 sbci r25, 0x00 ; 0 549 | 3a4: e1 f7 brne .-8 ; 0x39e 550 | 3a6: 00 c0 rjmp .+0 ; 0x3a8 551 | 3a8: 00 00 nop 552 | 3aa: 08 95 ret 553 | 554 | 000003ac : 555 | * 556 | * 557 | ************************************************/ 558 | void InitADC () 559 | { 560 | ADCSRA = (1< 563 | ADMUX = 0x00 | (1< 566 | 3b8: 08 95 ret 567 | 568 | 000003ba : 569 | ************************************************/ 570 | uint16_t ReadADC (uint8_t channel) 571 | { 572 | uint16_t adc_value; 573 | 574 | ADMUX &= 0xF0; //Clear the older channel that was read 575 | 3ba: ec e7 ldi r30, 0x7C ; 124 576 | 3bc: f0 e0 ldi r31, 0x00 ; 0 577 | 3be: 90 81 ld r25, Z 578 | 3c0: 90 7f andi r25, 0xF0 ; 240 579 | 3c2: 90 83 st Z, r25 580 | ADMUX = channel | (1< 593 | 594 | adc_value = ADCW; //Store ADC value 595 | 3d8: 80 91 78 00 lds r24, 0x0078 ; 0x800078 <__TEXT_REGION_LENGTH__+0x7e0078> 596 | 3dc: 90 91 79 00 lds r25, 0x0079 ; 0x800079 <__TEXT_REGION_LENGTH__+0x7e0079> 597 | return adc_value; 598 | }//~~ end of ReadADC 599 | 3e0: 08 95 ret 600 | 601 | 000003e2
: 602 | int main(void) 603 | { 604 | uint8_t pin, digit; 605 | uint16_t adc_value; 606 | //Data Direction Register: 1 - output 0 - input 607 | DDRD = 0b11111100; //7 segments bus control: PORTB(2,3,4,5) 608 | 3e2: 8c ef ldi r24, 0xFC ; 252 609 | 3e4: 8a b9 out 0x0a, r24 ; 10 610 | DDRB = 0b00111111; //7 segments multiplexed leds: Arduino UNO pins 2 - 7: PORTD(2,3,4,5,6,7) and 8: PORTB0 611 | 3e6: 8f e3 ldi r24, 0x3F ; 63 612 | 3e8: 84 b9 out 0x04, r24 ; 4 613 | //Arduino pin 9: PB1 --- white LED 614 | PORTB |= (0< 626 | 627 | OCR1A = 0x3D08; //Timer definitions 628 | 3f8: 88 e0 ldi r24, 0x08 ; 8 629 | 3fa: 9d e3 ldi r25, 0x3D ; 61 630 | 3fc: 90 93 89 00 sts 0x0089, r25 ; 0x800089 <__TEXT_REGION_LENGTH__+0x7e0089> 631 | 400: 80 93 88 00 sts 0x0088, r24 ; 0x800088 <__TEXT_REGION_LENGTH__+0x7e0088> 632 | TCCR1B |= (1 << WGM12); // Mode 4, CTC on OCR1A 633 | 404: e1 e8 ldi r30, 0x81 ; 129 634 | 406: f0 e0 ldi r31, 0x00 ; 0 635 | 408: 80 81 ld r24, Z 636 | 40a: 88 60 ori r24, 0x08 ; 8 637 | 40c: 80 83 st Z, r24 638 | TIMSK1 |= (1 << OCIE1A); //Set interrupt on compare match 639 | 40e: af e6 ldi r26, 0x6F ; 111 640 | 410: b0 e0 ldi r27, 0x00 ; 0 641 | 412: 8c 91 ld r24, X 642 | 414: 82 60 ori r24, 0x02 ; 2 643 | 416: 8c 93 st X, r24 644 | TCCR1B |= (1 << CS12) | (1 << CS10); // set prescaler to 1024 and start the timer 645 | 418: 80 81 ld r24, Z 646 | 41a: 85 60 ori r24, 0x05 ; 5 647 | 41c: 80 83 st Z, r24 648 | sei(); // enable interrupts 649 | 41e: 78 94 sei 650 | 651 | PORT_OFF(PORTB,1); 652 | 420: 29 98 cbi 0x05, 1 ; 5 653 | CalculateMinutes(1); 654 | CalculateHours(1); 655 | sei(); 656 | }*/ 657 | 658 | adc_value = ReadADC(1); 659 | 422: 81 e0 ldi r24, 0x01 ; 1 660 | 424: 0e 94 dd 01 call 0x3ba ; 0x3ba 661 | if (adc_value > 750) { 662 | 428: 8f 3e cpi r24, 0xEF ; 239 663 | 42a: 92 40 sbci r25, 0x02 ; 2 664 | 42c: e0 f0 brcs .+56 ; 0x466 <__LOCK_REGION_LENGTH__+0x66> 665 | cli(); 666 | 42e: f8 94 cli 667 | minutes += 1; 668 | 430: 80 91 47 01 lds r24, 0x0147 ; 0x800147 669 | 434: 8f 5f subi r24, 0xFF ; 255 670 | 436: 80 93 47 01 sts 0x0147, r24 ; 0x800147 671 | 672 | if (minutes > 59){ 673 | 43a: 8c 33 cpi r24, 0x3C ; 60 674 | 43c: 38 f0 brcs .+14 ; 0x44c <__LOCK_REGION_LENGTH__+0x4c> 675 | hour += 1; 676 | 43e: 80 91 48 01 lds r24, 0x0148 ; 0x800148 677 | 442: 8f 5f subi r24, 0xFF ; 255 678 | 444: 80 93 48 01 sts 0x0148, r24 ; 0x800148 679 | minutes = 0; 680 | 448: 10 92 47 01 sts 0x0147, r1 ; 0x800147 681 | } 682 | 683 | if (hour > 11){ 684 | 44c: 80 91 48 01 lds r24, 0x0148 ; 0x800148 685 | 450: 8c 30 cpi r24, 0x0C ; 12 686 | 452: 10 f0 brcs .+4 ; 0x458 <__LOCK_REGION_LENGTH__+0x58> 687 | hour = 0; 688 | 454: 10 92 48 01 sts 0x0148, r1 ; 0x800148 689 | } 690 | 691 | //CalculateSeconds(1); 692 | CalculateMinutes(1); 693 | 458: 81 e0 ldi r24, 0x01 ; 1 694 | 45a: 0e 94 9d 00 call 0x13a ; 0x13a 695 | CalculateHours(1); 696 | 45e: 81 e0 ldi r24, 0x01 ; 1 697 | 460: 0e 94 66 01 call 0x2cc ; 0x2cc 698 | sei(); 699 | 464: 78 94 sei 700 | } 701 | 702 | adc_value = ReadADC(2); 703 | 466: 82 e0 ldi r24, 0x02 ; 2 704 | 468: 0e 94 dd 01 call 0x3ba ; 0x3ba 705 | if (adc_value > 750) { 706 | 46c: 8f 3e cpi r24, 0xEF ; 239 707 | 46e: 92 40 sbci r25, 0x02 ; 2 708 | 470: 90 f0 brcs .+36 ; 0x496 <__LOCK_REGION_LENGTH__+0x96> 709 | cli(); 710 | 472: f8 94 cli 711 | hour += 1; 712 | 474: 80 91 48 01 lds r24, 0x0148 ; 0x800148 713 | 478: 8f 5f subi r24, 0xFF ; 255 714 | 715 | if (hour > 11){ 716 | 47a: 8c 30 cpi r24, 0x0C ; 12 717 | 47c: 18 f4 brcc .+6 ; 0x484 <__LOCK_REGION_LENGTH__+0x84> 718 | } 719 | 720 | adc_value = ReadADC(2); 721 | if (adc_value > 750) { 722 | cli(); 723 | hour += 1; 724 | 47e: 80 93 48 01 sts 0x0148, r24 ; 0x800148 725 | 482: 02 c0 rjmp .+4 ; 0x488 <__LOCK_REGION_LENGTH__+0x88> 726 | 727 | if (hour > 11){ 728 | hour = 0; 729 | 484: 10 92 48 01 sts 0x0148, r1 ; 0x800148 730 | } 731 | 732 | //CalculateSeconds(1); 733 | CalculateMinutes(1); 734 | 488: 81 e0 ldi r24, 0x01 ; 1 735 | 48a: 0e 94 9d 00 call 0x13a ; 0x13a 736 | CalculateHours(1); 737 | 48e: 81 e0 ldi r24, 0x01 ; 1 738 | 490: 0e 94 66 01 call 0x2cc ; 0x2cc 739 | sei(); 740 | 494: 78 94 sei 741 | } 742 | 743 | //CalculateSeconds(0); 744 | CalculateMinutes(0); 745 | 496: 80 e0 ldi r24, 0x00 ; 0 746 | 498: 0e 94 9d 00 call 0x13a ; 0x13a 747 | CalculateHours(0); 748 | 49c: 80 e0 ldi r24, 0x00 ; 0 749 | 49e: 0e 94 66 01 call 0x2cc ; 0x2cc 750 | } 751 | 4a2: bf cf rjmp .-130 ; 0x422 <__LOCK_REGION_LENGTH__+0x22> 752 | 753 | 000004a4 <__vector_11>: 754 | } 755 | 756 | ISR (TIMER1_COMPA_vect) 757 | { 758 | 4a4: 1f 92 push r1 759 | 4a6: 0f 92 push r0 760 | 4a8: 0f b6 in r0, 0x3f ; 63 761 | 4aa: 0f 92 push r0 762 | 4ac: 11 24 eor r1, r1 763 | 4ae: 8f 93 push r24 764 | //action to be done every 1 sec 765 | 766 | if (seconds > 59){ 767 | 4b0: 80 91 46 01 lds r24, 0x0146 ; 0x800146 <__data_end> 768 | 4b4: 8c 33 cpi r24, 0x3C ; 60 769 | 4b6: 38 f0 brcs .+14 ; 0x4c6 <__vector_11+0x22> 770 | minutes += 1; 771 | 4b8: 80 91 47 01 lds r24, 0x0147 ; 0x800147 772 | 4bc: 8f 5f subi r24, 0xFF ; 255 773 | 4be: 80 93 47 01 sts 0x0147, r24 ; 0x800147 774 | seconds = 0; 775 | 4c2: 10 92 46 01 sts 0x0146, r1 ; 0x800146 <__data_end> 776 | } 777 | 778 | if (minutes > 59){ 779 | 4c6: 80 91 47 01 lds r24, 0x0147 ; 0x800147 780 | 4ca: 8c 33 cpi r24, 0x3C ; 60 781 | 4cc: 38 f0 brcs .+14 ; 0x4dc <__vector_11+0x38> 782 | hour += 1; 783 | 4ce: 80 91 48 01 lds r24, 0x0148 ; 0x800148 784 | 4d2: 8f 5f subi r24, 0xFF ; 255 785 | 4d4: 80 93 48 01 sts 0x0148, r24 ; 0x800148 786 | minutes = 0; 787 | 4d8: 10 92 47 01 sts 0x0147, r1 ; 0x800147 788 | } 789 | 790 | if (hour > 11){ 791 | 4dc: 80 91 48 01 lds r24, 0x0148 ; 0x800148 792 | 4e0: 8c 30 cpi r24, 0x0C ; 12 793 | 4e2: 10 f0 brcs .+4 ; 0x4e8 <__vector_11+0x44> 794 | hour = 0; 795 | 4e4: 10 92 48 01 sts 0x0148, r1 ; 0x800148 796 | } 797 | seconds += 1; 798 | 4e8: 80 91 46 01 lds r24, 0x0146 ; 0x800146 <__data_end> 799 | 4ec: 8f 5f subi r24, 0xFF ; 255 800 | 4ee: 80 93 46 01 sts 0x0146, r24 ; 0x800146 <__data_end> 801 | }//~~ end of interruption 802 | 4f2: 8f 91 pop r24 803 | 4f4: 0f 90 pop r0 804 | 4f6: 0f be out 0x3f, r0 ; 63 805 | 4f8: 0f 90 pop r0 806 | 4fa: 1f 90 pop r1 807 | 4fc: 18 95 reti 808 | 809 | 000004fe <_exit>: 810 | 4fe: f8 94 cli 811 | 812 | 00000500 <__stop_program>: 813 | 500: ff cf rjmp .-2 ; 0x500 <__stop_program> 814 | --------------------------------------------------------------------------------