/tags/V0.14/Compass.pnproj |
---|
0,0 → 1,0 |
<Project name="avr_ctrl"><File path="uart.h"></File><File path="main.c"></File><File path="main.h"></File><File path="makefile"></File><File path="uart.c"></File><File path="timer0.c"></File><File path="timer0.h"></File><File path="analog.h"></File><File path="analog.c"></File><File path="twislave.c"></File><File path="twislave.h"></File></Project> |
/tags/V0.14/Compassl.pnps |
---|
0,0 → 1,0 |
<pd><ViewState><e p="avr_ctrl" x="true"></e></ViewState></pd> |
/tags/V0.14/Hex-Files/BootLoader_MEGA168_8MHZ_V0.2.hex |
---|
0,0 → 1,61 |
:1038000011241FBECFEFD4E0DEBFCDBF11E0A0E09A |
:10381000B1E0EEEAFBE302C005900D92A030B107E3 |
:10382000D9F711E0A0E0B1E001C01D92A238B107C4 |
:10383000E1F70C943B1C0C941D1C0895982F80916B |
:10384000C00085FFFCCF9093C60008958091C00012 |
:103850008823E4F78091C600992708958DE40E949B |
:103860001E1C8BE40E941E1C82E40E941E1C8CE421 |
:103870000E941E1C0895CFEFD4E0DEBFCDBFE0E074 |
:10388000F0E004917F01992494BE98E10FB6F8947A |
:1038900090936000109260000FBE9092C50080E18E |
:1038A0008093C4008091C00082608093C000909398 |
:1038B000C10086E08093C200EF01192D8091C00005 |
:1038C00087FF0DC0113031F48091C6008A3A89F12A |
:1038D00010E005C08091C6008B3109F411E0CE01E3 |
:1038E00021968436910500F10F3F41F0002331F01D |
:1038F000E0910001F0910101099516C08AE00E9453 |
:103900001E1C8DE00E941E1C86E50E941E1C80E38A |
:103910000E941E1C8EE20E941E1C82E30E941E1C3E |
:103920008AE30E941E1C05C080E29EE40197F1F725 |
:10393000C5CF0E942E1C0E94261C813611F489E5F9 |
:1039400033C1813471F40E94261CE82EFF24FE2C22 |
:10395000EE240E94261C9927E82AF92AF694E79477 |
:10396000F1C0823641F489E50E941E1C80E00E946D |
:103970001E1C80E819C1823409F075C00E94261C03 |
:103980000E94261CD82E0E94261C082FB2E0AB2EC7 |
:10399000B1E0BB2E10E0E5010894A11CB11C1D157F |
:1039A00018F40E94261C01C08FEF88831F5F17FF49 |
:1039B000F2CF38E7931609F0D4C0063409F03DC0C1 |
:1039C0008FEFE81687E3F80608F033C0CD2DA70186 |
:1039D00066277727440F551F661F771F6A017B01F3 |
:1039E000A2E0B1E011E08D9199272D913327322F7C |
:1039F0002227822B932B0C01FA0110935700E89594 |
:103A000011244E5F5F4F6F4F7F4FC25061F785E0CB |
:103A1000F60180935700E89507B600FCFDCF81E1E1 |
:103A200080935700E89576956795579547957A0165 |
:103A300089C080E00E941E1C85C0053409F082C048 |
:103A4000F7012D2DA2E0B1E0E1BD8F2F992782BDB6 |
:103A50008D9180BD3196FA9AF99AF999FECF21504D |
:103A600099F77F016FC0873609F03DC00E94261C80 |
:103A70000E94261CC82F0E94261C863419F5C701F7 |
:103A8000AA27BB276C017D01CC0CDD1CEE1CFF1CA2 |
:103A9000F60105911491802F0E941E1C812F9927F9 |
:103AA0000E941E1C82E090E0A0E0B0E0C80ED91E8B |
:103AB000EA1EFB1EC25061F7F694E794D794C794B0 |
:103AC000760139CF853409F036CFE1BC8F2D9927A7 |
:103AD00082BDF89A0894E11CF11C80B50E941E1C5E |
:103AE000C15099F728CF853601F598E7991651F519 |
:103AF00080E090E0A0E0B0E023E0FC0120935700DC |
:103B0000E89507B600FCFDCF80589F4FAF4FBF4FE1 |
:103B10008F3F37E3930730E0A30730E0B30768F344 |
:103B200081E180935700E8950DC0853469F488E100 |
:103B300090E02CE00FB6F894A895809360000FBE3B |
:103B4000209360008DE030C08035E1F38C34D1F3F8 |
:103B5000803711F483E528C0843729F488E70E9470 |
:103B60001E1C80E021C0843521F40E94261C982E62 |
:103B7000E9CF8B3109F4DDCE8A3A09F4DACE863505 |
:103B800029F480E30E941E1C82E30EC0833741F4B7 |
:103B900086E00E941E1C84E90E941E1C8EE104C067 |
:0E3BA0008B3109F4C8CE8FE30E941E1CC4CEE8 |
:0400000300003800C1 |
:00000001FF |
/tags/V0.14/Hex-Files/MK3Mag_MEGA168_V0_14.hex |
---|
0,0 → 1,489 |
:100000000C945A000C9475000C9475000C947500B7 |
:100010000C9475000C9475000C9475000C9475008C |
:100020000C9475000C9475000C9475000C9475007C |
:100030000C9475000C9475000C9475000C9475006C |
:100040000C9491090C9475000C94D6060C947500D0 |
:100050000C9406060C9475000C9475000C947500B5 |
:100060000C94520A0C947500083B3BD74ABC846E32 |
:10007000023D2FC1FEBD9A31743DDA3D83BE117F32 |
:10008000C73E4CBBE5BEAAAA6C3F80000000082911 |
:10009000573F9F2D49CBA5310F76C73493F27E375A |
:1000A000D00D013AB60B613D2AAAAB3F0000003FDC |
:1000B0008000000011241FBECFEFD4E0DEBFCDBF13 |
:1000C00013E0A0E0B1E0E6E6FCE102C005900D928D |
:1000D000A230B107D9F714E0A2E0B3E001C01D924D |
:1000E000AF39B107E1F70C9431050C94000096B5D7 |
:1000F000980F86B5891B87FDFCCF08954F925F92BC |
:100100006F927F928F929F92AF92BF92CF92DF9227 |
:10011000EF92FF920F931F93CF93DF938091410350 |
:10012000909142032091330330913403821B930B4F |
:100130002091350330913603280F391F37FF02C055 |
:100140002F5F3F4FF901F595E795F0933603E09364 |
:1001500035038091390390913A0320913103309116 |
:100160003203821B930B2091490330914A03280FDD |
:10017000391F37FF02C02F5F3F4F390175946794D5 |
:1001800070924A036092490380914B0390914C0313 |
:1001900020914D0330914E03821B930B20913D0320 |
:1001A00030913E03280F391F37FF02C02F5F3F4FAA |
:1001B00029015594479450923E0340923D0360912B |
:1001C00010037091110320910E0330910F03CB01A6 |
:1001D000820F931F97FD0196AC015595479550935B |
:1001E000400340933F03A0900C03B0900D03C091D7 |
:1001F0000A03D0910B03C5018C0F9D1F97FD01963B |
:100200006C01D594C794D0923C03C0923B0380907C |
:10021000080390900903E0900603F0900703C401DF |
:100220008E0D9F1D97FD01968C01159507951093D6 |
:10023000380300933703CF01841B950BAA2797FD42 |
:10024000A095BA2F4AE0880F991FAA1FBB1F4A9595 |
:10025000D1F7261B370B442737FD4095542FBC019F |
:10026000CD010E94D80D3093460320934503C3016E |
:100270008C199D09AA2797FDA095BA2F3AE0880FFF |
:10028000991FAA1FBB1F3A95D1F7CA19DB099E0116 |
:10029000442737FD4095542FBC01CD010E94D80D55 |
:1002A0003093480320934703C201801B910BAA2778 |
:1002B00097FDA095BA2F2AE0880F991FAA1FBB1F90 |
:1002C0002A95D1F7E818F9089701442737FD40959A |
:1002D000542FBC01CD010E94D80D309344032093CC |
:1002E0004303DF91CF911F910F91FF90EF90DF902B |
:1002F000CF90BF90AF909F908F907F906F905F90C6 |
:100300004F9008952F923F924F925F926F927F92FB |
:100310008F929F92AF92BF92CF92DF92EF92FF9215 |
:100320000F931F93CF93DF93CDB7DEB72E970FB602 |
:10033000F894DEBF0FBECDBF80913204909133049C |
:10034000AA2797FDA095BA2FBC01CD010E945E0C93 |
:10035000DC01CB012BED3FE049E450E4BC01CD01D1 |
:100360000E94740DDC01CB0120E030E041EE54E44A |
:10037000BC01CD010E94FB0B5B016C018091340438 |
:1003800090913504AA2797FDA095BA2FBC01CD0105 |
:100390000E945E0CDC01CB012BED3FE049E450E410 |
:1003A000BC01CD010E94740DDC01CB0120E030E0E6 |
:1003B00041EE54E4BC01CD010E94FB0B69837A83BA |
:1003C0008B839C838090450390904603C401AA27A9 |
:1003D00097FDA095BA2FBC01CD010E945E0C7B0158 |
:1003E0008C018091470390914803AA2797FDA0951F |
:1003F000BA2FBC01CD010E945E0C6D837E838F837A |
:1004000098878091430390914403AA2797FDA09574 |
:10041000BA2FBC01CD010E945E0C69877A878B8759 |
:100420009C87809139048130A1F4ED80FE800F819A |
:1004300018858827992788199909AA2797FDA095D3 |
:10044000BA2FBC01CD010E945E0C6D837E838F8329 |
:100450009887C601B5010E94F50BDC01CB019C0118 |
:10046000AD01C801B7010E94740D3B014C01C601EA |
:10047000B5010E94BC0D5B016C019B01AC016D815B |
:100480007E818F8198850E94740D7B018C0169812A |
:100490007A818B819C810E94BC0D1B012C019B01E8 |
:1004A000AC01C801B7010E94740DDC01CB019C01B5 |
:1004B000AD01C401B3010E94840B3B014C01A601B4 |
:1004C000950169857A858B859C850E94740D7B01D9 |
:1004D0008C0169817A818B819C810E94F50B5B0183 |
:1004E0006C019B01AC01C801B7010E94740DDC01D5 |
:1004F000CB019C01AD01C401B3010E94830B3B0100 |
:100500004C01A60195016D817E818F8198850E94A5 |
:10051000740D7B018C01A201910169857A858B851F |
:100520009C850E94740DDC01CB019C01AD01C801CA |
:10053000B7010E94840B7B018C0120E030E040E099 |
:1005400050E0C401B3010E947B0C882369F420E0D1 |
:1005500030E040E050E0C801B7010E947B0C8823E6 |
:100560001CF48AE590E0C8C020E030E040E050E0B4 |
:10057000C401B3010E947B0C882379F420E030E0B1 |
:1005800040E050E0C801B7010E947E0C18162CF420 |
:10059000EEE0F1E0FE87ED87B1C020E030E040E022 |
:1005A00050E0C401B3010E947B0C88234CF5A401E8 |
:1005B0009301C801B7010E94FB0BDC01CB01BC0118 |
:1005C000CD010E94C60BDC01CB0120E030E044E30A |
:1005D00053E4BC01CD010E94740DDC01CB012BED75 |
:1005E0003FE049E450E4BC01CD010E94FB0BDC017B |
:1005F000CB019C01AD0160E070E084E393E472C044 |
:1006000020E030E040E050E0C401B3010E947E0CE5 |
:1006100018165CF520E030E040E050E0C801B7017A |
:100620000E947B0C88230CF5A4019301C801B7013B |
:100630000E94FB0BDC01CB01BC01CD010E94C60B6B |
:10064000DC01CB0120E030E044E353ECBC01CD0100 |
:100650000E94740DDC01CB012BED3FE049E450E436 |
:10066000BC01CD010E94FB0B3FC020E030E040E028 |
:1006700050E0C401B3010E947E0C18160CF03EC07D |
:1006800020E030E040E050E0C801B7010E947E0C5D |
:100690001816A4F5A4019301C801B7010E94FB0B31 |
:1006A000DC01CB01BC01CD010E94C60BDC01CB01FA |
:1006B00020E030E044E353E4BC01CD010E94740D1E |
:1006C000DC01CB012BED3FE049E450E4BC01CD015E |
:1006D0000E94FB0BDC01CB019C01AD0160E070E0EE |
:1006E00084EB93E40E94830BDC01CB01BC01CD01C0 |
:1006F0000E94410CDC01CB019E878D878D859E85F4 |
:1007000088599E4F815D924030F48D859E859093EF |
:10071000500380934F0380914F03909150030A96AA |
:1007200090930503809304032E960FB6F894DEBFD2 |
:100730000FBECDBFDF91CF911F910F91FF90EF9032 |
:10074000DF90CF90BF90AF909F908F907F906F90F1 |
:100750005F904F903F902F9008958091810488235F |
:1007600011F48091380499278230910599F18330F2 |
:1007700091052CF4009779F0019779F00895843071 |
:10078000910509F460C0843091050CF45AC00597B6 |
:1007900009F476C008955F9A089520E137E2309316 |
:1007A00011032093100380EF98ED90930F03809333 |
:1007B0000E0330930D0320930C0390930B0380934F |
:1007C0000A0330930903209308039093070380934F |
:1007D000060337C05F9A209135033091360380912C |
:1007E0001003909111032817390724F43093110353 |
:1007F0002093100380910E0390910F0382179307AB |
:1008000024F430930F0320930E0320914903309179 |
:100810004A0380910C0390910D032817390724F4A3 |
:1008200030930D0320930C0380910A0390910B03E6 |
:10083000821793070CF086C030930B0320930A03B2 |
:1008400008955F9808955F9A20913D0330913E038B |
:1008500080910803909109032817390724F43093F5 |
:1008600009032093080380910603909107038217E0 |
:1008700093070CF067C03093070320930603089595 |
:100880005F9880910E0390910F0340911003509157 |
:100890001103841B950B873991050CF452C080918C |
:1008A0000A0390910B0320910C0330910D03821BDE |
:1008B000930B873991050CF444C080910603909105 |
:1008C00007032091080330910903821B930B87399A |
:1008D00091050CF436C0AAE0B0E00A010E941A0E9D |
:1008E000A8E0B0E080910E0390910F030C010E94EC |
:1008F0001A0EA6E0B0E080910C0390910D030C015C |
:100900000E941A0EA4E0B0E080910A0390910B03BC |
:100910000C010E941A0EA2E0B0E0809108039091B1 |
:1009200009030C010E941A0EA0E0B0E080910603BA |
:10093000909107030C010E941A0E80ED97E00E942F |
:10094000110A5F9A08958091450390914603909310 |
:100950003D0480933C048091470390914803909319 |
:100960003F0480933E04809143039091440390930D |
:100970004104809340048091350390913603909315 |
:100980004304809342048091490390914A039093D9 |
:1009900045048093440480913D0390913E039093DD |
:1009A00047048093460480913204909133049093DD |
:1009B00049048093480480913404909135049093C5 |
:1009C0004B0480934A0480911003909111039093FB |
:1009D0004D0480934C0480910E0390910F039093EB |
:1009E0004F0480934E0480910C0390910D039093DB |
:1009F00051048093500480910A0390910B039093CB |
:100A000053048093520480910803909109039093BA |
:100A100055048093540480910603909107039093AA |
:100A20005704809356048091380499279093590471 |
:100A30008093580480914F039091500390935B04EE |
:100A400080935A0480913604992790935D04809393 |
:100A50005C0480913704992790935F0480935E042F |
:100A60000895CFEFD4E0DEBFCDBF88E087B988B965 |
:100A700084EF8AB980EA8BB984E084B985E385B9CB |
:100A80005F9A0E945B080E94F0090E941E0A0E9461 |
:100A9000400A789484E690E00E94FD099093B703A1 |
:100AA0008093B603AAE0B0E00E94150EF093110304 |
:100AB000E0931003A8E0B0E00E94150EF0930F033E |
:100AC000E0930E03A6E0B0E00E94150EF0930D0334 |
:100AD000E0930C03A4E0B0E00E94150EF0930B032A |
:100AE000E0930A03A2E0B0E00E94150EF093090320 |
:100AF000E0930803A0E0B0E00E94150EF093070316 |
:100B0000E09306031092B9038EE08093BA0387E066 |
:100B10008093BB0310923904109238041092810420 |
:100B20008BB18F798BB982E090E00E94110A80E04E |
:100B30000E942B0A909342038093410381E00E941C |
:100B40002B0A909581959F4F90934C0380934B0374 |
:100B500087E00E942B0A90933A038093390381E047 |
:100B600090E00E94110A8BB180668BB982E090E020 |
:100B70000E94110A80E00E942B0A90933403809314 |
:100B8000330381E00E942B0A909581959F4F9093AB |
:100B90004E0380934D0387E00E942B0A909332030B |
:100BA0008093310381E090E00E94110A0E947E0050 |
:100BB00080913804882321F480918104882319F0DE |
:100BC0000E94AD0302C00E9482010E94970880919A |
:100BD000020390910303892B91F0519A8091C100F7 |
:100BE00088608093C1000E94260980910203909141 |
:100BF00003030197909303038093020391CF8091A5 |
:100C0000C100877F8093C10051988ACF1F920F92B5 |
:100C10000FB60F9211248F939F93EF93FF938091C0 |
:100C200000038823E1F480911E0390911F03019635 |
:100C300090931F0380931E03FC01EE5AFC4FE0814A |
:100C4000ED3019F08436910539F410921F0310929B |
:100C50001E0381E080930003E093C60004C010925D |
:100C60001F0310921E03FF91EF919F918F910F90A0 |
:100C70000FBE0F901F9018958091C00086FF29C06D |
:100C800080910003882309F580912003909121032E |
:100C900001969093210380932003FC01EE5AFC4FB0 |
:100CA000E081ED3019F08436910539F4109221037A |
:100CB0001092200381E0809300038091C000816046 |
:100CC0008093C000E093C600089510922103109213 |
:100CD000200308951F93CF93DF93EC0110E0662368 |
:100CE00009F460C0A22FBB271297E42FFF27E2531D |
:100CF000FC4F30813D534F5FE42FFF27E253FC4F01 |
:100D000050815D534F5FE42FFF27E253FC4F70810A |
:100D10007D534F5FE42FFF27E253FC4FE081ED53FB |
:100D20004F5F842F9927A817B907E4F1832F9927DC |
:100D3000880F991F880F991F352F32953F70382BD8 |
:100D4000852F99278F70907054E0880F991F5A95BE |
:100D5000E1F7572F56955695582B872F9927837073 |
:100D6000907026E0880F991F2A95E1F78E2B61502D |
:100D70006F3FC1F0FE01E10FF11D30831F5F615035 |
:100D80006F3F81F0FE01E10FF11D50831F5F615045 |
:100D90006F3F41F0FE01E10FF11D80831F5F66236D |
:100DA00009F0A3CFDF91CF911F9108951F920F9269 |
:100DB0000FB60F9211242F933F934F935F938F930E |
:100DC0009F93AF93BF93CF93DF93EF93FF93809164 |
:100DD000C60080931C0340912603443610F0109205 |
:100DE000270350911C035D3009F04DC0809127030B |
:100DF000823009F048C010922703A42FBB27A253CA |
:100E0000BC4FFD0132978081209122033091230352 |
:100E1000281B3109ED0121978881281B3109C9015F |
:100E20009F709093230380932203689415F89695FE |
:100E300087951694E1F7982F935C909324032F7372 |
:100E40003070235C209325038081981709F06AC0D5 |
:100E50008881281709F066C081E080931B034093C6 |
:100E600012035C938091D003823509F05BC088E166 |
:100E700090E02CE00FB6F894A895809360000FBE28 |
:100E8000209360004FC020912703822F9927813043 |
:100E90009105F9F0823091051CF4892B21F040C0B6 |
:100EA000029711F13DC080911C03833239F4809187 |
:100EB0001B03882319F481E08093270380911C038E |
:100EC0008093CE0381E08093260380911C039927B1 |
:100ED00022C02F5F20932703E42FFF27E253FC4F0C |
:100EE00080911C03808309C0E42FFF27E253FC4F4D |
:100EF00080911C038083443620F44F5F4093260387 |
:100F000002C01092270320911C038091220390912C |
:100F10002303820F911D909323038093220302C029 |
:100F200010922703FF91EF91DF91CF91BF91AF9185 |
:100F30009F918F915F914F913F912F910F900FBE95 |
:100F40000F901F901895AC01A0E0B0E09D01A8178C |
:100F5000B90748F4E2E5F3E08191280F311D1196BD |
:100F6000A417B507C8F33F70FD01EE5AFC4FC90145 |
:100F700076E0969587957A95E1F7835C8083119664 |
:100F8000FD01EE5AFC4F2F733070822F835C8083FB |
:100F9000AD5ABC4F8DE08C931092000380915203A8 |
:100FA0008093C60008951F93CF93DF93382FEA01F3 |
:100FB000722F10E083E280935203609353033093C7 |
:100FC0005403A3E0B0E0772309F458C0772311F469 |
:100FD000972F07C0FE01E10FF11D1F5F9081715037 |
:100FE00011F4472F0EC0FE01E10FF11D1F5F40817C |
:100FF000715039F0FE01E10FF11D1F5F60817150EA |
:1010000001C0672FFD01EE5AFC4F892F869586950A |
:10101000835C80831196FD01EE5AFC4F892F99273E |
:101020008370907024E0880F991F2A95E1F7552767 |
:101030009A0194E0369527959A95E1F7822B835C87 |
:1010400080831196FD01EE5AFC4F4F705070440F93 |
:10105000551F440F551F862F992726E09695879593 |
:101060002A95E1F7842B835C80831196FD01EE5A6B |
:10107000FC4F6F73635C60831196A5CFCD010E9416 |
:10108000A307DF91CF911F910895CF93C82F80912F |
:10109000C10083FF0BC0CA3019F48DE00E944508DF |
:1010A0008091C00085FFFCCFC093C60080E090E037 |
:1010B000CF910895089588E18093C1008091C00088 |
:1010C00082608093C0008091C10080688093C100DD |
:1010D0008091C10080648093C10080E18093C4004E |
:1010E00088EC90E00E94FD099093B7038093B603CB |
:1010F0008AE00E94450883E40E94450880E50E943A |
:1011000045088AE30E94450886E50E94450880E379 |
:101110000E9445088EE20E94450881E30E9445082E |
:1011200084E30E9445088AE00E9445080895CF9311 |
:10113000DF93CDB7DEB722970FB6F894DEBF0FBEB0 |
:10114000CDBF80911B03882309F477C08FEF809374 |
:10115000B8038091D00399278736910509F45BC0C5 |
:10116000883691056CF48136910509F448C08136C2 |
:1011700091050CF460C0843691050CF05CC024C06D |
:1011800086379105C1F1873791052CF48836910592 |
:1011900009F44BC050C08737910509F04CC020912D |
:1011A000120343E068E082E394E00E946A068091C3 |
:1011B0005A0490915B04019690935B0480935A04C7 |
:1011C00081E08093170337C02091120343E06BE066 |
:1011D00083EC93E00E946A068091CB039927909359 |
:1011E0003304809332048091CC0399279093350483 |
:1011F0008093340420C081E080931A0316C02091AC |
:10120000120343E062E0CE0101960E946A068981E2 |
:10121000809319030AC08FEF90E0909303038093AB |
:10122000020381E08093180306C08FEF90E0909353 |
:1012300003038093020310921B0322960FB6F894C7 |
:10124000DEBF0FBECDBFDF91CF9108958091B60371 |
:101250009091B7030E94060A8823B1F080910003A1 |
:10126000882391F00E94A30422E44AE354E06091B1 |
:10127000510384E40E94D3078AEF90E00E94FD09A5 |
:101280009093B7038093B60380911A03882371F07B |
:1012900080910003882351F02AE049EB53E06091EC |
:1012A000510386E50E94D30710921A036091190337 |
:1012B0006F3F91F0862F992734E0880F991F3A9558 |
:1012C000E1F780509F4F605D20E1AC0181E40E9416 |
:1012D000D3078FEF8093190380911803882371F04F |
:1012E00080910003882351F02BE043EC53E06091A0 |
:1012F000510387E40E94D3071092180380911703CB |
:10130000882371F080910003882351F022E04AE89D |
:1013100054E0609151038BE40E94D30710921703AD |
:1013200008951F920F920FB60F9211242F933F939F |
:101330008F939F9386B5855686BD80917C048F5F81 |
:1013400080937C0420912F03309130032F5F3F4F17 |
:101350003093300320932F0381E02C37380731F48A |
:101360002A9A1092300310922F0308C08091040330 |
:10137000909105032817390709F42A9880912E03C4 |
:10138000815080932E03882311F58AE080932E03E9 |
:1013900080912C0390912D03019690932D038093BF |
:1013A0002C0380912A0390912B03009729F0019739 |
:1013B00090932B0380932A03809128039091290313 |
:1013C000009729F0019790932903809328039F9118 |
:1013D0008F913F912F910F900FBE0F901F901895F6 |
:1013E00082E085BD80916E00816080936E00809167 |
:1013F0006E00806480936E00089520912C033091DC |
:101400002D03280F391FC9010197089520912C033E |
:1014100030912D03821B930B892F99278078992770 |
:101420000895CF93DF930E94FD09EC01CE010E9445 |
:10143000060A8823D9F3DF91CF91089510927C009A |
:1014400087E880937A0010927C0080917A00806413 |
:1014500080937A00089580937C0080917A00806167 |
:1014600080937A0080917A00806480937A008091E2 |
:101470007A0084FFFCCF80917800909179000895E4 |
:1014800080E58093BA0085EC8093BC008091B9031D |
:10149000809392048091BA038093930481E08093B7 |
:1014A000940408951F920F920FB60F9211242F9358 |
:1014B0003F934F935F938F939F93EF93FF9380910D |
:1014C000B9009927887F907080389105F1F08138B4 |
:1014D00091053CF4009709F401C18036910591F023 |
:1014E00002C1883B910509F4DEC0893B91052CF4CB |
:1014F000883A910509F4C9C0F6C0883F910509F4FE |
:10150000E8C0F1C010929E04EEC020919E042223F8 |
:1015100009F09AC08091BB0080938404992783309E |
:10152000910509F466C08430910534F48130910549 |
:1015300079F00297D1F19DC08A309105A9F08B30E6 |
:1015400091051CF40497A9F094C00B97E1F091C0A9 |
:1015500082E994E09093800480937F0483E08093F9 |
:101560009D042093950485C020939D048CE894E00D |
:1015700004C020939D0481E894E090937E048093BE |
:101580007D0483E00FC080E994E090938004809311 |
:101590007F0422E020939D04019790937E04809322 |
:1015A0007D0481E08093950464C086E994E0909383 |
:1015B000800480937F0486E080939D0420939504AB |
:1015C00080914503909146039093970480939604ED |
:1015D00080914703909148039093990480939804D5 |
:1015E000809143039091440390939B0480939A04C9 |
:1015F00040C08AE894E09093800480937F0482E066 |
:1016000080939D0485E894E090937E0480937D040C |
:1016100084E08093950480914F03909150039093C0 |
:101620008B0480938A048091850490918604909322 |
:1016300033048093320480918704909188049093BE |
:1016400035048093340415C0422F55279A01215048 |
:1016500030408091950499272817390754F4E09178 |
:101660007D04F0917E04E40FF51F31978091BB005B |
:10167000808380919E048F5F80939E0484EF91E02D |
:1016800090932B0380932A032EC010929C04809188 |
:101690009D04882341F1E0917F04F091800481E072 |
:1016A00080939C040FC090919C0480919D04981796 |
:1016B00068F4E0917F04F0918004E90FF11D9F5FD1 |
:1016C00090939C0480818093BB000DC01092BB005E |
:1016D0000AC08091BC0080698093BC008091BC00EE |
:1016E00080698093BC0085EC8093BC00FF91EF91F2 |
:1016F0009F918F915F914F913F912F910F900FBECE |
:101700000F901F9018955058192E90D101D040C1BC |
:10171000BA176207730784079507B1F188F40EF4CE |
:1017200010940B2EBA2FA02D062E622F202D072EDF |
:10173000732F302D082E842F402D092E952F502DDC |
:10174000FF275523B9F0591B49F0573E98F04695AD |
:1017500037952795A795F0405395C9F776F0BA0FBE |
:10176000621F731F841F30F4879577956795B7952F |
:10177000F040939517FA0F2E0895BF1BBB27BA0BA5 |
:10178000620B730B840BF6CFDEF67CC11F930F93B5 |
:101790000027192F10789F775FE340E861307105CB |
:1017A0008407950718F000680E94BB0C912B6F937B |
:1017B0007F938F939F930E94CF0DE8E6F0E003D1D3 |
:1017C0005F914F913F912F910E94740D002351F032 |
:1017D0002BED3FE049EC5FE300E8902717FD5068F0 |
:1017E0000E94840B0F911F91089550E449EC3FE053 |
:1017F0002BED6ED0A2C01AD101D0CAC0552359F02A |
:10180000992369F09F575F57951B33F442F4903842 |
:1018100011F4915805C0D4C091589F3F09F432C1CA |
:10182000BB27112462177307840730F4660F771FF4 |
:10183000881FBB1F915098F311D00F920FD00F92B9 |
:101840000DD0A0E82617370748071B0609F0A04867 |
:10185000BA2F602D7F918F9100240895A0E8002475 |
:10186000621773078407B10528F0621B730B840BA2 |
:10187000B1090A2A660F771F881FBB1FA69581F73B |
:10188000089597FBDFD09F3738F0FEE9F91B982FBA |
:10189000872F762F6B2F05C0F2C096958795779589 |
:1018A0006795F150D0F73EF49095809570956195CD |
:1018B0007F4F8F4F9F4F0895E89403C097FB0EF41E |
:1018C000F3DFB62F672F782F892F9EE9002460C0A1 |
:1018D0005F77552319F444230AF072C02F933F9386 |
:1018E0004F935F9388DF55274427CED05F914F9168 |
:1018F0003F912F91F9C00ED05EF004C00BD026F0BE |
:1019000001C008D019F020F48FEF089580E0089509 |
:1019100081E0089597FB092E052600F8689489D088 |
:10192000E89407FC07C0621773078407950721F046 |
:1019300008F400940794989408951F939F7750ECAF |
:1019400049E43FE02BEDE0DE10E89F775FE349ECF0 |
:101950003FE02BED621773078407950720F050ECEA |
:1019600049E4D2DE11271BD19068EEE8F0E02BD0DD |
:1019700091271F9108959B01AC019FE380E8772791 |
:1019800066270C94FB0B9A95BB0F661F771F881F69 |
:1019900011249923A1F08823B2F79F3F59F0BB0F80 |
:1019A00048F421F4002011F460FF04C06F5F7F4F02 |
:1019B0008F4F9F4F881F9795879597F908955FC020 |
:1019C0009FEF80EC0895FF92EF92DF92CF92BF924B |
:1019D0006B017C01B59016D0B590BB2069F09F9348 |
:1019E0008F937F936F93B601C7010CD02F913F91D6 |
:1019F0004F915F910E94FB0BBF90CF90DF90EF90D3 |
:101A0000FF900895D0D002C09601A701EF93FF93F5 |
:101A10000E94740DFF91EF91C6D0EF93FF930E9447 |
:101A2000840BFF91EF91BA9479F70895052E09265A |
:101A300007FA440F551F5F3F79F0AA27A51708F052 |
:101A400051E04795880F991F9F3F31F0BB27B91789 |
:101A500008F091E0879508959F919F911124B0CF50 |
:101A600097FB880F991F9F3F31F0BB27B91708F0EC |
:101A700091E0879508959F919F911124A1CF6627AA |
:101A80007727882799270895EBDFCF93DF93D52F0A |
:101A9000C42F55274427332722279923D9F09F376E |
:101AA000C8F0F92F75DF592F482F372F262FF63919 |
:101AB00068F4E7DE03DFC030CD0721F06993799346 |
:101AC000899399939058DF91CF911ECE99278827BB |
:101AD00077276627C030CD0721F0299339934993A2 |
:101AE0005993DF91CF9154CFA1DF01D051CF9923EA |
:101AF00039F0552329F09F575F57950F13F49AF14A |
:101B0000C1CF91589F3FE1F3629FA12D0F92BB2758 |
:101B1000639FA00DB11DEE27729FA00DB11DEE1F9A |
:101B2000AF93AA27649FB00DE11D739FB00DE11D17 |
:101B3000AA1F6627829FB00DE11DA61F5527749F1F |
:101B4000E00DA11D551F839FE00DA11D561F849F11 |
:101B5000A00D511D852F7A2F6E2F1F900F90882377 |
:101B60001AF4939539F42CCF000C111CBB1F661F7F |
:101B7000771F881F012808959F939F77993358F006 |
:101B800050E449EC3FE02BEDA3DE5FEB49EC3FE096 |
:101B90002BEDBADDD2DE5F915078952708959B0139 |
:101BA000AC010C94740D5591459135912591089592 |
:101BB00097FB092E05260ED057FD04D014D00AD06D |
:101BC000001C38F450954095309521953F4F4F4F6C |
:101BD0005F4F0895F6F790958095709561957F4FCA |
:101BE0008F4F9F4F0895A1E21A2EAA1BBB1BFD0128 |
:101BF0000DC0AA1FBB1FEE1FFF1FA217B307E407EC |
:101C0000F50720F0A21BB30BE40BF50B661F771F43 |
:101C1000881F991F1A9469F7609570958095909523 |
:101C20009B01AC01BD01CF01089509D0E02D07D083 |
:101C3000F02D08950CD0012C0AD011240895F999A3 |
:101C4000FECFB2BDA1BDF89A119600B40895F999DE |
:101C5000FECFB2BDA1BD00BC11960FB6F894FA9AA2 |
:061C6000F99A0FBE089581 |
:101C66004D61676E6574204E2020202020202020A4 |
:101C76004D61676E65742052202020202020202090 |
:101C86004D61676E6574205A202020202020202078 |
:101C9600526177202020204E202020202020202046 |
:101CA6005261772020202052202020202020202032 |
:101CB600526177202020205A20202020202020201A |
:101CC6004C616765204E20202020202020202020E7 |
:101CD6004C616765205220202020202020202020D3 |
:101CE600586D696E202020202020202020202020D2 |
:101CF600586D6178202020202020202020202020C0 |
:101D0600596D696E202020202020202020202020B0 |
:101D1600596D61782020202020202020202020209E |
:101D26005A6D696E2020202020202020202020208F |
:101D36005A4D61782020202020202020202020209D |
:101D460043616C737461746520202020202020205C |
:101D56004B6F6D706173732020202020202020207F |
:101D6600557365723020202020202020202020203E |
:101D7600557365723120202020202020202020202D |
:101D8600416E616C6F673138202020202020202092 |
:101D9600416E616C6F673139202020202020202081 |
:101DA600416E616C6F673230202020202020202079 |
:101DB600416E616C6F673231202020202020202068 |
:101DC600416E616C6F673232202020202020202057 |
:101DD600416E616C6F673233202020202020202046 |
:101DE600416E616C6F673234202020202020202035 |
:101DF600416E616C6F673235202020202020202024 |
:101E0600416E616C6F673236202020202020202012 |
:101E1600416E616C6F673237202020202020202001 |
:101E2600416E616C6F6732382020202020202020F0 |
:101E3600416E616C6F6732392020202020202020DF |
:101E4600416E616C6F6733302020202020202020D7 |
:101E5600416E616C6F6733312020202020202020C6 |
:021E6600010079 |
:00000001FF |
/tags/V0.14/License.txt |
---|
0,0 → 1,59 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
/tags/V0.14/analog.c |
---|
0,0 → 1,86 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
//############################################################################ |
//Init ADC |
void ADC_Init(void) |
{ |
ADMUX = 0; |
ADCSRA = 0x87; |
ADMUX = 0; |
ADCSRA |= 0x40; // Start Conversion |
} |
unsigned int MessAD(unsigned char channel) |
{ |
unsigned int messwert = 0; |
ADMUX = channel; |
ADCSRA |= 0x10; // Clear Ready-Bit |
ADCSRA |= 0x40; // Start Conversion |
while (((ADCSRA & 0x10) == 0)); |
messwert = ADCW; |
return(messwert); |
} |
/tags/V0.14/analog.h |
---|
0,0 → 1,6 |
extern void ADC_Init(void); |
extern void GetAnalogWerte(void); |
extern void AdConvert(void); |
extern void FastADConvert(void); |
extern unsigned int MessAD(unsigned char); |
/tags/V0.14/main.c |
---|
0,0 → 1,290 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
signed int OffsetN, OffsetR, OffsetZ; |
signed int RawMagnet1a,RawMagnet1b; // raw AD-Data |
signed int RawMagnet2a,RawMagnet2b; |
signed int RawMagnet3a,RawMagnet3b; |
signed int Xmin = 0, Xmax = 0; Ymin = 0, Ymax = 0; Zmin = 0, Zmax = 0; |
signed int UncalMagnetN,UncalMagnetR,UncalMagnetZ; // Messwert-Delta ohne Offset- und Verstärker korrektur |
signed int MagnetN,MagnetR,MagnetZ; |
unsigned int PwmHeading = 0; |
unsigned int PC_Connected = 0; |
unsigned int Heading; |
#include "main.h" |
uint16_t eeXmin EEMEM = 0; |
uint16_t eeXmax EEMEM = 0; |
uint16_t eeYmin EEMEM = 0; |
uint16_t eeYmax EEMEM = 0; |
uint16_t eeZmin EEMEM = 0; |
uint16_t eeZmax EEMEM = 0; |
//############################################################################ |
// |
void Wait(unsigned char dauer) |
//############################################################################ |
{ |
dauer = (unsigned char)TCNT0 + dauer; |
while((TCNT0 - dauer) & 0x80); |
} |
void CalcFields(void) |
{ |
UncalMagnetN = (1 * UncalMagnetN + (RawMagnet1a - RawMagnet1b)) / 2; |
UncalMagnetR = (1 * UncalMagnetR + (RawMagnet3a - RawMagnet3b)) / 2; |
UncalMagnetZ = (1 * UncalMagnetZ + (RawMagnet2a - RawMagnet2b)) / 2; |
OffsetN = (Xmin + Xmax) / 2; |
OffsetR = (Ymin + Ymax) / 2; |
OffsetZ = (Zmin + Zmax) / 2; |
MagnetN = (1024L * (long)(UncalMagnetN - OffsetN)) / (Xmax - Xmin); |
MagnetR = (1024L * (long)(UncalMagnetR - OffsetR)) / (Ymax - Ymin); |
MagnetZ = (1024L * (long)(UncalMagnetZ - OffsetZ)) / (Zmax - Zmin); |
} |
void CalcHeading(void) |
{ |
double nick_rad, roll_rad, Hx, Hy, Cx, Cy, Cz; |
int heading; |
nick_rad = ((double)ExternData.Winkel[0]) * M_PI / (double)(1800); |
roll_rad = ((double)ExternData.Winkel[1]) * M_PI / (double)(1800); |
Cx = MagnetN; |
Cy = MagnetR; |
Cz = MagnetZ; |
if(ExternData.Orientation == 1) |
{ |
Cx = MagnetR; |
Cy = -MagnetN; |
Cz = MagnetZ; |
} |
Hx = Cx * (double)cos(nick_rad) + |
Cy * (double)sin(nick_rad) * (double)sin(roll_rad) - |
Cz * (double)sin(nick_rad) * (double)cos(roll_rad); |
Hy = Cy * (double)cos(roll_rad) + |
Cz * (double)sin(roll_rad); |
if(Hx == 0 && Hy < 0) heading = 90; |
else if(Hx == 0 && Hy > 0) heading = 270; |
else if(Hx < 0) heading = 180 - (atan(Hy / Hx) * 180.0) / M_PI; |
else if(Hx > 0 && Hy < 0) heading = - (atan(Hy / Hx) * 180.0) / M_PI; |
else if(Hx > 0 && Hy > 0) heading = 360 - (atan(Hy / Hx) * 180.0) / M_PI; |
if(abs(heading) < 361) Heading = heading; |
PwmHeading = Heading + 10; |
} |
void Calibrate(void) |
{ |
unsigned char cal; |
if(I2C_WriteCal.CalByte) cal = I2C_WriteCal.CalByte; |
else cal = ExternData.CalState; |
switch(cal) |
{ |
case 0: |
LED_ON; |
break; |
case 1: |
Xmin = 10000; |
Xmax = -10000; |
Ymin = 10000; |
Ymax = -10000; |
Zmin = 10000; |
Zmax = -10000; |
LED_OFF; |
break; |
case 2: |
LED_ON; // find Min and Max of the X- and Y-Sensors |
if(UncalMagnetN < Xmin) Xmin = UncalMagnetN; |
if(UncalMagnetN > Xmax) Xmax = UncalMagnetN; |
if(UncalMagnetR < Ymin) Ymin = UncalMagnetR; |
if(UncalMagnetR > Ymax) Ymax = UncalMagnetR; |
break; |
case 3: |
LED_OFF; |
break; |
case 4: |
LED_ON; // find Min and Max of the Z-Sensor |
if(UncalMagnetZ < Zmin) Zmin = UncalMagnetZ; |
if(UncalMagnetZ > Zmax) Zmax = UncalMagnetZ; |
break; |
case 5: |
LED_OFF; // Save values |
if((Xmax - Xmin) > 150 && (Ymax - Ymin) > 150 && (Zmax - Zmin) > 150) |
{ |
eeprom_write_word(&eeXmin, Xmin); |
eeprom_write_word(&eeXmax, Xmax); |
eeprom_write_word(&eeYmin, Ymin); |
eeprom_write_word(&eeYmax, Ymax); |
eeprom_write_word(&eeZmin, Zmin); |
eeprom_write_word(&eeZmax, Zmax); |
Delay_ms(2000); |
} |
LED_ON; |
break; |
} |
} |
void SetDebugValues(void) |
{ |
DebugOut.Analog[0] = MagnetN; |
DebugOut.Analog[1] = MagnetR; |
DebugOut.Analog[2] = MagnetZ; |
DebugOut.Analog[3] = UncalMagnetN; |
DebugOut.Analog[4] = UncalMagnetR; |
DebugOut.Analog[5] = UncalMagnetZ; |
DebugOut.Analog[6] = ExternData.Winkel[0]; |
DebugOut.Analog[7] = ExternData.Winkel[1]; |
DebugOut.Analog[8] = Xmin; |
DebugOut.Analog[9] = Xmax; |
DebugOut.Analog[10] = Ymin; |
DebugOut.Analog[11] = Ymax; |
DebugOut.Analog[12] = Zmin; |
DebugOut.Analog[13] = Zmax; |
DebugOut.Analog[14] = ExternData.CalState; |
DebugOut.Analog[15] = Heading; |
DebugOut.Analog[16] = ExternData.UserParameter[0]; |
DebugOut.Analog[17] = ExternData.UserParameter[1]; |
} |
//############################################################################ |
//Hauptprogramm |
int main (void) |
//############################################################################ |
{ |
DDRC = 0x08; |
PORTC = 0x08; |
DDRD = 0xf4; |
PORTD = 0xA0; |
DDRB = 0x04; |
PORTB = 0x35; |
LED_ON; |
UART_Init(); |
Timer0_Init(); |
ADC_Init(); |
InitIC2_Slave(); |
sei();//Globale Interrupts Einschalten |
Debug_Timer = SetDelay(100); // Sendeintervall |
Xmin = eeprom_read_word(&eeXmin); |
Xmax = eeprom_read_word(&eeXmax); |
Ymin = eeprom_read_word(&eeYmin); |
Ymax = eeprom_read_word(&eeYmax); |
Zmin = eeprom_read_word(&eeZmin); |
Zmax = eeprom_read_word(&eeZmax); |
VersionInfo.Hauptversion = VERSION_HAUPTVERSION; |
VersionInfo.Nebenversion = VERSION_NEBENVERSION; |
VersionInfo.PCKompatibel = 7; |
ExternData.Orientation = 0; |
ExternData.CalState = 0; |
I2C_WriteCal.CalByte = 0; |
while (1) |
{ |
FLIP_LOW; |
Delay_ms(2); |
RawMagnet1a = MessAD(0); |
RawMagnet2a = -MessAD(1); |
RawMagnet3a = MessAD(7); |
Delay_ms(1); |
FLIP_HIGH; |
Delay_ms(2); |
RawMagnet1b = MessAD(0); |
RawMagnet2b = -MessAD(1); |
RawMagnet3b = MessAD(7); |
Delay_ms(1); |
CalcFields(); |
if(ExternData.CalState || I2C_WriteCal.CalByte) Calibrate(); |
else CalcHeading(); |
BearbeiteRxDaten(); |
if(PC_Connected) |
{ |
DDRD |= 0x02; // TXD-Portpin |
UCR |= (1 << TXEN); |
DatenUebertragung(); |
PC_Connected--; |
} |
else |
{ |
UCR &= ~(1 << TXEN); |
DDRD &= ~0x02; // TXD-Portpin |
} |
} // while(1) |
} |
/tags/V0.14/main.h |
---|
0,0 → 1,76 |
#ifndef _MAIN_H |
#define _MAIN_H |
#include <stdio.h> |
#include <math.h> |
#include <stdlib.h> |
#include <string.h> |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <avr/interrupt.h> |
#include <avr/eeprom.h> |
#include <avr/boot.h> |
#include <avr/wdt.h> |
#include <avr/eeprom.h> |
#include "twislave.h" |
#include "old_macros.h" |
#include "analog.h" |
#include "uart.h" |
#include "timer0.h" |
#if defined(__AVR_ATmega8__) |
# define OC1 PB1 |
# define DDROC DDRB |
# define OCR OCR1A |
# define PWM10 WGM10 |
# define PWM11 WGM11 |
#endif |
#define SYSCLK 8000000L //Quarz Frequenz in Hz |
#define INT0_ENABLE GIMSK |= 0x40 |
#define INT0_DISABLE GIMSK &= ~0x40 |
#define TIM0_START TIMSK0 |= _BV(TOIE0) |
#define TIM0_STOPP TIMSK0 &= ~_BV(TOIE0) |
#define ICP_INT_ENABLE TIMSK0 |= 0x20 |
#define ICP_INT_DISABLE TIMSK0 &= ~0x20 |
#define TIMER1_INT_ENABLE TIMSK0 |= 0x04 |
#define TIMER1_INT_DISABLE TIMSK0 &= ~0x04 |
#define TIMER2_INT_ENABLE TIMSK0 |= 0x40 |
#define TIMER2_INT_DISABLE TIMSK0 &= ~0x40 |
#define INT0_POS_FLANKE MCUCR |= 0x01 |
#define INT0_ANY_FLANKE MCUCR |= 0x01 |
#define INT0_NEG_FLANKE MCUCR &= ~0x01 |
#define CLR_INT0_FLAG GIFR &= ~0x40 |
#define INIT_INT0_FLANKE MCUCR &= ~0x03; MCUCR |= 0x02; |
#define TIMER0_PRESCALER TCCR0 |
#define ICP_POS_FLANKE TCCR1B |= (1<<ICES1) |
#define ICP_NEG_FLANKE TCCR1B &= ~(1<<ICES1) |
#define LED_ON PORTD |= 0x80 |
#define LED_OFF PORTD &= ~0x80 |
#define FLIP_HIGH PORTD |= 0x60 |
#define FLIP_LOW PORTD &= ~0x60 |
extern unsigned int PwmHeading; |
extern unsigned int PC_Connected; |
extern unsigned int Heading; |
extern signed int MagnetN,MagnetR,MagnetZ; |
extern uint16_t eeXmin EEMEM; |
extern uint16_t eeXmax EEMEM; |
extern uint16_t eeYmin EEMEM; |
extern uint16_t eeYmax EEMEM; |
extern uint16_t eeZmin EEMEM; |
extern uint16_t eeZmax EEMEM; |
#endif //_MAIN_H |
/tags/V0.14/main.lss |
---|
0,0 → 1,4534 |
main.elf: file format elf32-avr |
Sections: |
Idx Name Size VMA LMA File off Algn |
0 .text 00001bec 00000000 00000000 00000094 2**0 |
CONTENTS, ALLOC, LOAD, READONLY, CODE |
1 .data 00000024 00800060 00001bec 00001c80 2**0 |
CONTENTS, ALLOC, LOAD, DATA |
2 .bss 00000156 00800084 00800084 00001ca4 2**0 |
ALLOC |
3 .noinit 00000000 008001da 008001da 00001ca4 2**0 |
CONTENTS |
4 .eeprom 00000000 00810000 00810000 00001ca4 2**0 |
CONTENTS |
5 .stab 0000036c 00000000 00000000 00001ca4 2**2 |
CONTENTS, READONLY, DEBUGGING |
6 .stabstr 00000084 00000000 00000000 00002010 2**0 |
CONTENTS, READONLY, DEBUGGING |
7 .debug_aranges 000000b4 00000000 00000000 00002094 2**0 |
CONTENTS, READONLY, DEBUGGING |
8 .debug_pubnames 000006f5 00000000 00000000 00002148 2**0 |
CONTENTS, READONLY, DEBUGGING |
9 .debug_info 00001a41 00000000 00000000 0000283d 2**0 |
CONTENTS, READONLY, DEBUGGING |
10 .debug_abbrev 00000774 00000000 00000000 0000427e 2**0 |
CONTENTS, READONLY, DEBUGGING |
11 .debug_line 0000169d 00000000 00000000 000049f2 2**0 |
CONTENTS, READONLY, DEBUGGING |
12 .debug_str 00000874 00000000 00000000 0000608f 2**0 |
CONTENTS, READONLY, DEBUGGING |
Disassembly of section .text: |
00000000 <__vectors>: |
0: 0c 94 85 00 jmp 0x10a <__init> |
4: 0c 94 7e 0b jmp 0x16fc <__vector_1> |
8: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
c: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
10: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
14: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
18: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
1c: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
20: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
24: 0c 94 67 09 jmp 0x12ce <__vector_9> |
28: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
2c: 0c 94 96 0b jmp 0x172c <__vector_11> |
30: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
34: 0c 94 18 02 jmp 0x430 <__vector_13> |
38: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
3c: 0c 94 e3 01 jmp 0x3c6 <__vector_15> |
40: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
44: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
48: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
4c: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
50: 0c 94 a0 00 jmp 0x140 <__bad_interrupt> |
00000054 <__ctors_end>: |
54: 20 2d mov r18, r0 |
56: 2d 20 and r2, r13 |
58: 52 65 ori r21, 0x52 ; 82 |
5a: 6d 6f ori r22, 0xFD ; 253 |
5c: 74 65 ori r23, 0x54 ; 84 |
5e: 20 20 and r2, r0 |
60: 2d 2d mov r18, r13 |
62: 20 20 and r2, r0 |
64: 20 20 and r2, r0 |
66: 20 20 and r2, r0 |
... |
00000069 <__c.1>: |
69: 20 2d 2d 20 44 69 73 70 6c 61 79 20 2d 2d 20 20 -- Display -- |
79: 20 20 20 20 00 . |
0000007e <__c.2>: |
7e: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |
8e: 20 20 20 20 00 . |
00000093 <__c.3>: |
93: 20 20 77 77 77 2e 4d 69 63 72 6f 53 50 53 2e 63 www.MicroSPS.c |
a3: 6f 6d 20 20 00 om . |
000000a8 <__c.2>: |
a8: 25 73 00 %s. |
000000ab <__c.3>: |
ab: 25 73 00 %s. |
000000ae <__c.4>: |
ae: 25 73 00 %s. |
000000b1 <__c.5>: |
b1: 25 73 00 %s. |
000000b4 <__c.3>: |
b4: 56 65 72 62 69 6e 64 65 6e 20 6d 69 74 00 Verbinden mit. |
000000c2 <__c.4>: |
c2: 4d 69 63 72 6f 53 50 53 3a 25 32 69 20 00 MicroSPS:%2i . |
000000d0 <__c.5>: |
d0: 4d 61 78 20 41 64 72 65 73 73 65 00 Max Adresse. |
000000dc <__c.6>: |
dc: 25 32 69 20 00 %2i . |
000000e1 <__c.7>: |
e1: 43 68 65 63 6b 73 75 6d 00 Checksum. |
000000ea <__c.8>: |
ea: 45 72 72 6f 72 73 3a 25 35 69 20 00 Errors:%5i . |
000000f6 <__c.9>: |
f6: 44 69 73 70 6c 61 79 00 Display. |
000000fe <__c.10>: |
fe: 5a 65 69 6c 65 6e 3a 25 31 69 20 00 Zeilen:%1i . |
0000010a <__init>: |
10a: 11 24 eor r1, r1 |
10c: 1f be out 0x3f, r1 ; 63 |
10e: cf e5 ldi r28, 0x5F ; 95 |
110: d8 e0 ldi r29, 0x08 ; 8 |
112: de bf out 0x3e, r29 ; 62 |
114: cd bf out 0x3d, r28 ; 61 |
00000116 <__do_copy_data>: |
116: 10 e0 ldi r17, 0x00 ; 0 |
118: a0 e6 ldi r26, 0x60 ; 96 |
11a: b0 e0 ldi r27, 0x00 ; 0 |
11c: ec ee ldi r30, 0xEC ; 236 |
11e: fb e1 ldi r31, 0x1B ; 27 |
120: 02 c0 rjmp .+4 ; 0x126 <.do_copy_data_start> |
00000122 <.do_copy_data_loop>: |
122: 05 90 lpm r0, Z+ |
124: 0d 92 st X+, r0 |
00000126 <.do_copy_data_start>: |
126: a4 38 cpi r26, 0x84 ; 132 |
128: b1 07 cpc r27, r17 |
12a: d9 f7 brne .-10 ; 0x122 <.do_copy_data_loop> |
0000012c <__do_clear_bss>: |
12c: 11 e0 ldi r17, 0x01 ; 1 |
12e: a4 e8 ldi r26, 0x84 ; 132 |
130: b0 e0 ldi r27, 0x00 ; 0 |
132: 01 c0 rjmp .+2 ; 0x136 <.do_clear_bss_start> |
00000134 <.do_clear_bss_loop>: |
134: 1d 92 st X+, r1 |
00000136 <.do_clear_bss_start>: |
136: aa 3d cpi r26, 0xDA ; 218 |
138: b1 07 cpc r27, r17 |
13a: e1 f7 brne .-8 ; 0x134 <.do_clear_bss_loop> |
13c: 0c 94 e5 00 jmp 0x1ca <main> |
00000140 <__bad_interrupt>: |
140: 0c 94 00 00 jmp 0x0 <__vectors> |
00000144 <Sekundentakt_Init>: |
unsigned int IntervallDebug = 250, IntervallDisplay = 120; |
void Sekundentakt_Init(void) |
{ |
_SekTimer = SetDelay(1000); |
144: 88 ee ldi r24, 0xE8 ; 232 |
146: 93 e0 ldi r25, 0x03 ; 3 |
148: 0e 94 a8 09 call 0x1350 <SetDelay> |
14c: 90 93 91 00 sts 0x0091, r25 |
150: 80 93 90 00 sts 0x0090, r24 |
154: 08 95 ret |
00000156 <Sekundentakt>: |
} |
void Sekundentakt(void) |
{ |
if(CheckDelay(_SekTimer)) |
156: 80 91 90 00 lds r24, 0x0090 |
15a: 90 91 91 00 lds r25, 0x0091 |
15e: 0e 94 b1 09 call 0x1362 <CheckDelay> |
162: 88 23 and r24, r24 |
164: 31 f1 breq .+76 ; 0x1b2 <Sekundentakt+0x5c> |
{ |
GetKeyboard(); |
166: 0e 94 d2 09 call 0x13a4 <GetKeyboard> |
_SekTimer += 1000; |
16a: 80 91 90 00 lds r24, 0x0090 |
16e: 90 91 91 00 lds r25, 0x0091 |
172: 88 51 subi r24, 0x18 ; 24 |
174: 9c 4f sbci r25, 0xFC ; 252 |
176: 90 93 91 00 sts 0x0091, r25 |
17a: 80 93 90 00 sts 0x0090, r24 |
if(!CntDatensaetzeProSekunde) UebertragungUnterbrochen = 1; else UebertragungUnterbrochen = 0; |
17e: 80 91 66 00 lds r24, 0x0066 |
182: 88 23 and r24, r24 |
184: 21 f4 brne .+8 ; 0x18e <Sekundentakt+0x38> |
186: 81 e0 ldi r24, 0x01 ; 1 |
188: 80 93 84 00 sts 0x0084, r24 |
18c: 02 c0 rjmp .+4 ; 0x192 <Sekundentakt+0x3c> |
18e: 10 92 84 00 sts 0x0084, r1 |
CntDatensaetzeProSekunde = 0; |
192: 10 92 66 00 sts 0x0066, r1 |
if(++Sekunde == 60) |
196: 80 91 8d 00 lds r24, 0x008D |
19a: 8f 5f subi r24, 0xFF ; 255 |
19c: 80 93 8d 00 sts 0x008D, r24 |
1a0: 8c 33 cpi r24, 0x3C ; 60 |
1a2: 39 f4 brne .+14 ; 0x1b2 <Sekundentakt+0x5c> |
{ |
Sekunde = 0; |
1a4: 10 92 8d 00 sts 0x008D, r1 |
Minute++; |
1a8: 80 91 8c 00 lds r24, 0x008C |
1ac: 8f 5f subi r24, 0xFF ; 255 |
1ae: 80 93 8c 00 sts 0x008C, r24 |
1b2: 08 95 ret |
000001b4 <Init>: |
} |
} |
} |
void Init(void) |
{ |
VersionInfo.Hauptversion = 0; |
1b4: 10 92 c9 00 sts 0x00C9, r1 |
VersionInfo.Nebenversion = 99; |
1b8: 83 e6 ldi r24, 0x63 ; 99 |
1ba: 80 93 ca 00 sts 0x00CA, r24 |
VersionInfo.PCKompatibel = 1; |
1be: 81 e0 ldi r24, 0x01 ; 1 |
1c0: 80 93 cb 00 sts 0x00CB, r24 |
VersionInfo.Commercial = 0x00; |
1c4: 10 92 cc 00 sts 0x00CC, r1 |
1c8: 08 95 ret |
000001ca <main>: |
} |
#define MENU 0 |
#define REMOTE 1 |
//############################################################################ |
//Hauptprogramm |
void main (void) |
//############################################################################ |
{ |
1ca: ca e5 ldi r28, 0x5A ; 90 |
1cc: d8 e0 ldi r29, 0x08 ; 8 |
1ce: de bf out 0x3e, r29 ; 62 |
1d0: cd bf out 0x3d, r28 ; 61 |
char z,txt[]= {"Moin"},key,key_old = 255; |
1d2: de 01 movw r26, r28 |
1d4: 11 96 adiw r26, 0x01 ; 1 |
1d6: e7 e6 ldi r30, 0x67 ; 103 |
1d8: f0 e0 ldi r31, 0x00 ; 0 |
1da: 85 e0 ldi r24, 0x05 ; 5 |
1dc: 01 90 ld r0, Z+ |
1de: 0d 92 st X+, r0 |
1e0: 81 50 subi r24, 0x01 ; 1 |
1e2: e1 f7 brne .-8 ; 0x1dc <main+0x12> |
int test = 0; |
unsigned int DelayTast; |
unsigned int DelayDaten,DelayDisplay; |
unsigned char mode = REMOTE; |
1e4: 91 e0 ldi r25, 0x01 ; 1 |
1e6: b9 2e mov r11, r25 |
unsigned char neueDatenuebertragung = 1; |
UART_Init(); |
1e8: 0e 94 cc 04 call 0x998 <UART_Init> |
LCD_Init(); |
1ec: 0e 94 1f 06 call 0xc3e <LCD_Init> |
UART_Init(); |
1f0: 0e 94 cc 04 call 0x998 <UART_Init> |
Timer1_Init(); |
1f4: 0e 94 9e 09 call 0x133c <Timer1_Init> |
Keyboard_Init(); |
1f8: 0e 94 c9 09 call 0x1392 <Keyboard_Init> |
Sekundentakt_Init(); |
1fc: 0e 94 a2 00 call 0x144 <Sekundentakt_Init> |
InitIR(); |
200: 0e 94 67 0b call 0x16ce <InitIR> |
ADC_Init(); |
204: 0e 94 42 0c call 0x1884 <ADC_Init> |
Init(); |
208: 0e 94 da 00 call 0x1b4 <Init> |
sei ();//Globale Interrupts Einschalten |
20c: 78 94 sei |
DDRB = 0xff; |
20e: 8f ef ldi r24, 0xFF ; 255 |
210: 87 bb out 0x17, r24 ; 23 |
PORTB = 0x00; |
212: 18 ba out 0x18, r1 ; 24 |
LCD_Clear; |
214: 81 e0 ldi r24, 0x01 ; 1 |
216: 0e 94 e1 05 call 0xbc2 <_lcd_write_command> |
21a: 0e 94 c9 05 call 0xb92 <_long_delay> |
/* while(1) |
*/ |
DelayTast = SetDelay(80); |
21e: 80 e5 ldi r24, 0x50 ; 80 |
220: 90 e0 ldi r25, 0x00 ; 0 |
222: 0e 94 a8 09 call 0x1350 <SetDelay> |
226: 7c 01 movw r14, r24 |
DelayDaten = SetDelay(200); |
228: 88 ec ldi r24, 0xC8 ; 200 |
22a: 90 e0 ldi r25, 0x00 ; 0 |
22c: 0e 94 a8 09 call 0x1350 <SetDelay> |
230: 8c 01 movw r16, r24 |
DelayDisplay = SetDelay(300); |
232: 8c e2 ldi r24, 0x2C ; 44 |
234: 91 e0 ldi r25, 0x01 ; 1 |
236: 0e 94 a8 09 call 0x1350 <SetDelay> |
23a: 6c 01 movw r12, r24 |
ClearIntervalle(); |
23c: 0e 94 2e 05 call 0xa5c <ClearIntervalle> |
while (1) |
{ |
if(mode == MENU) |
240: bb 20 and r11, r11 |
242: 11 f5 brne .+68 ; 0x288 <main+0xbe> |
{ |
Delay_ms(10); |
244: 8a e0 ldi r24, 0x0A ; 10 |
246: 90 e0 ldi r25, 0x00 ; 0 |
248: 0e 94 bc 09 call 0x1378 <Delay_ms> |
key = GetKeyboard(); |
24c: 0e 94 d2 09 call 0x13a4 <GetKeyboard> |
Menu(key); |
250: 99 27 eor r25, r25 |
252: 0e 94 64 0a call 0x14c8 <Menu> |
if(_TASTE5) |
256: cb 9b sbis 0x19, 3 ; 25 |
258: f5 cf rjmp .-22 ; 0x244 <main+0x7a> |
{ |
do { Delay_ms(10);} while(_TASTE5); |
25a: 8a e0 ldi r24, 0x0A ; 10 |
25c: 90 e0 ldi r25, 0x00 ; 0 |
25e: 0e 94 bc 09 call 0x1378 <Delay_ms> |
262: cb 99 sbic 0x19, 3 ; 25 |
264: fa cf rjmp .-12 ; 0x25a <main+0x90> |
mode = REMOTE; |
266: 81 e0 ldi r24, 0x01 ; 1 |
268: b8 2e mov r11, r24 |
DelayTast = SetDelay(100); |
26a: 84 e6 ldi r24, 0x64 ; 100 |
26c: 90 e0 ldi r25, 0x00 ; 0 |
26e: 0e 94 a8 09 call 0x1350 <SetDelay> |
272: 7c 01 movw r14, r24 |
DelayDaten = SetDelay(200); |
274: 88 ec ldi r24, 0xC8 ; 200 |
276: 90 e0 ldi r25, 0x00 ; 0 |
278: 0e 94 a8 09 call 0x1350 <SetDelay> |
27c: 8c 01 movw r16, r24 |
LCD_Clear; |
27e: 8b 2d mov r24, r11 |
280: 0e 94 e1 05 call 0xbc2 <_lcd_write_command> |
284: 0e 94 c9 05 call 0xb92 <_long_delay> |
} |
} |
else |
if(mode == REMOTE) |
288: 81 e0 ldi r24, 0x01 ; 1 |
28a: b8 16 cp r11, r24 |
28c: c9 f6 brne .-78 ; 0x240 <main+0x76> |
{ |
BearbeiteRxDaten(); |
28e: 0e 94 fe 03 call 0x7fc <BearbeiteRxDaten> |
if(CheckDelay(DelayDaten)) |
292: c8 01 movw r24, r16 |
294: 0e 94 b1 09 call 0x1362 <CheckDelay> |
298: 88 23 and r24, r24 |
29a: c9 f3 breq .-14 ; 0x28e <main+0xc4> |
{ |
Sekundentakt(); |
29c: 0e 94 ab 00 call 0x156 <Sekundentakt> |
DelayDaten = SetDelay(10); |
2a0: 8a e0 ldi r24, 0x0A ; 10 |
2a2: 90 e0 ldi r25, 0x00 ; 0 |
2a4: 0e 94 a8 09 call 0x1350 <SetDelay> |
2a8: 8c 01 movw r16, r24 |
if(CheckDelay(DelayDisplay)) |
2aa: c6 01 movw r24, r12 |
2ac: 0e 94 b1 09 call 0x1362 <CheckDelay> |
2b0: 88 23 and r24, r24 |
2b2: 39 f0 breq .+14 ; 0x2c2 <main+0xf8> |
{ |
DelayDisplay = SetDelay(300); |
2b4: 8c e2 ldi r24, 0x2C ; 44 |
2b6: 91 e0 ldi r25, 0x01 ; 1 |
2b8: 0e 94 a8 09 call 0x1350 <SetDelay> |
2bc: 6c 01 movw r12, r24 |
PollDisplay = 1; |
2be: b0 92 ed 00 sts 0x00ED, r11 |
} |
key = GetKeyboard2(); |
2c2: 0e 94 57 0a call 0x14ae <GetKeyboard2> |
DatenUebertragung(key); |
2c6: 99 27 eor r25, r25 |
2c8: 0e 94 51 05 call 0xaa2 <DatenUebertragung> |
if(UebertragungUnterbrochen) |
2cc: 80 91 84 00 lds r24, 0x0084 |
2d0: 88 23 and r24, r24 |
2d2: 81 f1 breq .+96 ; 0x334 <main+0x16a> |
{ |
//01234567890123456789 |
LCD_printfxy(0,0," -- Remote -- "); |
2d4: 60 e0 ldi r22, 0x00 ; 0 |
2d6: 86 2f mov r24, r22 |
2d8: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
2dc: 84 e5 ldi r24, 0x54 ; 84 |
2de: 90 e0 ldi r25, 0x00 ; 0 |
2e0: 9f 93 push r25 |
2e2: 8f 93 push r24 |
2e4: 0e 94 e3 06 call 0xdc6 <_printf_P> |
LCD_printfxy(0,1," -- Display -- "); |
2e8: 61 e0 ldi r22, 0x01 ; 1 |
2ea: 80 e0 ldi r24, 0x00 ; 0 |
2ec: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
2f0: 0f 90 pop r0 |
2f2: 0f 90 pop r0 |
2f4: 89 e6 ldi r24, 0x69 ; 105 |
2f6: 90 e0 ldi r25, 0x00 ; 0 |
2f8: 9f 93 push r25 |
2fa: 8f 93 push r24 |
2fc: 0e 94 e3 06 call 0xdc6 <_printf_P> |
LCD_printfxy(0,2," "); |
300: 62 e0 ldi r22, 0x02 ; 2 |
302: 80 e0 ldi r24, 0x00 ; 0 |
304: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
308: 0f 90 pop r0 |
30a: 0f 90 pop r0 |
30c: 8e e7 ldi r24, 0x7E ; 126 |
30e: 90 e0 ldi r25, 0x00 ; 0 |
310: 9f 93 push r25 |
312: 8f 93 push r24 |
314: 0e 94 e3 06 call 0xdc6 <_printf_P> |
LCD_printfxy(0,3," www.MicroSPS.com "); |
318: 63 e0 ldi r22, 0x03 ; 3 |
31a: 80 e0 ldi r24, 0x00 ; 0 |
31c: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
320: 0f 90 pop r0 |
322: 0f 90 pop r0 |
324: 83 e9 ldi r24, 0x93 ; 147 |
326: 90 e0 ldi r25, 0x00 ; 0 |
328: 9f 93 push r25 |
32a: 8f 93 push r24 |
32c: 0e 94 e3 06 call 0xdc6 <_printf_P> |
330: 0f 90 pop r0 |
332: 0f 90 pop r0 |
} |
if(CheckDelay(DelayTast)) |
334: c7 01 movw r24, r14 |
336: 0e 94 b1 09 call 0x1362 <CheckDelay> |
33a: 88 23 and r24, r24 |
33c: 09 f4 brne .+2 ; 0x340 <main+0x176> |
33e: a7 cf rjmp .-178 ; 0x28e <main+0xc4> |
{ |
DelayTast = SetDelay(100); |
340: 84 e6 ldi r24, 0x64 ; 100 |
342: 90 e0 ldi r25, 0x00 ; 0 |
344: 0e 94 a8 09 call 0x1350 <SetDelay> |
348: 7c 01 movw r14, r24 |
if(_TASTE5) |
34a: cb 9b sbis 0x19, 3 ; 25 |
34c: 0c c0 rjmp .+24 ; 0x366 <main+0x19c> |
{ |
do { Delay_ms(10);} while(_TASTE5); |
34e: 8a e0 ldi r24, 0x0A ; 10 |
350: 90 e0 ldi r25, 0x00 ; 0 |
352: 0e 94 bc 09 call 0x1378 <Delay_ms> |
356: cb 99 sbic 0x19, 3 ; 25 |
358: fa cf rjmp .-12 ; 0x34e <main+0x184> |
mode = MENU; |
35a: bb 24 eor r11, r11 |
LCD_Clear; |
35c: 81 e0 ldi r24, 0x01 ; 1 |
35e: 0e 94 e1 05 call 0xbc2 <_lcd_write_command> |
362: 0e 94 c9 05 call 0xb92 <_long_delay> |
366: 80 91 be 00 lds r24, 0x00BE |
} |
// if(key & 0x10) DebugIn.Digital[0] |= 0x01; else DebugIn.Digital[0] &= ~0x01; |
if(PIND & 0x08) DebugIn.Digital[0] |= 0x02; else DebugIn.Digital[0] &= ~0x02; |
36a: 83 9b sbis 0x10, 3 ; 16 |
36c: 02 c0 rjmp .+4 ; 0x372 <main+0x1a8> |
36e: 82 60 ori r24, 0x02 ; 2 |
370: 01 c0 rjmp .+2 ; 0x374 <main+0x1aa> |
372: 8d 7f andi r24, 0xFD ; 253 |
374: 80 93 be 00 sts 0x00BE, r24 |
378: 80 91 be 00 lds r24, 0x00BE |
if(PIND & 0x10) DebugIn.Digital[0] |= 0x04; else DebugIn.Digital[0] &= ~0x04; |
37c: 84 9b sbis 0x10, 4 ; 16 |
37e: 02 c0 rjmp .+4 ; 0x384 <main+0x1ba> |
380: 84 60 ori r24, 0x04 ; 4 |
382: 01 c0 rjmp .+2 ; 0x386 <main+0x1bc> |
384: 8b 7f andi r24, 0xFB ; 251 |
386: 80 93 be 00 sts 0x00BE, r24 |
38a: 80 91 be 00 lds r24, 0x00BE |
if(PIND & 0x20) DebugIn.Digital[0] |= 0x08; else DebugIn.Digital[0] &= ~0x08; |
38e: 85 9b sbis 0x10, 5 ; 16 |
390: 02 c0 rjmp .+4 ; 0x396 <main+0x1cc> |
392: 88 60 ori r24, 0x08 ; 8 |
394: 01 c0 rjmp .+2 ; 0x398 <main+0x1ce> |
396: 87 7f andi r24, 0xF7 ; 247 |
398: 80 93 be 00 sts 0x00BE, r24 |
39c: 80 91 be 00 lds r24, 0x00BE |
if(PIND & 0x40) DebugIn.Digital[0] |= 0x10; else DebugIn.Digital[0] &= ~0x10; |
3a0: 86 9b sbis 0x10, 6 ; 16 |
3a2: 02 c0 rjmp .+4 ; 0x3a8 <main+0x1de> |
3a4: 80 61 ori r24, 0x10 ; 16 |
3a6: 01 c0 rjmp .+2 ; 0x3aa <main+0x1e0> |
3a8: 8f 7e andi r24, 0xEF ; 239 |
3aa: 80 93 be 00 sts 0x00BE, r24 |
3ae: 80 91 be 00 lds r24, 0x00BE |
if(PIND & 0x80) DebugIn.Digital[0] |= 0x20; else DebugIn.Digital[0] &= ~0x20; |
3b2: 87 9b sbis 0x10, 7 ; 16 |
3b4: 02 c0 rjmp .+4 ; 0x3ba <main+0x1f0> |
3b6: 80 62 ori r24, 0x20 ; 32 |
3b8: 01 c0 rjmp .+2 ; 0x3bc <main+0x1f2> |
3ba: 8f 7d andi r24, 0xDF ; 223 |
3bc: 80 93 be 00 sts 0x00BE, r24 |
GetAnalogWerte(); |
3c0: 0e 94 4e 0c call 0x189c <GetAnalogWerte> |
3c4: 3d cf rjmp .-390 ; 0x240 <main+0x76> |
000003c6 <__vector_15>: |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//++ Sende-Part der Datenübertragung |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
SIGNAL(INT_VEC_TX) |
{ |
3c6: 1f 92 push r1 |
3c8: 0f 92 push r0 |
3ca: 0f b6 in r0, 0x3f ; 63 |
3cc: 0f 92 push r0 |
3ce: 11 24 eor r1, r1 |
3d0: 8f 93 push r24 |
3d2: 9f 93 push r25 |
3d4: ef 93 push r30 |
3d6: ff 93 push r31 |
static unsigned int ptr = 0; |
unsigned char tmp_tx; |
if(!UebertragungAbgeschlossen) |
3d8: 80 91 6e 00 lds r24, 0x006E |
3dc: 88 23 and r24, r24 |
3de: d9 f4 brne .+54 ; 0x416 <__vector_15+0x50> |
{ |
ptr++; // die [0] wurde schon gesendet |
3e0: 80 91 9d 00 lds r24, 0x009D |
3e4: 90 91 9e 00 lds r25, 0x009E |
3e8: 01 96 adiw r24, 0x01 ; 1 |
3ea: 90 93 9e 00 sts 0x009E, r25 |
3ee: 80 93 9d 00 sts 0x009D, r24 |
tmp_tx = SendeBuffer[ptr]; |
3f2: fc 01 movw r30, r24 |
3f4: e2 51 subi r30, 0x12 ; 18 |
3f6: ff 4f sbci r31, 0xFF ; 255 |
3f8: e0 81 ld r30, Z |
if((tmp_tx == '\r') || (ptr == MAX_SENDE_BUFF)) |
3fa: ed 30 cpi r30, 0x0D ; 13 |
3fc: 19 f0 breq .+6 ; 0x404 <__vector_15+0x3e> |
3fe: 84 36 cpi r24, 0x64 ; 100 |
400: 91 05 cpc r25, r1 |
402: 39 f4 brne .+14 ; 0x412 <__vector_15+0x4c> |
{ |
ptr = 0; |
404: 10 92 9e 00 sts 0x009E, r1 |
408: 10 92 9d 00 sts 0x009D, r1 |
UebertragungAbgeschlossen = 1; |
40c: 81 e0 ldi r24, 0x01 ; 1 |
40e: 80 93 6e 00 sts 0x006E, r24 |
} |
UDR = tmp_tx; |
412: ec b9 out 0x0c, r30 ; 12 |
414: 04 c0 rjmp .+8 ; 0x41e <__vector_15+0x58> |
} |
else ptr = 0; |
416: 10 92 9e 00 sts 0x009E, r1 |
41a: 10 92 9d 00 sts 0x009D, r1 |
41e: ff 91 pop r31 |
420: ef 91 pop r30 |
422: 9f 91 pop r25 |
424: 8f 91 pop r24 |
426: 0f 90 pop r0 |
428: 0f be out 0x3f, r0 ; 63 |
42a: 0f 90 pop r0 |
42c: 1f 90 pop r1 |
42e: 18 95 reti |
00000430 <__vector_13>: |
} |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//++ Empfangs-Part der Datenübertragung, incl. CRC-Auswertung |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
SIGNAL(INT_VEC_RX) |
{ |
430: 1f 92 push r1 |
432: 0f 92 push r0 |
434: 0f b6 in r0, 0x3f ; 63 |
436: 0f 92 push r0 |
438: 11 24 eor r1, r1 |
43a: 2f 93 push r18 |
43c: 3f 93 push r19 |
43e: 4f 93 push r20 |
440: 5f 93 push r21 |
442: 8f 93 push r24 |
444: 9f 93 push r25 |
446: af 93 push r26 |
448: bf 93 push r27 |
44a: ef 93 push r30 |
44c: ff 93 push r31 |
static unsigned int crc; |
static unsigned char crc1,crc2,buf_ptr; |
static unsigned char UartState = 0; |
unsigned char CrcOkay = 0; |
44e: 20 e0 ldi r18, 0x00 ; 0 |
SioTmp = UDR; |
450: 8c b1 in r24, 0x0c ; 12 |
452: 80 93 9c 00 sts 0x009C, r24 |
if(buf_ptr >= MAX_EMPFANGS_BUFF) UartState = 0; |
456: 50 91 a3 00 lds r21, 0x00A3 |
45a: 54 36 cpi r21, 0x64 ; 100 |
45c: 10 f0 brcs .+4 ; 0x462 <__vector_13+0x32> |
45e: 20 93 a4 00 sts 0x00A4, r18 |
if(SioTmp == '\r' && UartState == 2) |
462: 80 91 9c 00 lds r24, 0x009C |
466: 8d 30 cpi r24, 0x0D ; 13 |
468: 09 f0 breq .+2 ; 0x46c <__vector_13+0x3c> |
46a: 5b c0 rjmp .+182 ; 0x522 <__vector_13+0xf2> |
46c: 80 91 a4 00 lds r24, 0x00A4 |
470: 82 30 cpi r24, 0x02 ; 2 |
472: 09 f0 breq .+2 ; 0x476 <__vector_13+0x46> |
474: 56 c0 rjmp .+172 ; 0x522 <__vector_13+0xf2> |
{ |
UartState = 0; |
476: 20 93 a4 00 sts 0x00A4, r18 |
crc -= RxdBuffer[buf_ptr-2]; |
47a: 85 2f mov r24, r21 |
47c: 99 27 eor r25, r25 |
47e: 8e 5a subi r24, 0xAE ; 174 |
480: 9e 4f sbci r25, 0xFE ; 254 |
482: fc 01 movw r30, r24 |
484: 32 97 sbiw r30, 0x02 ; 2 |
486: 40 81 ld r20, Z |
488: 20 91 9f 00 lds r18, 0x009F |
48c: 30 91 a0 00 lds r19, 0x00A0 |
490: 24 1b sub r18, r20 |
492: 31 09 sbc r19, r1 |
crc -= RxdBuffer[buf_ptr-1]; |
494: dc 01 movw r26, r24 |
496: 11 97 sbiw r26, 0x01 ; 1 |
498: 8c 91 ld r24, X |
49a: 28 1b sub r18, r24 |
49c: 31 09 sbc r19, r1 |
crc %= 4096; |
49e: c9 01 movw r24, r18 |
4a0: 9f 70 andi r25, 0x0F ; 15 |
4a2: 90 93 a0 00 sts 0x00A0, r25 |
4a6: 80 93 9f 00 sts 0x009F, r24 |
crc1 = '=' + crc / 64; |
4aa: 46 e0 ldi r20, 0x06 ; 6 |
4ac: 96 95 lsr r25 |
4ae: 87 95 ror r24 |
4b0: 4a 95 dec r20 |
4b2: e1 f7 brne .-8 ; 0x4ac <__vector_13+0x7c> |
4b4: 98 2f mov r25, r24 |
4b6: 93 5c subi r25, 0xC3 ; 195 |
4b8: 90 93 a1 00 sts 0x00A1, r25 |
crc2 = '=' + crc % 64; |
4bc: 2f 73 andi r18, 0x3F ; 63 |
4be: 30 70 andi r19, 0x00 ; 0 |
4c0: 23 5c subi r18, 0xC3 ; 195 |
4c2: 20 93 a2 00 sts 0x00A2, r18 |
CrcOkay = 0; |
if((crc1 == RxdBuffer[buf_ptr-2]) && (crc2 == RxdBuffer[buf_ptr-1])) CrcOkay = 1; else { CrcOkay = 0; CntCrcError++;}; |
4c6: 80 81 ld r24, Z |
4c8: 98 17 cp r25, r24 |
4ca: 29 f4 brne .+10 ; 0x4d6 <__vector_13+0xa6> |
4cc: 8c 91 ld r24, X |
4ce: 28 17 cp r18, r24 |
4d0: 11 f4 brne .+4 ; 0x4d6 <__vector_13+0xa6> |
4d2: 21 e0 ldi r18, 0x01 ; 1 |
4d4: 0a c0 rjmp .+20 ; 0x4ea <__vector_13+0xba> |
4d6: 20 e0 ldi r18, 0x00 ; 0 |
4d8: 80 91 99 00 lds r24, 0x0099 |
4dc: 90 91 9a 00 lds r25, 0x009A |
4e0: 01 96 adiw r24, 0x01 ; 1 |
4e2: 90 93 9a 00 sts 0x009A, r25 |
4e6: 80 93 99 00 sts 0x0099, r24 |
if(!NeuerDatensatzEmpfangen && CrcOkay) // Datensatz schon verarbeitet |
4ea: 80 91 9b 00 lds r24, 0x009B |
4ee: 88 23 and r24, r24 |
4f0: 09 f0 breq .+2 ; 0x4f4 <__vector_13+0xc4> |
4f2: 66 c0 rjmp .+204 ; 0x5c0 <__vector_13+0x190> |
4f4: 22 23 and r18, r18 |
4f6: 09 f4 brne .+2 ; 0x4fa <__vector_13+0xca> |
4f8: 63 c0 rjmp .+198 ; 0x5c0 <__vector_13+0x190> |
{ |
CntDatensaetzeProSekunde++; |
4fa: 80 91 66 00 lds r24, 0x0066 |
4fe: 8f 5f subi r24, 0xFF ; 255 |
500: 80 93 66 00 sts 0x0066, r24 |
PC_DebugTimeout = 10; |
504: 8a e0 ldi r24, 0x0A ; 10 |
506: 80 93 97 00 sts 0x0097, r24 |
NeuerDatensatzEmpfangen = 1; |
50a: 81 e0 ldi r24, 0x01 ; 1 |
50c: 80 93 9b 00 sts 0x009B, r24 |
AnzahlEmpfangsBytes = buf_ptr; |
510: 50 93 98 00 sts 0x0098, r21 |
RxdBuffer[buf_ptr] = '\r'; |
514: e5 2f mov r30, r21 |
516: ff 27 eor r31, r31 |
518: ee 5a subi r30, 0xAE ; 174 |
51a: fe 4f sbci r31, 0xFE ; 254 |
51c: 8d e0 ldi r24, 0x0D ; 13 |
51e: 80 83 st Z, r24 |
520: 4f c0 rjmp .+158 ; 0x5c0 <__vector_13+0x190> |
// if((RxdBuffer[1] == 's') && (RxdBuffer[2] == 'R')) wdt_enable(WDTO_250MS); // Reset-Commando |
} |
} |
else |
switch(UartState) |
522: 20 91 a4 00 lds r18, 0x00A4 |
526: 82 2f mov r24, r18 |
528: 99 27 eor r25, r25 |
52a: 81 30 cpi r24, 0x01 ; 1 |
52c: 91 05 cpc r25, r1 |
52e: f9 f0 breq .+62 ; 0x56e <__vector_13+0x13e> |
530: 82 30 cpi r24, 0x02 ; 2 |
532: 91 05 cpc r25, r1 |
534: 1c f4 brge .+6 ; 0x53c <__vector_13+0x10c> |
536: 89 2b or r24, r25 |
538: 21 f0 breq .+8 ; 0x542 <__vector_13+0x112> |
53a: 40 c0 rjmp .+128 ; 0x5bc <__vector_13+0x18c> |
53c: 02 97 sbiw r24, 0x02 ; 2 |
53e: 11 f1 breq .+68 ; 0x584 <__vector_13+0x154> |
540: 3d c0 rjmp .+122 ; 0x5bc <__vector_13+0x18c> |
{ |
case 0: |
if(SioTmp == '#' && !NeuerDatensatzEmpfangen) UartState = 1; // Startzeichen und Daten schon verarbeitet |
542: 80 91 9c 00 lds r24, 0x009C |
546: 83 32 cpi r24, 0x23 ; 35 |
548: 39 f4 brne .+14 ; 0x558 <__vector_13+0x128> |
54a: 80 91 9b 00 lds r24, 0x009B |
54e: 88 23 and r24, r24 |
550: 19 f4 brne .+6 ; 0x558 <__vector_13+0x128> |
552: 81 e0 ldi r24, 0x01 ; 1 |
554: 80 93 a4 00 sts 0x00A4, r24 |
buf_ptr = 0; |
RxdBuffer[buf_ptr++] = SioTmp; |
558: 80 91 9c 00 lds r24, 0x009C |
55c: 80 93 52 01 sts 0x0152, r24 |
560: 81 e0 ldi r24, 0x01 ; 1 |
562: 80 93 a3 00 sts 0x00A3, r24 |
crc = SioTmp; |
566: 80 91 9c 00 lds r24, 0x009C |
56a: 99 27 eor r25, r25 |
56c: 22 c0 rjmp .+68 ; 0x5b2 <__vector_13+0x182> |
break; |
case 1: // Adresse auswerten |
UartState++; |
56e: 2f 5f subi r18, 0xFF ; 255 |
570: 20 93 a4 00 sts 0x00A4, r18 |
RxdBuffer[buf_ptr++] = SioTmp; |
574: e5 2f mov r30, r21 |
576: ff 27 eor r31, r31 |
578: ee 5a subi r30, 0xAE ; 174 |
57a: fe 4f sbci r31, 0xFE ; 254 |
57c: 80 91 9c 00 lds r24, 0x009C |
580: 80 83 st Z, r24 |
582: 09 c0 rjmp .+18 ; 0x596 <__vector_13+0x166> |
crc += SioTmp; |
break; |
case 2: // Eingangsdaten sammeln |
RxdBuffer[buf_ptr] = SioTmp; |
584: e5 2f mov r30, r21 |
586: ff 27 eor r31, r31 |
588: ee 5a subi r30, 0xAE ; 174 |
58a: fe 4f sbci r31, 0xFE ; 254 |
58c: 80 91 9c 00 lds r24, 0x009C |
590: 80 83 st Z, r24 |
if(buf_ptr < MAX_EMPFANGS_BUFF) buf_ptr++; |
592: 54 36 cpi r21, 0x64 ; 100 |
594: 20 f4 brcc .+8 ; 0x59e <__vector_13+0x16e> |
596: 5f 5f subi r21, 0xFF ; 255 |
598: 50 93 a3 00 sts 0x00A3, r21 |
59c: 02 c0 rjmp .+4 ; 0x5a2 <__vector_13+0x172> |
else UartState = 0; |
59e: 10 92 a4 00 sts 0x00A4, r1 |
crc += SioTmp; |
5a2: 20 91 9c 00 lds r18, 0x009C |
5a6: 80 91 9f 00 lds r24, 0x009F |
5aa: 90 91 a0 00 lds r25, 0x00A0 |
5ae: 82 0f add r24, r18 |
5b0: 91 1d adc r25, r1 |
5b2: 90 93 a0 00 sts 0x00A0, r25 |
5b6: 80 93 9f 00 sts 0x009F, r24 |
break; |
5ba: 02 c0 rjmp .+4 ; 0x5c0 <__vector_13+0x190> |
default: |
UartState = 0; |
5bc: 10 92 a4 00 sts 0x00A4, r1 |
5c0: ff 91 pop r31 |
5c2: ef 91 pop r30 |
5c4: bf 91 pop r27 |
5c6: af 91 pop r26 |
5c8: 9f 91 pop r25 |
5ca: 8f 91 pop r24 |
5cc: 5f 91 pop r21 |
5ce: 4f 91 pop r20 |
5d0: 3f 91 pop r19 |
5d2: 2f 91 pop r18 |
5d4: 0f 90 pop r0 |
5d6: 0f be out 0x3f, r0 ; 63 |
5d8: 0f 90 pop r0 |
5da: 1f 90 pop r1 |
5dc: 18 95 reti |
000005de <AddCRC>: |
break; |
} |
}; |
// -------------------------------------------------------------------------- |
void AddCRC(unsigned int wieviele) |
{ |
5de: ac 01 movw r20, r24 |
unsigned int tmpCRC = 0,i; |
5e0: a0 e0 ldi r26, 0x00 ; 0 |
5e2: b0 e0 ldi r27, 0x00 ; 0 |
for(i = 0; i < wieviele;i++) |
5e4: 9d 01 movw r18, r26 |
5e6: a8 17 cp r26, r24 |
5e8: b9 07 cpc r27, r25 |
5ea: 48 f4 brcc .+18 ; 0x5fe <AddCRC+0x20> |
5ec: ee ee ldi r30, 0xEE ; 238 |
5ee: f0 e0 ldi r31, 0x00 ; 0 |
{ |
tmpCRC += SendeBuffer[i]; |
5f0: 81 91 ld r24, Z+ |
5f2: 28 0f add r18, r24 |
5f4: 31 1d adc r19, r1 |
5f6: 11 96 adiw r26, 0x01 ; 1 |
5f8: a4 17 cp r26, r20 |
5fa: b5 07 cpc r27, r21 |
5fc: c8 f3 brcs .-14 ; 0x5f0 <AddCRC+0x12> |
} |
tmpCRC %= 4096; |
5fe: 3f 70 andi r19, 0x0F ; 15 |
SendeBuffer[i++] = '=' + tmpCRC / 64; |
600: fd 01 movw r30, r26 |
602: e2 51 subi r30, 0x12 ; 18 |
604: ff 4f sbci r31, 0xFF ; 255 |
606: c9 01 movw r24, r18 |
608: 56 e0 ldi r21, 0x06 ; 6 |
60a: 96 95 lsr r25 |
60c: 87 95 ror r24 |
60e: 5a 95 dec r21 |
610: e1 f7 brne .-8 ; 0x60a <AddCRC+0x2c> |
612: 83 5c subi r24, 0xC3 ; 195 |
614: 80 83 st Z, r24 |
616: 11 96 adiw r26, 0x01 ; 1 |
SendeBuffer[i++] = '=' + tmpCRC % 64; |
618: fd 01 movw r30, r26 |
61a: e2 51 subi r30, 0x12 ; 18 |
61c: ff 4f sbci r31, 0xFF ; 255 |
61e: 2f 73 andi r18, 0x3F ; 63 |
620: 30 70 andi r19, 0x00 ; 0 |
622: 82 2f mov r24, r18 |
624: 83 5c subi r24, 0xC3 ; 195 |
626: 80 83 st Z, r24 |
SendeBuffer[i++] = '\r'; |
628: a1 51 subi r26, 0x11 ; 17 |
62a: bf 4f sbci r27, 0xFF ; 255 |
62c: 8d e0 ldi r24, 0x0D ; 13 |
62e: 8c 93 st X, r24 |
UebertragungAbgeschlossen = 0; |
630: 10 92 6e 00 sts 0x006E, r1 |
UDR = SendeBuffer[0]; |
634: 80 91 ee 00 lds r24, 0x00EE |
638: 8c b9 out 0x0c, r24 ; 12 |
63a: 08 95 ret |
0000063c <SendOutData>: |
// PrintSendeBuffer(); |
} |
// -------------------------------------------------------------------------- |
void SendOutData(unsigned char cmd,unsigned char modul, unsigned char *snd, unsigned char len) |
{ |
63c: 1f 93 push r17 |
63e: cf 93 push r28 |
640: df 93 push r29 |
642: 38 2f mov r19, r24 |
644: 96 2f mov r25, r22 |
646: ea 01 movw r28, r20 |
648: 72 2f mov r23, r18 |
unsigned int pt = 0,i; |
unsigned char a,b,c,d; |
unsigned char ptr = 0; |
64a: 10 e0 ldi r17, 0x00 ; 0 |
unsigned char x,y,z; |
//while(!UebertragungAbgeschlossen); |
SendeBuffer[pt++] = '#'; // Startzeichen |
64c: 83 e2 ldi r24, 0x23 ; 35 |
64e: 80 93 ee 00 sts 0x00EE, r24 |
SendeBuffer[pt++] = modul+'a'; // Adresse (a=0; b=1,...) |
652: 9f 59 subi r25, 0x9F ; 159 |
654: 90 93 ef 00 sts 0x00EF, r25 |
SendeBuffer[pt++] = cmd; // Commando |
658: 30 93 f0 00 sts 0x00F0, r19 |
65c: a3 e0 ldi r26, 0x03 ; 3 |
65e: b0 e0 ldi r27, 0x00 ; 0 |
while(len) |
{ |
if(len) { a = snd[ptr++]; len--;} else a = 0; |
if(len) { b = snd[ptr++]; len--;} else b = 0; |
if(len) { c = snd[ptr++]; len--;} else c = 0; |
SendeBuffer[pt++] = '=' + (a >> 2); |
SendeBuffer[pt++] = '=' + (((a & 0x03) << 4) | ((b & 0xf0) >> 4)); |
SendeBuffer[pt++] = '=' + (((b & 0x0f) << 2) | ((c & 0xc0) >> 6)); |
SendeBuffer[pt++] = '=' + ( c & 0x3f); |
660: 77 23 and r23, r23 |
662: 09 f4 brne .+2 ; 0x666 <SendOutData+0x2a> |
664: 58 c0 rjmp .+176 ; 0x716 <SendOutData+0xda> |
666: 77 23 and r23, r23 |
668: 11 f4 brne .+4 ; 0x66e <SendOutData+0x32> |
66a: 97 2f mov r25, r23 |
66c: 07 c0 rjmp .+14 ; 0x67c <SendOutData+0x40> |
66e: fe 01 movw r30, r28 |
670: e1 0f add r30, r17 |
672: f1 1d adc r31, r1 |
674: 1f 5f subi r17, 0xFF ; 255 |
676: 90 81 ld r25, Z |
678: 71 50 subi r23, 0x01 ; 1 |
67a: 11 f4 brne .+4 ; 0x680 <SendOutData+0x44> |
67c: 47 2f mov r20, r23 |
67e: 0e c0 rjmp .+28 ; 0x69c <SendOutData+0x60> |
680: fe 01 movw r30, r28 |
682: e1 0f add r30, r17 |
684: f1 1d adc r31, r1 |
686: 1f 5f subi r17, 0xFF ; 255 |
688: 40 81 ld r20, Z |
68a: 71 50 subi r23, 0x01 ; 1 |
68c: 39 f0 breq .+14 ; 0x69c <SendOutData+0x60> |
68e: fe 01 movw r30, r28 |
690: e1 0f add r30, r17 |
692: f1 1d adc r31, r1 |
694: 1f 5f subi r17, 0xFF ; 255 |
696: 60 81 ld r22, Z |
698: 71 50 subi r23, 0x01 ; 1 |
69a: 01 c0 rjmp .+2 ; 0x69e <SendOutData+0x62> |
69c: 67 2f mov r22, r23 |
69e: fd 01 movw r30, r26 |
6a0: e2 51 subi r30, 0x12 ; 18 |
6a2: ff 4f sbci r31, 0xFF ; 255 |
6a4: 89 2f mov r24, r25 |
6a6: 86 95 lsr r24 |
6a8: 86 95 lsr r24 |
6aa: 83 5c subi r24, 0xC3 ; 195 |
6ac: 80 83 st Z, r24 |
6ae: 11 96 adiw r26, 0x01 ; 1 |
6b0: fd 01 movw r30, r26 |
6b2: e2 51 subi r30, 0x12 ; 18 |
6b4: ff 4f sbci r31, 0xFF ; 255 |
6b6: 89 2f mov r24, r25 |
6b8: 99 27 eor r25, r25 |
6ba: 83 70 andi r24, 0x03 ; 3 |
6bc: 90 70 andi r25, 0x00 ; 0 |
6be: 24 e0 ldi r18, 0x04 ; 4 |
6c0: 88 0f add r24, r24 |
6c2: 99 1f adc r25, r25 |
6c4: 2a 95 dec r18 |
6c6: e1 f7 brne .-8 ; 0x6c0 <SendOutData+0x84> |
6c8: 55 27 eor r21, r21 |
6ca: 9a 01 movw r18, r20 |
6cc: 94 e0 ldi r25, 0x04 ; 4 |
6ce: 36 95 lsr r19 |
6d0: 27 95 ror r18 |
6d2: 9a 95 dec r25 |
6d4: e1 f7 brne .-8 ; 0x6ce <SendOutData+0x92> |
6d6: 82 2b or r24, r18 |
6d8: 83 5c subi r24, 0xC3 ; 195 |
6da: 80 83 st Z, r24 |
6dc: 11 96 adiw r26, 0x01 ; 1 |
6de: fd 01 movw r30, r26 |
6e0: e2 51 subi r30, 0x12 ; 18 |
6e2: ff 4f sbci r31, 0xFF ; 255 |
6e4: 4f 70 andi r20, 0x0F ; 15 |
6e6: 50 70 andi r21, 0x00 ; 0 |
6e8: 44 0f add r20, r20 |
6ea: 55 1f adc r21, r21 |
6ec: 44 0f add r20, r20 |
6ee: 55 1f adc r21, r21 |
6f0: 86 2f mov r24, r22 |
6f2: 99 27 eor r25, r25 |
6f4: 26 e0 ldi r18, 0x06 ; 6 |
6f6: 96 95 lsr r25 |
6f8: 87 95 ror r24 |
6fa: 2a 95 dec r18 |
6fc: e1 f7 brne .-8 ; 0x6f6 <SendOutData+0xba> |
6fe: 84 2b or r24, r20 |
700: 83 5c subi r24, 0xC3 ; 195 |
702: 80 83 st Z, r24 |
704: 11 96 adiw r26, 0x01 ; 1 |
706: fd 01 movw r30, r26 |
708: e2 51 subi r30, 0x12 ; 18 |
70a: ff 4f sbci r31, 0xFF ; 255 |
70c: 6f 73 andi r22, 0x3F ; 63 |
70e: 63 5c subi r22, 0xC3 ; 195 |
710: 60 83 st Z, r22 |
712: 11 96 adiw r26, 0x01 ; 1 |
714: a5 cf rjmp .-182 ; 0x660 <SendOutData+0x24> |
} |
AddCRC(pt); |
716: cd 01 movw r24, r26 |
718: 0e 94 ef 02 call 0x5de <AddCRC> |
71c: df 91 pop r29 |
71e: cf 91 pop r28 |
720: 1f 91 pop r17 |
722: 08 95 ret |
00000724 <Decode64>: |
} |
// -------------------------------------------------------------------------- |
void Decode64(unsigned char *ptrOut, unsigned char len, unsigned char ptrIn,unsigned char max) // Wohin mit den Daten; Wie lang; Wo im RxdBuffer |
{ |
724: 1f 93 push r17 |
726: cf 93 push r28 |
728: df 93 push r29 |
72a: ec 01 movw r28, r24 |
unsigned char a,b,c,d; |
unsigned char ptr = 0; |
72c: 10 e0 ldi r17, 0x00 ; 0 |
unsigned char x,y,z; |
while(len) |
{ |
a = RxdBuffer[ptrIn++] - '='; |
b = RxdBuffer[ptrIn++] - '='; |
c = RxdBuffer[ptrIn++] - '='; |
d = RxdBuffer[ptrIn++] - '='; |
if(ptrIn > max - 2) break; // nicht mehr Daten verarbeiten, als empfangen wurden |
x = (a << 2) | (b >> 4); |
y = ((b & 0x0f) << 4) | (c >> 2); |
z = ((c & 0x03) << 6) | d; |
if(len--) ptrOut[ptr++] = x; else break; |
if(len--) ptrOut[ptr++] = y; else break; |
if(len--) ptrOut[ptr++] = z; else break; |
72e: 66 23 and r22, r22 |
730: 09 f4 brne .+2 ; 0x734 <Decode64+0x10> |
732: 60 c0 rjmp .+192 ; 0x7f4 <Decode64+0xd0> |
734: a2 2f mov r26, r18 |
736: bb 27 eor r27, r27 |
738: 12 97 sbiw r26, 0x02 ; 2 |
73a: e4 2f mov r30, r20 |
73c: ff 27 eor r31, r31 |
73e: ee 5a subi r30, 0xAE ; 174 |
740: fe 4f sbci r31, 0xFE ; 254 |
742: 30 81 ld r19, Z |
744: 3d 53 subi r19, 0x3D ; 61 |
746: 4f 5f subi r20, 0xFF ; 255 |
748: e4 2f mov r30, r20 |
74a: ff 27 eor r31, r31 |
74c: ee 5a subi r30, 0xAE ; 174 |
74e: fe 4f sbci r31, 0xFE ; 254 |
750: 50 81 ld r21, Z |
752: 5d 53 subi r21, 0x3D ; 61 |
754: 4f 5f subi r20, 0xFF ; 255 |
756: e4 2f mov r30, r20 |
758: ff 27 eor r31, r31 |
75a: ee 5a subi r30, 0xAE ; 174 |
75c: fe 4f sbci r31, 0xFE ; 254 |
75e: 70 81 ld r23, Z |
760: 7d 53 subi r23, 0x3D ; 61 |
762: 4f 5f subi r20, 0xFF ; 255 |
764: e4 2f mov r30, r20 |
766: ff 27 eor r31, r31 |
768: ee 5a subi r30, 0xAE ; 174 |
76a: fe 4f sbci r31, 0xFE ; 254 |
76c: e0 81 ld r30, Z |
76e: ed 53 subi r30, 0x3D ; 61 |
770: 4f 5f subi r20, 0xFF ; 255 |
772: 84 2f mov r24, r20 |
774: 99 27 eor r25, r25 |
776: a8 17 cp r26, r24 |
778: b9 07 cpc r27, r25 |
77a: e4 f1 brlt .+120 ; 0x7f4 <Decode64+0xd0> |
77c: 83 2f mov r24, r19 |
77e: 99 27 eor r25, r25 |
780: 88 0f add r24, r24 |
782: 99 1f adc r25, r25 |
784: 88 0f add r24, r24 |
786: 99 1f adc r25, r25 |
788: 35 2f mov r19, r21 |
78a: 32 95 swap r19 |
78c: 3f 70 andi r19, 0x0F ; 15 |
78e: 38 2b or r19, r24 |
790: 85 2f mov r24, r21 |
792: 99 27 eor r25, r25 |
794: 8f 70 andi r24, 0x0F ; 15 |
796: 90 70 andi r25, 0x00 ; 0 |
798: f4 e0 ldi r31, 0x04 ; 4 |
79a: 88 0f add r24, r24 |
79c: 99 1f adc r25, r25 |
79e: fa 95 dec r31 |
7a0: e1 f7 brne .-8 ; 0x79a <Decode64+0x76> |
7a2: 57 2f mov r21, r23 |
7a4: 56 95 lsr r21 |
7a6: 56 95 lsr r21 |
7a8: 58 2b or r21, r24 |
7aa: 87 2f mov r24, r23 |
7ac: 99 27 eor r25, r25 |
7ae: 83 70 andi r24, 0x03 ; 3 |
7b0: 90 70 andi r25, 0x00 ; 0 |
7b2: 76 e0 ldi r23, 0x06 ; 6 |
7b4: 88 0f add r24, r24 |
7b6: 99 1f adc r25, r25 |
7b8: 7a 95 dec r23 |
7ba: e1 f7 brne .-8 ; 0x7b4 <Decode64+0x90> |
7bc: 8e 2b or r24, r30 |
7be: 61 50 subi r22, 0x01 ; 1 |
7c0: 6f 3f cpi r22, 0xFF ; 255 |
7c2: c1 f0 breq .+48 ; 0x7f4 <Decode64+0xd0> |
7c4: fe 01 movw r30, r28 |
7c6: e1 0f add r30, r17 |
7c8: f1 1d adc r31, r1 |
7ca: 30 83 st Z, r19 |
7cc: 1f 5f subi r17, 0xFF ; 255 |
7ce: 61 50 subi r22, 0x01 ; 1 |
7d0: 6f 3f cpi r22, 0xFF ; 255 |
7d2: 81 f0 breq .+32 ; 0x7f4 <Decode64+0xd0> |
7d4: fe 01 movw r30, r28 |
7d6: e1 0f add r30, r17 |
7d8: f1 1d adc r31, r1 |
7da: 50 83 st Z, r21 |
7dc: 1f 5f subi r17, 0xFF ; 255 |
7de: 61 50 subi r22, 0x01 ; 1 |
7e0: 6f 3f cpi r22, 0xFF ; 255 |
7e2: 41 f0 breq .+16 ; 0x7f4 <Decode64+0xd0> |
7e4: fe 01 movw r30, r28 |
7e6: e1 0f add r30, r17 |
7e8: f1 1d adc r31, r1 |
7ea: 80 83 st Z, r24 |
7ec: 1f 5f subi r17, 0xFF ; 255 |
7ee: 66 23 and r22, r22 |
7f0: 09 f0 breq .+2 ; 0x7f4 <Decode64+0xd0> |
7f2: a3 cf rjmp .-186 ; 0x73a <Decode64+0x16> |
7f4: df 91 pop r29 |
7f6: cf 91 pop r28 |
7f8: 1f 91 pop r17 |
7fa: 08 95 ret |
000007fc <BearbeiteRxDaten>: |
} |
} |
// -------------------------------------------------------------------------- |
void BearbeiteRxDaten(void) |
{ |
7fc: cf 93 push r28 |
7fe: df 93 push r29 |
800: cd b7 in r28, 0x3d ; 61 |
802: de b7 in r29, 0x3e ; 62 |
804: ad 97 sbiw r28, 0x2d ; 45 |
806: 0f b6 in r0, 0x3f ; 63 |
808: f8 94 cli |
80a: de bf out 0x3e, r29 ; 62 |
80c: 0f be out 0x3f, r0 ; 63 |
80e: cd bf out 0x3d, r28 ; 61 |
unsigned int tmp_int_arr1[1]; |
unsigned int tmp_int_arr2[2]; |
unsigned int tmp_int_arr20[21]; |
unsigned char tmp_char_arr3[3]; |
// unsigned int tmp_int_arr4[4]; |
if(!NeuerDatensatzEmpfangen) return; |
810: 80 91 9b 00 lds r24, 0x009B |
814: 88 23 and r24, r24 |
816: 09 f4 brne .+2 ; 0x81a <BearbeiteRxDaten+0x1e> |
818: a7 c0 rjmp .+334 ; 0x968 <__stack+0x109> |
NeuerDatensatzEmpfangen = 0; |
81a: 10 92 9b 00 sts 0x009B, r1 |
if(ErwarteAntwort == RxdBuffer[2]) AntwortEingetroffen = 1; |
81e: 90 91 6d 00 lds r25, 0x006D |
822: 80 91 54 01 lds r24, 0x0154 |
826: 98 17 cp r25, r24 |
828: 19 f4 brne .+6 ; 0x830 <BearbeiteRxDaten+0x34> |
82a: 81 e0 ldi r24, 0x01 ; 1 |
82c: 80 93 92 00 sts 0x0092, r24 |
switch(RxdBuffer[2]) |
830: 80 91 54 01 lds r24, 0x0154 |
834: 99 27 eor r25, r25 |
836: 82 33 cpi r24, 0x32 ; 50 |
838: 91 05 cpc r25, r1 |
83a: 09 f4 brne .+2 ; 0x83e <BearbeiteRxDaten+0x42> |
83c: 46 c0 rjmp .+140 ; 0x8ca <__stack+0x6b> |
83e: 83 33 cpi r24, 0x33 ; 51 |
840: 91 05 cpc r25, r1 |
842: 34 f4 brge .+12 ; 0x850 <BearbeiteRxDaten+0x54> |
844: 80 33 cpi r24, 0x30 ; 48 |
846: 91 05 cpc r25, r1 |
848: 99 f0 breq .+38 ; 0x870 <__stack+0x11> |
84a: c1 97 sbiw r24, 0x31 ; 49 |
84c: 49 f1 breq .+82 ; 0x8a0 <__stack+0x41> |
84e: 8c c0 rjmp .+280 ; 0x968 <__stack+0x109> |
850: 84 34 cpi r24, 0x44 ; 68 |
852: 91 05 cpc r25, r1 |
854: 09 f4 brne .+2 ; 0x858 <BearbeiteRxDaten+0x5c> |
856: 6b c0 rjmp .+214 ; 0x92e <__stack+0xcf> |
858: 85 34 cpi r24, 0x45 ; 69 |
85a: 91 05 cpc r25, r1 |
85c: 24 f4 brge .+8 ; 0x866 <__stack+0x7> |
85e: c3 97 sbiw r24, 0x33 ; 51 |
860: 09 f4 brne .+2 ; 0x864 <__stack+0x5> |
862: 48 c0 rjmp .+144 ; 0x8f4 <__stack+0x95> |
864: 81 c0 rjmp .+258 ; 0x968 <__stack+0x109> |
866: 8b 34 cpi r24, 0x4B ; 75 |
868: 91 05 cpc r25, r1 |
86a: 09 f4 brne .+2 ; 0x86e <__stack+0xf> |
86c: 6c c0 rjmp .+216 ; 0x946 <__stack+0xe7> |
86e: 7c c0 rjmp .+248 ; 0x968 <__stack+0x109> |
{ |
case '0':// LCD-Zeile0 |
Decode64((unsigned char *) &tmp_int_arr20,sizeof(tmp_int_arr20),3,AnzahlEmpfangsBytes); |
870: 20 91 98 00 lds r18, 0x0098 |
874: 43 e0 ldi r20, 0x03 ; 3 |
876: 6a e2 ldi r22, 0x2A ; 42 |
878: ce 01 movw r24, r28 |
87a: 01 96 adiw r24, 0x01 ; 1 |
87c: 0e 94 92 03 call 0x724 <Decode64> |
tmp_int_arr20[20] = 0; |
880: 1a a6 std Y+42, r1 ; 0x2a |
882: 19 a6 std Y+41, r1 ; 0x29 |
DisplayBusy = 1; |
884: 81 e0 ldi r24, 0x01 ; 1 |
886: 80 93 93 00 sts 0x0093, r24 |
LCD_printfxy(0,0,"%s",tmp_int_arr20); |
88a: 60 e0 ldi r22, 0x00 ; 0 |
88c: 86 2f mov r24, r22 |
88e: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
892: ce 01 movw r24, r28 |
894: 01 96 adiw r24, 0x01 ; 1 |
896: 9f 93 push r25 |
898: 8f 93 push r24 |
89a: 88 ea ldi r24, 0xA8 ; 168 |
89c: 90 e0 ldi r25, 0x00 ; 0 |
89e: 3e c0 rjmp .+124 ; 0x91c <__stack+0xbd> |
break; |
case '1':// LCD-Zeile1 |
Decode64((unsigned char *) &tmp_int_arr20,sizeof(tmp_int_arr20),3,AnzahlEmpfangsBytes); |
8a0: 20 91 98 00 lds r18, 0x0098 |
8a4: 43 e0 ldi r20, 0x03 ; 3 |
8a6: 6a e2 ldi r22, 0x2A ; 42 |
8a8: ce 01 movw r24, r28 |
8aa: 01 96 adiw r24, 0x01 ; 1 |
8ac: 0e 94 92 03 call 0x724 <Decode64> |
tmp_int_arr20[20] = 0; |
8b0: 1a a6 std Y+42, r1 ; 0x2a |
8b2: 19 a6 std Y+41, r1 ; 0x29 |
LCD_printfxy(0,1,"%s",tmp_int_arr20); |
8b4: 61 e0 ldi r22, 0x01 ; 1 |
8b6: 80 e0 ldi r24, 0x00 ; 0 |
8b8: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
8bc: ce 01 movw r24, r28 |
8be: 01 96 adiw r24, 0x01 ; 1 |
8c0: 9f 93 push r25 |
8c2: 8f 93 push r24 |
8c4: 8b ea ldi r24, 0xAB ; 171 |
8c6: 90 e0 ldi r25, 0x00 ; 0 |
8c8: 29 c0 rjmp .+82 ; 0x91c <__stack+0xbd> |
break; |
case '2':// LCD-Zeile2 |
Decode64((unsigned char *) &tmp_int_arr20,sizeof(tmp_int_arr20),3,AnzahlEmpfangsBytes); |
8ca: 20 91 98 00 lds r18, 0x0098 |
8ce: 43 e0 ldi r20, 0x03 ; 3 |
8d0: 6a e2 ldi r22, 0x2A ; 42 |
8d2: ce 01 movw r24, r28 |
8d4: 01 96 adiw r24, 0x01 ; 1 |
8d6: 0e 94 92 03 call 0x724 <Decode64> |
tmp_int_arr20[20] = 0; |
8da: 1a a6 std Y+42, r1 ; 0x2a |
8dc: 19 a6 std Y+41, r1 ; 0x29 |
LCD_printfxy(0,2,"%s",tmp_int_arr20); |
8de: 62 e0 ldi r22, 0x02 ; 2 |
8e0: 80 e0 ldi r24, 0x00 ; 0 |
8e2: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
8e6: ce 01 movw r24, r28 |
8e8: 01 96 adiw r24, 0x01 ; 1 |
8ea: 9f 93 push r25 |
8ec: 8f 93 push r24 |
8ee: 8e ea ldi r24, 0xAE ; 174 |
8f0: 90 e0 ldi r25, 0x00 ; 0 |
8f2: 14 c0 rjmp .+40 ; 0x91c <__stack+0xbd> |
break; |
case '3':// LCD-Zeile3 |
Decode64((unsigned char *) &tmp_int_arr20,sizeof(tmp_int_arr20),3,AnzahlEmpfangsBytes); |
8f4: 20 91 98 00 lds r18, 0x0098 |
8f8: 43 e0 ldi r20, 0x03 ; 3 |
8fa: 6a e2 ldi r22, 0x2A ; 42 |
8fc: ce 01 movw r24, r28 |
8fe: 01 96 adiw r24, 0x01 ; 1 |
900: 0e 94 92 03 call 0x724 <Decode64> |
tmp_int_arr20[20] = 0; |
904: 1a a6 std Y+42, r1 ; 0x2a |
906: 19 a6 std Y+41, r1 ; 0x29 |
LCD_printfxy(0,3,"%s",tmp_int_arr20); |
908: 63 e0 ldi r22, 0x03 ; 3 |
90a: 80 e0 ldi r24, 0x00 ; 0 |
90c: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
910: ce 01 movw r24, r28 |
912: 01 96 adiw r24, 0x01 ; 1 |
914: 9f 93 push r25 |
916: 8f 93 push r24 |
918: 81 eb ldi r24, 0xB1 ; 177 |
91a: 90 e0 ldi r25, 0x00 ; 0 |
91c: 9f 93 push r25 |
91e: 8f 93 push r24 |
920: 0e 94 e3 06 call 0xdc6 <_printf_P> |
break; |
924: 0f 90 pop r0 |
926: 0f 90 pop r0 |
928: 0f 90 pop r0 |
92a: 0f 90 pop r0 |
92c: 1d c0 rjmp .+58 ; 0x968 <__stack+0x109> |
case 'D': // Debug Eingangsdaten |
Decode64((unsigned char *) &DebugOut,sizeof(DebugOut),3,AnzahlEmpfangsBytes); |
92e: 20 91 98 00 lds r18, 0x0098 |
932: 43 e0 ldi r20, 0x03 ; 3 |
934: 6a e1 ldi r22, 0x1A ; 26 |
936: 83 ed ldi r24, 0xD3 ; 211 |
938: 90 e0 ldi r25, 0x00 ; 0 |
93a: 0e 94 92 03 call 0x724 <Decode64> |
PORTB = DebugOut.Digital[1]; |
93e: 80 91 d4 00 lds r24, 0x00D4 |
942: 88 bb out 0x18, r24 ; 24 |
break; |
944: 11 c0 rjmp .+34 ; 0x968 <__stack+0x109> |
case 'K': // Debug Eingangsdaten |
Decode64(tmp_char_arr3,sizeof(tmp_char_arr3),3,AnzahlEmpfangsBytes); |
946: 20 91 98 00 lds r18, 0x0098 |
94a: 43 e0 ldi r20, 0x03 ; 3 |
94c: 64 2f mov r22, r20 |
94e: ce 01 movw r24, r28 |
950: 8b 96 adiw r24, 0x2b ; 43 |
952: 0e 94 92 03 call 0x724 <Decode64> |
TX_DigTransferKanalL = tmp_char_arr3[0]; |
956: 8b a5 ldd r24, Y+43 ; 0x2b |
958: 80 93 96 00 sts 0x0096, r24 |
TX_DigTransferKanalH = tmp_char_arr3[1]; |
95c: 8c a5 ldd r24, Y+44 ; 0x2c |
95e: 80 93 95 00 sts 0x0095, r24 |
TX_DigTransferKanalDaten = tmp_char_arr3[2]; |
962: 8d a5 ldd r24, Y+45 ; 0x2d |
964: 80 93 94 00 sts 0x0094, r24 |
968: ad 96 adiw r28, 0x2d ; 45 |
96a: 0f b6 in r0, 0x3f ; 63 |
96c: f8 94 cli |
96e: de bf out 0x3e, r29 ; 62 |
970: 0f be out 0x3f, r0 ; 63 |
972: cd bf out 0x3d, r28 ; 61 |
974: df 91 pop r29 |
976: cf 91 pop r28 |
978: 08 95 ret |
0000097a <uart_putchar>: |
//if(RxdBuffer[1] == 'b') LCD_printfxy(0,0,"b:%4d %2x",(int)TX_DigTransferKanalH * 256 + TX_DigTransferKanalL,TX_DigTransferKanalDaten); |
//if(RxdBuffer[1] == 'c') LCD_printfxy(0,1,"c:%4d %2x",(int)TX_DigTransferKanalH * 256 + TX_DigTransferKanalL,TX_DigTransferKanalDaten); |
break; |
/* |
unsigned char Digital[13]; // 0 = Taster, Hauptkarte |
// 1 + 2 = Debugkanäle |
// 3 = Digin, Hauptkarte |
// 4 = Relais, Hauptkarte |
// 5 + 6 = Extern IO1 (12Bit ein 4 Bit aus) |
// 7 + 8 = Extern IO2 (12Bit ein 4 Bit aus) |
// 9 + 10 = Extern IO3 (12Bit ein 4 Bit aus) |
// 11 + 12= Extern IO4 (12Bit ein 4 Bit aus) |
*/ |
/* case 'd': // Debug Eingangsdaten |
Decode64((unsigned char *) &DebugIn,sizeof(DebugIn),3,AnzahlEmpfangsBytes); |
for(unsigned char i=0; i<4;i++) |
{ |
EE_CheckAndWrite(&EE_Buffer[EE_DEBUGWERTE + i*2], DebugIn.Analog[i]); |
EE_CheckAndWrite(&EE_Buffer[EE_DEBUGWERTE + i*2 + 1], DebugIn.Analog[i] >> 8); |
} |
break; |
case 'g': // "Get"-Anforderung für Debug-Daten // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
DebugGetAnforderung = 1; |
break; |
case 'v': // Version-Anforderung und Ausbaustufe |
GetVersionAnforderung = 1; |
break; |
case 'u': // Uhr stellen |
Decode64((unsigned char *) &tmp_int_arr2[0],sizeof(tmp_int_arr2),3,AnzahlEmpfangsBytes); |
ZEITWERT = tmp_int_arr2[0]; |
SEK = tmp_int_arr2[1]; |
make_time_variables(ZEITWERT); |
RTC_SetTime(STD, MIN, SEK); |
RTC_SetWDay(TAG); |
break; |
case 'i': // Intervalle für die Datenübertragung |
Decode64((unsigned char *) &tmp_int_arr2[0],sizeof(tmp_int_arr2),3,AnzahlEmpfangsBytes); |
Debug_Timer_Intervall = tmp_int_arr2[0]; |
Debug_Display_Intervall = tmp_int_arr2[1]; |
SendeDummyDaten = 1; |
break; |
case 's': // single Step 1 = Stop 2 = noch einen Zyklus 3 = noch 2 Zyklen |
Decode64((unsigned char *) &tmp_int_arr1[0],sizeof(tmp_int_arr2),3,AnzahlEmpfangsBytes); |
SingleStep = tmp_int_arr1[0]; |
break; |
*/ |
} |
} |
//############################################################################ |
//Routine für die Serielle Ausgabe |
int uart_putchar (char c) |
//############################################################################ |
{ |
97a: cf 93 push r28 |
97c: c8 2f mov r28, r24 |
if (c == '\n') |
97e: 8a 30 cpi r24, 0x0A ; 10 |
980: 19 f4 brne .+6 ; 0x988 <uart_putchar+0xe> |
uart_putchar('\r'); |
982: 8d e0 ldi r24, 0x0D ; 13 |
984: 0e 94 bd 04 call 0x97a <uart_putchar> |
//Warten solange bis Zeichen gesendet wurde |
loop_until_bit_is_set(USR, UDRE); |
988: 5d 9b sbis 0x0b, 5 ; 11 |
98a: fe cf rjmp .-4 ; 0x988 <uart_putchar+0xe> |
//Ausgabe des Zeichens |
UDR = c; |
98c: cc b9 out 0x0c, r28 ; 12 |
return (0); |
} |
98e: 80 e0 ldi r24, 0x00 ; 0 |
990: 90 e0 ldi r25, 0x00 ; 0 |
992: cf 91 pop r28 |
994: 08 95 ret |
00000996 <WriteProgramData>: |
// -------------------------------------------------------------------------- |
void WriteProgramData(unsigned int pos, unsigned char wert) |
{ |
996: 08 95 ret |
00000998 <UART_Init>: |
//if (ProgramLocation == IN_RAM) Buffer[pos] = wert; |
// else eeprom_write_byte(&EE_Buffer[pos], wert); |
// Buffer[pos] = wert; |
} |
//############################################################################ |
//INstallation der Seriellen Schnittstelle |
void UART_Init (void) |
//############################################################################ |
{ |
//Enable TXEN im Register UCR TX-Data Enable & RX Enable |
UCR=(1 << TXEN) | (1 << RXEN); |
998: 88 e1 ldi r24, 0x18 ; 24 |
99a: 8a b9 out 0x0a, r24 ; 10 |
// UART Double Speed (U2X) |
USR |= (1<<U2X); |
99c: 59 9a sbi 0x0b, 1 ; 11 |
// RX-Interrupt Freigabe |
UCSRB |= (1<<RXCIE); |
99e: 57 9a sbi 0x0a, 7 ; 10 |
// TX-Interrupt Freigabe |
UCSRB |= (1<<TXCIE); |
9a0: 56 9a sbi 0x0a, 6 ; 10 |
//Teiler wird gesetzt |
UBRR=(SYSCLK / (BAUD_RATE * 8L) - 1); |
9a2: 81 e2 ldi r24, 0x21 ; 33 |
9a4: 89 b9 out 0x09, r24 ; 9 |
//UBRR = 33; |
//öffnet einen Kanal für printf (STDOUT) |
fdevopen (uart_putchar, NULL); |
9a6: 60 e0 ldi r22, 0x00 ; 0 |
9a8: 70 e0 ldi r23, 0x00 ; 0 |
9aa: 8d eb ldi r24, 0xBD ; 189 |
9ac: 94 e0 ldi r25, 0x04 ; 4 |
9ae: 0e 94 71 0c call 0x18e2 <fdevopen> |
9b2: 08 95 ret |
000009b4 <SendeRemoteTasten>: |
//sbi(PORTD,4); |
} |
/* |
struct str_DebugIn |
{ |
unsigned char Digital[2]; |
unsigned char RemoteTasten; |
unsigned int Analog[4]; |
}; |
*/ |
void SendeRemoteTasten(unsigned char keys) |
{ |
9b4: 98 2f mov r25, r24 |
while(!UebertragungAbgeschlossen); // evtl warten |
9b6: 80 91 6e 00 lds r24, 0x006E |
9ba: 88 23 and r24, r24 |
9bc: e1 f3 breq .-8 ; 0x9b6 <SendeRemoteTasten+0x2> |
DebugIn.RemoteTasten = keys; |
9be: 90 93 c0 00 sts 0x00C0, r25 |
DebugIn.Analog[0] = AnalogWerte[0]; |
9c2: 80 91 ca 01 lds r24, 0x01CA |
9c6: 90 91 cb 01 lds r25, 0x01CB |
9ca: 90 93 c2 00 sts 0x00C2, r25 |
9ce: 80 93 c1 00 sts 0x00C1, r24 |
DebugIn.Analog[1] = AnalogWerte[1]; |
9d2: 80 91 cc 01 lds r24, 0x01CC |
9d6: 90 91 cd 01 lds r25, 0x01CD |
9da: 90 93 c4 00 sts 0x00C4, r25 |
9de: 80 93 c3 00 sts 0x00C3, r24 |
DebugIn.Analog[2] = AnalogWerte[2]; |
9e2: 80 91 ce 01 lds r24, 0x01CE |
9e6: 90 91 cf 01 lds r25, 0x01CF |
9ea: 90 93 c6 00 sts 0x00C6, r25 |
9ee: 80 93 c5 00 sts 0x00C5, r24 |
DebugIn.Analog[3] = IR_Code; |
9f2: 80 91 c7 01 lds r24, 0x01C7 |
9f6: 90 91 c8 01 lds r25, 0x01C8 |
9fa: 90 93 c8 00 sts 0x00C8, r25 |
9fe: 80 93 c7 00 sts 0x00C7, r24 |
SendOutData('d',SlaveAdresse,(unsigned char *) &DebugIn,sizeof(DebugIn)); |
a02: 2b e0 ldi r18, 0x0B ; 11 |
a04: 4e eb ldi r20, 0xBE ; 190 |
a06: 50 e0 ldi r21, 0x00 ; 0 |
a08: 60 91 64 00 lds r22, 0x0064 |
a0c: 84 e6 ldi r24, 0x64 ; 100 |
a0e: 0e 94 1e 03 call 0x63c <SendOutData> |
a12: 08 95 ret |
00000a14 <SendIntervalle>: |
} |
void SendIntervalle(unsigned int debug, unsigned int disp) |
{ |
a14: cf 93 push r28 |
a16: df 93 push r29 |
a18: cd b7 in r28, 0x3d ; 61 |
a1a: de b7 in r29, 0x3e ; 62 |
a1c: 24 97 sbiw r28, 0x04 ; 4 |
a1e: 0f b6 in r0, 0x3f ; 63 |
a20: f8 94 cli |
a22: de bf out 0x3e, r29 ; 62 |
a24: 0f be out 0x3f, r0 ; 63 |
a26: cd bf out 0x3d, r28 ; 61 |
unsigned int tmp_int_arr2[2]; |
tmp_int_arr2[0] = debug; |
a28: 9a 83 std Y+2, r25 ; 0x02 |
a2a: 89 83 std Y+1, r24 ; 0x01 |
tmp_int_arr2[1] = disp; |
a2c: 7c 83 std Y+4, r23 ; 0x04 |
a2e: 6b 83 std Y+3, r22 ; 0x03 |
while(!UebertragungAbgeschlossen); // evtl warten |
a30: 80 91 6e 00 lds r24, 0x006E |
a34: 88 23 and r24, r24 |
a36: e1 f3 breq .-8 ; 0xa30 <SendIntervalle+0x1c> |
SendOutData('i',SlaveAdresse,(unsigned char *) &tmp_int_arr2,sizeof(tmp_int_arr2)); |
a38: 24 e0 ldi r18, 0x04 ; 4 |
a3a: ae 01 movw r20, r28 |
a3c: 4f 5f subi r20, 0xFF ; 255 |
a3e: 5f 4f sbci r21, 0xFF ; 255 |
a40: 60 91 64 00 lds r22, 0x0064 |
a44: 89 e6 ldi r24, 0x69 ; 105 |
a46: 0e 94 1e 03 call 0x63c <SendOutData> |
a4a: 24 96 adiw r28, 0x04 ; 4 |
a4c: 0f b6 in r0, 0x3f ; 63 |
a4e: f8 94 cli |
a50: de bf out 0x3e, r29 ; 62 |
a52: 0f be out 0x3f, r0 ; 63 |
a54: cd bf out 0x3d, r28 ; 61 |
a56: df 91 pop r29 |
a58: cf 91 pop r28 |
a5a: 08 95 ret |
00000a5c <ClearIntervalle>: |
} |
void ClearIntervalle(void) |
{ |
a5c: cf 93 push r28 |
a5e: df 93 push r29 |
a60: cd b7 in r28, 0x3d ; 61 |
a62: de b7 in r29, 0x3e ; 62 |
a64: 24 97 sbiw r28, 0x04 ; 4 |
a66: 0f b6 in r0, 0x3f ; 63 |
a68: f8 94 cli |
a6a: de bf out 0x3e, r29 ; 62 |
a6c: 0f be out 0x3f, r0 ; 63 |
a6e: cd bf out 0x3d, r28 ; 61 |
unsigned int tmp_int_arr2[2]; |
tmp_int_arr2[0] = 0; |
a70: 1a 82 std Y+2, r1 ; 0x02 |
a72: 19 82 std Y+1, r1 ; 0x01 |
tmp_int_arr2[1] = 0; |
a74: 1c 82 std Y+4, r1 ; 0x04 |
a76: 1b 82 std Y+3, r1 ; 0x03 |
while(!UebertragungAbgeschlossen); // evtl warten |
a78: 80 91 6e 00 lds r24, 0x006E |
a7c: 88 23 and r24, r24 |
a7e: e1 f3 breq .-8 ; 0xa78 <ClearIntervalle+0x1c> |
SendOutData('i',0,(unsigned char *) &tmp_int_arr2,sizeof(tmp_int_arr2)); // 0= an alle |
a80: 24 e0 ldi r18, 0x04 ; 4 |
a82: ae 01 movw r20, r28 |
a84: 4f 5f subi r20, 0xFF ; 255 |
a86: 5f 4f sbci r21, 0xFF ; 255 |
a88: 60 e0 ldi r22, 0x00 ; 0 |
a8a: 89 e6 ldi r24, 0x69 ; 105 |
a8c: 0e 94 1e 03 call 0x63c <SendOutData> |
a90: 24 96 adiw r28, 0x04 ; 4 |
a92: 0f b6 in r0, 0x3f ; 63 |
a94: f8 94 cli |
a96: de bf out 0x3e, r29 ; 62 |
a98: 0f be out 0x3f, r0 ; 63 |
a9a: cd bf out 0x3d, r28 ; 61 |
a9c: df 91 pop r29 |
a9e: cf 91 pop r28 |
aa0: 08 95 ret |
00000aa2 <DatenUebertragung>: |
} |
void DatenUebertragung(unsigned char key) |
{ |
aa2: cf 93 push r28 |
aa4: df 93 push r29 |
aa6: cd b7 in r28, 0x3d ; 61 |
aa8: de b7 in r29, 0x3e ; 62 |
aaa: 25 97 sbiw r28, 0x05 ; 5 |
aac: 0f b6 in r0, 0x3f ; 63 |
aae: f8 94 cli |
ab0: de bf out 0x3e, r29 ; 62 |
ab2: 0f be out 0x3f, r0 ; 63 |
ab4: cd bf out 0x3d, r28 ; 61 |
ab6: 98 2f mov r25, r24 |
static unsigned char state = 1; |
unsigned char temp_1[1]; |
unsigned char temp_2[2]; |
unsigned char temp_3[3]; |
unsigned int tmp_int_arr2[2]; |
while(!UebertragungAbgeschlossen); // evtl warten |
ab8: 80 91 6e 00 lds r24, 0x006E |
abc: 88 23 and r24, r24 |
abe: e1 f3 breq .-8 ; 0xab8 <DatenUebertragung+0x16> |
static unsigned char KanalSlave = 1; |
if(PollDisplay) |
ac0: 80 91 ed 00 lds r24, 0x00ED |
ac4: 88 23 and r24, r24 |
ac6: e1 f0 breq .+56 ; 0xb00 <DatenUebertragung+0x5e> |
{ |
temp_2[0] = key; |
ac8: 9c 83 std Y+4, r25 ; 0x04 |
temp_2[1] = 6; |
aca: 86 e0 ldi r24, 0x06 ; 6 |
acc: 8d 83 std Y+5, r24 ; 0x05 |
if(DisplayZeilen == 4) temp_2[1] = 4 + 9; // anzahl Zeilen --> + 8 bedeutet: ersten Pollingzyklus freilassen |
ace: 80 91 65 00 lds r24, 0x0065 |
ad2: 84 30 cpi r24, 0x04 ; 4 |
ad4: 11 f4 brne .+4 ; 0xada <DatenUebertragung+0x38> |
ad6: 8d e0 ldi r24, 0x0D ; 13 |
ad8: 01 c0 rjmp .+2 ; 0xadc <DatenUebertragung+0x3a> |
else temp_2[1] = 2 + 9; |
ada: 8b e0 ldi r24, 0x0B ; 11 |
adc: 8d 83 std Y+5, r24 ; 0x05 |
SendOutData('h',SlaveAdresse,(unsigned char *) &temp_2,sizeof(temp_2)); |
ade: 22 e0 ldi r18, 0x02 ; 2 |
ae0: ae 01 movw r20, r28 |
ae2: 4c 5f subi r20, 0xFC ; 252 |
ae4: 5f 4f sbci r21, 0xFF ; 255 |
ae6: 60 91 64 00 lds r22, 0x0064 |
aea: 88 e6 ldi r24, 0x68 ; 104 |
aec: 0e 94 1e 03 call 0x63c <SendOutData> |
ErwarteAntwort = '0'; |
af0: 80 e3 ldi r24, 0x30 ; 48 |
af2: 80 93 6d 00 sts 0x006D, r24 |
DisplayBusy = 90; |
af6: 8a e5 ldi r24, 0x5A ; 90 |
af8: 80 93 93 00 sts 0x0093, r24 |
PollDisplay = 0; |
afc: 10 92 ed 00 sts 0x00ED, r1 |
} |
if(!DisplayBusy) |
b00: 60 91 93 00 lds r22, 0x0093 |
b04: 66 23 and r22, r22 |
b06: e1 f5 brne .+120 ; 0xb80 <DatenUebertragung+0xde> |
switch(state) |
b08: 80 91 6f 00 lds r24, 0x006F |
b0c: 99 27 eor r25, r25 |
b0e: 81 30 cpi r24, 0x01 ; 1 |
b10: 91 05 cpc r25, r1 |
b12: 19 f0 breq .+6 ; 0xb1a <DatenUebertragung+0x78> |
b14: 02 97 sbiw r24, 0x02 ; 2 |
b16: e9 f0 breq .+58 ; 0xb52 <DatenUebertragung+0xb0> |
b18: 30 c0 rjmp .+96 ; 0xb7a <DatenUebertragung+0xd8> |
{ |
case 1:// Display |
SendOutData('k',KanalSlave,(unsigned char *) &temp_3,sizeof(temp_3)); |
b1a: 23 e0 ldi r18, 0x03 ; 3 |
b1c: ae 01 movw r20, r28 |
b1e: 4f 5f subi r20, 0xFF ; 255 |
b20: 5f 4f sbci r21, 0xFF ; 255 |
b22: 60 91 70 00 lds r22, 0x0070 |
b26: 8b e6 ldi r24, 0x6B ; 107 |
b28: 0e 94 1e 03 call 0x63c <SendOutData> |
ErwarteAntwort = 'K'; |
b2c: 8b e4 ldi r24, 0x4B ; 75 |
b2e: 80 93 6d 00 sts 0x006D, r24 |
if(++KanalSlave > AnzahlTeilnehmer) KanalSlave = 1; |
b32: 80 91 70 00 lds r24, 0x0070 |
b36: 8f 5f subi r24, 0xFF ; 255 |
b38: 80 93 70 00 sts 0x0070, r24 |
b3c: 90 91 6c 00 lds r25, 0x006C |
b40: 98 17 cp r25, r24 |
b42: 18 f4 brcc .+6 ; 0xb4a <DatenUebertragung+0xa8> |
b44: 81 e0 ldi r24, 0x01 ; 1 |
b46: 80 93 70 00 sts 0x0070, r24 |
state++; |
b4a: 80 91 6f 00 lds r24, 0x006F |
b4e: 8f 5f subi r24, 0xFF ; 255 |
b50: 15 c0 rjmp .+42 ; 0xb7c <DatenUebertragung+0xda> |
break; |
case 2: |
temp_3[0] = TX_DigTransferKanalL; |
b52: 80 91 96 00 lds r24, 0x0096 |
b56: 89 83 std Y+1, r24 ; 0x01 |
temp_3[1] = TX_DigTransferKanalH; |
b58: 80 91 95 00 lds r24, 0x0095 |
b5c: 8a 83 std Y+2, r24 ; 0x02 |
temp_3[2] = TX_DigTransferKanalDaten; |
b5e: 80 91 94 00 lds r24, 0x0094 |
b62: 8b 83 std Y+3, r24 ; 0x03 |
SendOutData('l',0,(unsigned char *) &temp_3,sizeof(temp_3)); |
b64: 23 e0 ldi r18, 0x03 ; 3 |
b66: ae 01 movw r20, r28 |
b68: 4f 5f subi r20, 0xFF ; 255 |
b6a: 5f 4f sbci r21, 0xFF ; 255 |
b6c: 8c e6 ldi r24, 0x6C ; 108 |
b6e: 0e 94 1e 03 call 0x63c <SendOutData> |
AntwortEingetroffen = 1; // erwarte keine Antwort |
b72: 81 e0 ldi r24, 0x01 ; 1 |
b74: 80 93 92 00 sts 0x0092, r24 |
b78: 01 c0 rjmp .+2 ; 0xb7c <DatenUebertragung+0xda> |
state = 1; |
break; |
default: state = 1; |
b7a: 81 e0 ldi r24, 0x01 ; 1 |
b7c: 80 93 6f 00 sts 0x006F, r24 |
b80: 25 96 adiw r28, 0x05 ; 5 |
b82: 0f b6 in r0, 0x3f ; 63 |
b84: f8 94 cli |
b86: de bf out 0x3e, r29 ; 62 |
b88: 0f be out 0x3f, r0 ; 63 |
b8a: cd bf out 0x3d, r28 ; 61 |
b8c: df 91 pop r29 |
b8e: cf 91 pop r28 |
b90: 08 95 ret |
00000b92 <_long_delay>: |
#include "main.h" |
void _long_delay(void) |
{ |
long t = 5000; |
b92: 88 e8 ldi r24, 0x88 ; 136 |
b94: 93 e1 ldi r25, 0x13 ; 19 |
b96: a0 e0 ldi r26, 0x00 ; 0 |
b98: b0 e0 ldi r27, 0x00 ; 0 |
while (t--); |
b9a: 03 97 sbiw r24, 0x03 ; 3 |
b9c: a1 09 sbc r26, r1 |
b9e: b1 09 sbc r27, r1 |
ba0: 8f 3f cpi r24, 0xFF ; 255 |
ba2: 2f ef ldi r18, 0xFF ; 255 |
ba4: 92 07 cpc r25, r18 |
ba6: 2f ef ldi r18, 0xFF ; 255 |
ba8: a2 07 cpc r26, r18 |
baa: 2f ef ldi r18, 0xFF ; 255 |
bac: b2 07 cpc r27, r18 |
bae: a9 f7 brne .-22 ; 0xb9a <_long_delay+0x8> |
bb0: 08 95 ret |
00000bb2 <_short_delay>: |
} |
void _short_delay(void) |
{ |
int t = 500; |
bb2: 84 ef ldi r24, 0xF4 ; 244 |
bb4: 91 e0 ldi r25, 0x01 ; 1 |
while (t--); |
bb6: 03 97 sbiw r24, 0x03 ; 3 |
bb8: 2f ef ldi r18, 0xFF ; 255 |
bba: 8f 3f cpi r24, 0xFF ; 255 |
bbc: 92 07 cpc r25, r18 |
bbe: d9 f7 brne .-10 ; 0xbb6 <_short_delay+0x4> |
bc0: 08 95 ret |
00000bc2 <_lcd_write_command>: |
} |
void _lcd_write_command(unsigned char data) |
{ |
bc2: 28 2f mov r18, r24 |
LCD_PORT_w = (data & 0xf0) | DISPLAY_EN; |
bc4: 80 7f andi r24, 0xF0 ; 240 |
bc6: 98 2f mov r25, r24 |
bc8: 94 60 ori r25, 0x04 ; 4 |
bca: 95 bb out 0x15, r25 ; 21 |
LCD_PORT_w = (data & 0xf0) | DISPLAY_EN; |
bcc: 95 bb out 0x15, r25 ; 21 |
LCD_PORT_w = (data & 0xf0); |
bce: 85 bb out 0x15, r24 ; 21 |
LCD_PORT_w = (data & 0xf0); |
bd0: 85 bb out 0x15, r24 ; 21 |
LCD_PORT_w = (data << 4) | DISPLAY_EN; |
bd2: 82 2f mov r24, r18 |
bd4: 99 27 eor r25, r25 |
bd6: 34 e0 ldi r19, 0x04 ; 4 |
bd8: 88 0f add r24, r24 |
bda: 99 1f adc r25, r25 |
bdc: 3a 95 dec r19 |
bde: e1 f7 brne .-8 ; 0xbd8 <_lcd_write_command+0x16> |
be0: 84 60 ori r24, 0x04 ; 4 |
be2: 85 bb out 0x15, r24 ; 21 |
LCD_PORT_w = (data << 4) | DISPLAY_EN; |
be4: 85 bb out 0x15, r24 ; 21 |
LCD_PORT_w = (data << 4); |
be6: 22 95 swap r18 |
be8: 20 7f andi r18, 0xF0 ; 240 |
bea: 25 bb out 0x15, r18 ; 21 |
bec: 08 95 ret |
00000bee <_lcd_write_4bit>: |
} |
void _lcd_write_4bit(unsigned char data) |
{ |
LCD_PORT_w = (data << 4) | DISPLAY_EN; |
bee: 28 2f mov r18, r24 |
bf0: 33 27 eor r19, r19 |
bf2: 44 e0 ldi r20, 0x04 ; 4 |
bf4: 22 0f add r18, r18 |
bf6: 33 1f adc r19, r19 |
bf8: 4a 95 dec r20 |
bfa: e1 f7 brne .-8 ; 0xbf4 <_lcd_write_4bit+0x6> |
bfc: 92 2f mov r25, r18 |
bfe: 94 60 ori r25, 0x04 ; 4 |
c00: 95 bb out 0x15, r25 ; 21 |
LCD_PORT_w = (data << 4) | DISPLAY_EN; |
c02: 95 bb out 0x15, r25 ; 21 |
LCD_PORT_w = (data << 4); |
c04: 82 95 swap r24 |
c06: 80 7f andi r24, 0xF0 ; 240 |
c08: 85 bb out 0x15, r24 ; 21 |
c0a: 08 95 ret |
00000c0c <lcd_write_byte>: |
} |
void lcd_write_byte(unsigned char data) |
{ |
c0c: 28 2f mov r18, r24 |
LCD_PORT_w = (data & 0xf0) | DISPLAY_EN | DISPLAY_RS; |
c0e: 80 7f andi r24, 0xF0 ; 240 |
c10: 98 2f mov r25, r24 |
c12: 95 60 ori r25, 0x05 ; 5 |
c14: 95 bb out 0x15, r25 ; 21 |
LCD_PORT_w = (data & 0xf0) | DISPLAY_RS; |
c16: 81 60 ori r24, 0x01 ; 1 |
c18: 85 bb out 0x15, r24 ; 21 |
LCD_PORT_w = (data << 4) | DISPLAY_EN | DISPLAY_RS; |
c1a: 82 2f mov r24, r18 |
c1c: 99 27 eor r25, r25 |
c1e: 54 e0 ldi r21, 0x04 ; 4 |
c20: 88 0f add r24, r24 |
c22: 99 1f adc r25, r25 |
c24: 5a 95 dec r21 |
c26: e1 f7 brne .-8 ; 0xc20 <lcd_write_byte+0x14> |
c28: 28 2f mov r18, r24 |
c2a: 25 60 ori r18, 0x05 ; 5 |
c2c: 25 bb out 0x15, r18 ; 21 |
LCD_PORT_w = (data << 4) | DISPLAY_RS; |
c2e: 81 60 ori r24, 0x01 ; 1 |
c30: 85 bb out 0x15, r24 ; 21 |
c32: 08 95 ret |
00000c34 <my_pput>: |
} |
int my_pput(int zeichen) |
{ |
lcd_write_byte((char) zeichen); |
c34: 0e 94 06 06 call 0xc0c <lcd_write_byte> |
return(1); |
} |
c38: 81 e0 ldi r24, 0x01 ; 1 |
c3a: 90 e0 ldi r25, 0x00 ; 0 |
c3c: 08 95 ret |
00000c3e <LCD_Init>: |
// initialize the LCD controller |
void LCD_Init(void) |
{ |
LCD_PORT_DDR = 0xff;//0xf0 | DISPLAY_RS | DISPLAY_EN; |
c3e: 8f ef ldi r24, 0xFF ; 255 |
c40: 84 bb out 0x14, r24 ; 20 |
_long_delay(); |
c42: 0e 94 c9 05 call 0xb92 <_long_delay> |
_long_delay(); |
c46: 0e 94 c9 05 call 0xb92 <_long_delay> |
_long_delay(); |
c4a: 0e 94 c9 05 call 0xb92 <_long_delay> |
_lcd_write_4bit(0x03); // noch 8 Bit |
c4e: 83 e0 ldi r24, 0x03 ; 3 |
c50: 0e 94 f7 05 call 0xbee <_lcd_write_4bit> |
_long_delay(); |
c54: 0e 94 c9 05 call 0xb92 <_long_delay> |
_lcd_write_4bit(0x03); // noch 8 Bit |
c58: 83 e0 ldi r24, 0x03 ; 3 |
c5a: 0e 94 f7 05 call 0xbee <_lcd_write_4bit> |
_long_delay(); |
c5e: 0e 94 c9 05 call 0xb92 <_long_delay> |
_lcd_write_4bit(0x03); // noch 8 Bit |
c62: 83 e0 ldi r24, 0x03 ; 3 |
c64: 0e 94 f7 05 call 0xbee <_lcd_write_4bit> |
_long_delay(); |
c68: 0e 94 c9 05 call 0xb92 <_long_delay> |
_lcd_write_4bit(0x02); // jetzt 4 Bit |
c6c: 82 e0 ldi r24, 0x02 ; 2 |
c6e: 0e 94 f7 05 call 0xbee <_lcd_write_4bit> |
_long_delay(); |
c72: 0e 94 c9 05 call 0xb92 <_long_delay> |
_lcd_write_command(0x28); // 4 Bit Zweizeilig |
c76: 88 e2 ldi r24, 0x28 ; 40 |
c78: 0e 94 e1 05 call 0xbc2 <_lcd_write_command> |
_long_delay(); |
c7c: 0e 94 c9 05 call 0xb92 <_long_delay> |
_lcd_write_command(0x08); // Display aus |
c80: 88 e0 ldi r24, 0x08 ; 8 |
c82: 0e 94 e1 05 call 0xbc2 <_lcd_write_command> |
_long_delay(); |
c86: 0e 94 c9 05 call 0xb92 <_long_delay> |
_lcd_write_command(0x01); // Clear |
c8a: 81 e0 ldi r24, 0x01 ; 1 |
c8c: 0e 94 e1 05 call 0xbc2 <_lcd_write_command> |
_long_delay(); |
c90: 0e 94 c9 05 call 0xb92 <_long_delay> |
_lcd_write_command(0x06); //Entry mode |
c94: 86 e0 ldi r24, 0x06 ; 6 |
c96: 0e 94 e1 05 call 0xbc2 <_lcd_write_command> |
_long_delay(); |
c9a: 0e 94 c9 05 call 0xb92 <_long_delay> |
_lcd_write_command(0x08 + 4); // Display an |
c9e: 8c e0 ldi r24, 0x0C ; 12 |
ca0: 0e 94 e1 05 call 0xbc2 <_lcd_write_command> |
_long_delay(); |
ca4: 0e 94 c9 05 call 0xb92 <_long_delay> |
ca8: 08 95 ret |
00000caa <LCD_Gotoxy>: |
} |
void LCD_Gotoxy(unsigned char x , unsigned char y) |
{ |
caa: 1f 93 push r17 |
cac: cf 93 push r28 |
cae: c8 2f mov r28, r24 |
cb0: 16 2f mov r17, r22 |
_short_delay(); |
cb2: 0e 94 d9 05 call 0xbb2 <_short_delay> |
switch(y) |
cb6: 81 2f mov r24, r17 |
cb8: 99 27 eor r25, r25 |
cba: 81 30 cpi r24, 0x01 ; 1 |
cbc: 91 05 cpc r25, r1 |
cbe: 79 f0 breq .+30 ; 0xcde <LCD_Gotoxy+0x34> |
cc0: 82 30 cpi r24, 0x02 ; 2 |
cc2: 91 05 cpc r25, r1 |
cc4: 1c f4 brge .+6 ; 0xccc <LCD_Gotoxy+0x22> |
cc6: 89 2b or r24, r25 |
cc8: 39 f0 breq .+14 ; 0xcd8 <LCD_Gotoxy+0x2e> |
cca: 13 c0 rjmp .+38 ; 0xcf2 <LCD_Gotoxy+0x48> |
ccc: 82 30 cpi r24, 0x02 ; 2 |
cce: 91 05 cpc r25, r1 |
cd0: 49 f0 breq .+18 ; 0xce4 <LCD_Gotoxy+0x3a> |
cd2: 03 97 sbiw r24, 0x03 ; 3 |
cd4: 51 f0 breq .+20 ; 0xcea <LCD_Gotoxy+0x40> |
cd6: 0d c0 rjmp .+26 ; 0xcf2 <LCD_Gotoxy+0x48> |
{ case 0 : _lcd_write_command(x + 0x80); break; |
cd8: 8c 2f mov r24, r28 |
cda: 80 58 subi r24, 0x80 ; 128 |
cdc: 08 c0 rjmp .+16 ; 0xcee <LCD_Gotoxy+0x44> |
case 1 : _lcd_write_command(x + 0xC0); break; |
cde: 8c 2f mov r24, r28 |
ce0: 80 54 subi r24, 0x40 ; 64 |
ce2: 05 c0 rjmp .+10 ; 0xcee <LCD_Gotoxy+0x44> |
case 2 : _lcd_write_command(x + (0x80 + 20)); break; |
ce4: 8c 2f mov r24, r28 |
ce6: 8c 56 subi r24, 0x6C ; 108 |
ce8: 02 c0 rjmp .+4 ; 0xcee <LCD_Gotoxy+0x44> |
case 3 : _lcd_write_command(x + (0xC0 + 20)); break; |
cea: 8c 2f mov r24, r28 |
cec: 8c 52 subi r24, 0x2C ; 44 |
cee: 0e 94 e1 05 call 0xbc2 <_lcd_write_command> |
cf2: cf 91 pop r28 |
cf4: 1f 91 pop r17 |
cf6: 08 95 ret |
00000cf8 <LCD_Write>: |
} |
} |
void LCD_Write(unsigned char *this_text) |
{ |
cf8: 1f 93 push r17 |
cfa: cf 93 push r28 |
cfc: df 93 push r29 |
cfe: ec 01 movw r28, r24 |
unsigned char i = 0; |
d00: 10 e0 ldi r17, 0x00 ; 0 |
while(this_text[i] != 0) |
{ |
lcd_write_byte(this_text[i++]); |
_long_delay(); |
d02: 88 81 ld r24, Y |
d04: 88 23 and r24, r24 |
d06: 79 f0 breq .+30 ; 0xd26 <LCD_Write+0x2e> |
d08: fe 01 movw r30, r28 |
d0a: e1 0f add r30, r17 |
d0c: f1 1d adc r31, r1 |
d0e: 1f 5f subi r17, 0xFF ; 255 |
d10: 80 81 ld r24, Z |
d12: 0e 94 06 06 call 0xc0c <lcd_write_byte> |
d16: 0e 94 c9 05 call 0xb92 <_long_delay> |
d1a: fe 01 movw r30, r28 |
d1c: e1 0f add r30, r17 |
d1e: f1 1d adc r31, r1 |
d20: 80 81 ld r24, Z |
d22: 88 23 and r24, r24 |
d24: 89 f7 brne .-30 ; 0xd08 <LCD_Write+0x10> |
d26: df 91 pop r29 |
d28: cf 91 pop r28 |
d2a: 1f 91 pop r17 |
d2c: 08 95 ret |
00000d2e <LCD_Putchar>: |
} |
} |
char LCD_Putchar(char zeichen) |
{ |
d2e: 1f 93 push r17 |
d30: 18 2f mov r17, r24 |
_short_delay(); |
d32: 0e 94 d9 05 call 0xbb2 <_short_delay> |
lcd_write_byte((char) zeichen); |
d36: 81 2f mov r24, r17 |
d38: 0e 94 06 06 call 0xc0c <lcd_write_byte> |
return(1); |
} |
d3c: 81 e0 ldi r24, 0x01 ; 1 |
d3e: 90 e0 ldi r25, 0x00 ; 0 |
d40: 1f 91 pop r17 |
d42: 08 95 ret |
00000d44 <PRINT>: |
#include "old_macros.h" |
//#define LIGHTPRINTF |
void PRINT(const char * ptr, unsigned int len) { |
d44: 0f 93 push r16 |
d46: 1f 93 push r17 |
d48: cf 93 push r28 |
d4a: df 93 push r29 |
d4c: 8c 01 movw r16, r24 |
d4e: eb 01 movw r28, r22 |
for(;len;len--) |
d50: 67 2b or r22, r23 |
d52: 39 f0 breq .+14 ; 0xd62 <PRINT+0x1e> |
LCD_Putchar(*ptr++); |
d54: f8 01 movw r30, r16 |
d56: 81 91 ld r24, Z+ |
d58: 8f 01 movw r16, r30 |
d5a: 0e 94 97 06 call 0xd2e <LCD_Putchar> |
d5e: 21 97 sbiw r28, 0x01 ; 1 |
d60: c9 f7 brne .-14 ; 0xd54 <PRINT+0x10> |
d62: df 91 pop r29 |
d64: cf 91 pop r28 |
d66: 1f 91 pop r17 |
d68: 0f 91 pop r16 |
d6a: 08 95 ret |
00000d6c <PRINTP>: |
} |
void PRINTP(const char * ptr, unsigned int len) { |
d6c: 0f 93 push r16 |
d6e: 1f 93 push r17 |
d70: cf 93 push r28 |
d72: df 93 push r29 |
d74: 8c 01 movw r16, r24 |
d76: eb 01 movw r28, r22 |
for(;len;len--) |
d78: 67 2b or r22, r23 |
d7a: 41 f0 breq .+16 ; 0xd8c <PRINTP+0x20> |
// LCD_Putchar(PRG_RDB(ptr++)); |
LCD_Putchar(pgm_read_byte(ptr++)); |
d7c: f8 01 movw r30, r16 |
d7e: 0f 5f subi r16, 0xFF ; 255 |
d80: 1f 4f sbci r17, 0xFF ; 255 |
d82: 84 91 lpm r24, Z |
d84: 0e 94 97 06 call 0xd2e <LCD_Putchar> |
d88: 21 97 sbiw r28, 0x01 ; 1 |
d8a: c1 f7 brne .-16 ; 0xd7c <PRINTP+0x10> |
d8c: df 91 pop r29 |
d8e: cf 91 pop r28 |
d90: 1f 91 pop r17 |
d92: 0f 91 pop r16 |
d94: 08 95 ret |
00000d96 <PAD_SP>: |
} |
void PAD_SP(signed char howmany) { |
d96: cf 93 push r28 |
d98: c8 2f mov r28, r24 |
for(;howmany>0;howmany--) |
d9a: 18 16 cp r1, r24 |
d9c: 34 f4 brge .+12 ; 0xdaa <PAD_SP+0x14> |
LCD_Putchar(' '); |
d9e: 80 e2 ldi r24, 0x20 ; 32 |
da0: 0e 94 97 06 call 0xd2e <LCD_Putchar> |
da4: c1 50 subi r28, 0x01 ; 1 |
da6: 1c 16 cp r1, r28 |
da8: d4 f3 brlt .-12 ; 0xd9e <PAD_SP+0x8> |
daa: cf 91 pop r28 |
dac: 08 95 ret |
00000dae <PAD_0>: |
} |
void PAD_0(signed char howmany) { |
dae: cf 93 push r28 |
db0: c8 2f mov r28, r24 |
for(;howmany>0;howmany--) |
db2: 18 16 cp r1, r24 |
db4: 34 f4 brge .+12 ; 0xdc2 <PAD_0+0x14> |
LCD_Putchar('0'); |
db6: 80 e3 ldi r24, 0x30 ; 48 |
db8: 0e 94 97 06 call 0xd2e <LCD_Putchar> |
dbc: c1 50 subi r28, 0x01 ; 1 |
dbe: 1c 16 cp r1, r28 |
dc0: d4 f3 brlt .-12 ; 0xdb6 <PAD_0+0x8> |
dc2: cf 91 pop r28 |
dc4: 08 95 ret |
00000dc6 <_printf_P>: |
} |
#define BUF 40 |
/* |
* Macros for converting digits to letters and vice versa |
*/ |
#define to_digit(c) ((c) - '0') |
#define is_digit(c) ((c)<='9' && (c)>='0') |
#define to_char(n) ((n) + '0') |
/* |
* Flags used during conversion. |
*/ |
#define LONGINT 0x01 /* long integer */ |
#define LONGDBL 0x02 /* long double; unimplemented */ |
#define SHORTINT 0x04 /* short integer */ |
#define ALT 0x08 /* alternate form */ |
#define LADJUST 0x10 /* left adjustment */ |
#define ZEROPAD 0x20 /* zero (as opposed to blank) pad */ |
#define HEXPREFIX 0x40 /* add 0x or 0X prefix */ |
void _printf_P (char const *fmt0, ...) /* Works with string from FLASH */ |
{ |
dc6: 2f 92 push r2 |
dc8: 3f 92 push r3 |
dca: 4f 92 push r4 |
dcc: 5f 92 push r5 |
dce: 6f 92 push r6 |
dd0: 7f 92 push r7 |
dd2: 8f 92 push r8 |
dd4: 9f 92 push r9 |
dd6: af 92 push r10 |
dd8: bf 92 push r11 |
dda: cf 92 push r12 |
ddc: df 92 push r13 |
dde: ef 92 push r14 |
de0: ff 92 push r15 |
de2: 0f 93 push r16 |
de4: 1f 93 push r17 |
de6: cf 93 push r28 |
de8: df 93 push r29 |
dea: cd b7 in r28, 0x3d ; 61 |
dec: de b7 in r29, 0x3e ; 62 |
dee: e0 97 sbiw r28, 0x30 ; 48 |
df0: 0f b6 in r0, 0x3f ; 63 |
df2: f8 94 cli |
df4: de bf out 0x3e, r29 ; 62 |
df6: 0f be out 0x3f, r0 ; 63 |
df8: cd bf out 0x3d, r28 ; 61 |
dfa: a5 e4 ldi r26, 0x45 ; 69 |
dfc: 6a 2e mov r6, r26 |
dfe: 71 2c mov r7, r1 |
e00: 6c 0e add r6, r28 |
e02: 7d 1e adc r7, r29 |
va_list ap; |
register const char *fmt; /* format string */ |
register char ch; /* character from fmt */ |
register int n; /* handy integer (short term usage) */ |
register char *cp; /* handy char pointer (short term usage) */ |
const char *fmark; /* for remembering a place in fmt */ |
register unsigned char flags; /* flags as above */ |
signed char width; /* width from format (%8d), or 0 */ |
signed char prec; /* precision from format (%.3d), or -1 */ |
char sign; /* sign prefix (' ', '+', '-', or \0) */ |
unsigned long _ulong=0; /* integer arguments %[diouxX] */ |
e04: 1c a6 std Y+44, r1 ; 0x2c |
e06: 1d a6 std Y+45, r1 ; 0x2d |
e08: 1e a6 std Y+46, r1 ; 0x2e |
e0a: 1f a6 std Y+47, r1 ; 0x2f |
#define OCT 8 |
#define DEC 10 |
#define HEX 16 |
unsigned char base; /* base for [diouxX] conversion */ |
signed char dprec; /* a copy of prec if [diouxX], 0 otherwise */ |
signed char dpad; /* extra 0 padding needed for integers */ |
signed char fieldsz; /* field size expanded by sign, dpad etc */ |
/* The initialization of 'size' is to suppress a warning that |
'size' might be used unitialized. It seems gcc can't |
quite grok this spaghetti code ... */ |
signed char size = 0; /* size of converted field or string */ |
char buf[BUF]; /* space for %c, %[diouxX], %[eEfgG] */ |
char ox[2]; /* space for 0x hex-prefix */ |
va_start(ap, fmt0); |
fmt = fmt0; |
e0c: d3 01 movw r26, r6 |
e0e: ad 90 ld r10, X+ |
e10: bd 90 ld r11, X+ |
e12: 3d 01 movw r6, r26 |
/* |
* Scan the format for conversions (`%' character). |
*/ |
for (;;) { |
for (fmark = fmt; (ch = pgm_read_byte(fmt)) != '\0' && ch != '%'; fmt++) |
e14: c5 01 movw r24, r10 |
e16: 05 c0 rjmp .+10 ; 0xe22 <_printf_P+0x5c> |
e18: 05 32 cpi r16, 0x25 ; 37 |
e1a: 39 f0 breq .+14 ; 0xe2a <_printf_P+0x64> |
e1c: 08 94 sec |
e1e: a1 1c adc r10, r1 |
e20: b1 1c adc r11, r1 |
e22: f5 01 movw r30, r10 |
e24: 04 91 lpm r16, Z |
e26: 00 23 and r16, r16 |
e28: b9 f7 brne .-18 ; 0xe18 <_printf_P+0x52> |
/* void */; |
if ((n = fmt - fmark) != 0) { |
e2a: b5 01 movw r22, r10 |
e2c: 68 1b sub r22, r24 |
e2e: 79 0b sbc r23, r25 |
e30: 11 f0 breq .+4 ; 0xe36 <_printf_P+0x70> |
PRINTP(fmark, n); |
e32: 0e 94 b6 06 call 0xd6c <PRINTP> |
} |
if (ch == '\0') |
e36: 00 23 and r16, r16 |
e38: 09 f4 brne .+2 ; 0xe3c <_printf_P+0x76> |
e3a: 30 c2 rjmp .+1120 ; 0x129c <_printf_P+0x4d6> |
goto done; |
fmt++; /* skip over '%' */ |
e3c: 08 94 sec |
e3e: a1 1c adc r10, r1 |
e40: b1 1c adc r11, r1 |
flags = 0; |
e42: 55 24 eor r5, r5 |
dprec = 0; |
e44: 58 aa std Y+48, r5 ; 0x30 |
width = 0; |
e46: 25 2c mov r2, r5 |
prec = -1; |
e48: 1f ef ldi r17, 0xFF ; 255 |
sign = '\0'; |
e4a: 59 a6 std Y+41, r5 ; 0x29 |
rflag: ch = PRG_RDB(fmt++); |
e4c: f5 01 movw r30, r10 |
e4e: 08 94 sec |
e50: a1 1c adc r10, r1 |
e52: b1 1c adc r11, r1 |
e54: 04 91 lpm r16, Z |
reswitch: |
#ifdef LIGHTPRINTF |
if (ch=='o' || ch=='u' || (ch|0x20)=='x') { |
#else |
if (ch=='u' || (ch|0x20)=='x') { |
e56: 05 37 cpi r16, 0x75 ; 117 |
e58: 21 f0 breq .+8 ; 0xe62 <_printf_P+0x9c> |
e5a: 80 2f mov r24, r16 |
e5c: 80 62 ori r24, 0x20 ; 32 |
e5e: 88 37 cpi r24, 0x78 ; 120 |
e60: f1 f4 brne .+60 ; 0xe9e <_printf_P+0xd8> |
#endif |
if (flags&LONGINT) { |
e62: 50 fe sbrs r5, 0 |
e64: 0e c0 rjmp .+28 ; 0xe82 <_printf_P+0xbc> |
_ulong=va_arg(ap, unsigned long); |
e66: f3 01 movw r30, r6 |
e68: 24 e0 ldi r18, 0x04 ; 4 |
e6a: 30 e0 ldi r19, 0x00 ; 0 |
e6c: 62 0e add r6, r18 |
e6e: 73 1e adc r7, r19 |
e70: 80 81 ld r24, Z |
e72: 91 81 ldd r25, Z+1 ; 0x01 |
e74: a2 81 ldd r26, Z+2 ; 0x02 |
e76: b3 81 ldd r27, Z+3 ; 0x03 |
e78: 8c a7 std Y+44, r24 ; 0x2c |
e7a: 9d a7 std Y+45, r25 ; 0x2d |
e7c: ae a7 std Y+46, r26 ; 0x2e |
e7e: bf a7 std Y+47, r27 ; 0x2f |
e80: 0e c0 rjmp .+28 ; 0xe9e <_printf_P+0xd8> |
} else { |
register unsigned int _d; |
_d=va_arg(ap, unsigned int); |
e82: f3 01 movw r30, r6 |
e84: a2 e0 ldi r26, 0x02 ; 2 |
e86: b0 e0 ldi r27, 0x00 ; 0 |
e88: 6a 0e add r6, r26 |
e8a: 7b 1e adc r7, r27 |
e8c: 80 81 ld r24, Z |
e8e: 91 81 ldd r25, Z+1 ; 0x01 |
_ulong = flags&SHORTINT ? (unsigned long)(unsigned short)_d : (unsigned long)_d; |
e90: 9c 01 movw r18, r24 |
e92: 44 27 eor r20, r20 |
e94: 55 27 eor r21, r21 |
e96: 2c a7 std Y+44, r18 ; 0x2c |
e98: 3d a7 std Y+45, r19 ; 0x2d |
e9a: 4e a7 std Y+46, r20 ; 0x2e |
e9c: 5f a7 std Y+47, r21 ; 0x2f |
} |
} |
#ifndef LIGHTPRINTF |
if(ch==' ') { |
e9e: 00 32 cpi r16, 0x20 ; 32 |
ea0: 21 f4 brne .+8 ; 0xeaa <_printf_P+0xe4> |
/* |
* ``If the space and + flags both appear, the space |
* flag will be ignored.'' |
* -- ANSI X3J11 |
*/ |
if (!sign) |
ea2: 89 a5 ldd r24, Y+41 ; 0x29 |
ea4: 88 23 and r24, r24 |
ea6: 91 f6 brne .-92 ; 0xe4c <_printf_P+0x86> |
ea8: 1b c0 rjmp .+54 ; 0xee0 <_printf_P+0x11a> |
sign = ' '; |
goto rflag; |
} else if (ch=='#') { |
eaa: 03 32 cpi r16, 0x23 ; 35 |
eac: 11 f4 brne .+4 ; 0xeb2 <_printf_P+0xec> |
flags |= ALT; |
eae: 38 e0 ldi r19, 0x08 ; 8 |
eb0: 81 c0 rjmp .+258 ; 0xfb4 <_printf_P+0x1ee> |
goto rflag; |
} else if (ch=='*'||ch=='-') { |
eb2: 0a 32 cpi r16, 0x2A ; 42 |
eb4: 11 f0 breq .+4 ; 0xeba <_printf_P+0xf4> |
eb6: 0d 32 cpi r16, 0x2D ; 45 |
eb8: 89 f4 brne .+34 ; 0xedc <_printf_P+0x116> |
if (ch=='*') { |
eba: 0a 32 cpi r16, 0x2A ; 42 |
ebc: 51 f4 brne .+20 ; 0xed2 <_printf_P+0x10c> |
/* |
* ``A negative field width argument is taken as a |
* - flag followed by a positive field width.'' |
* -- ANSI X3J11 |
* They don't exclude field widths read from args. |
*/ |
if ((width = va_arg(ap, int)) >= 0) |
ebe: f3 01 movw r30, r6 |
ec0: 42 e0 ldi r20, 0x02 ; 2 |
ec2: 50 e0 ldi r21, 0x00 ; 0 |
ec4: 64 0e add r6, r20 |
ec6: 75 1e adc r7, r21 |
ec8: 20 80 ld r2, Z |
eca: 22 20 and r2, r2 |
ecc: 0c f0 brlt .+2 ; 0xed0 <_printf_P+0x10a> |
ece: be cf rjmp .-132 ; 0xe4c <_printf_P+0x86> |
goto rflag; |
width = -width; |
ed0: 21 94 neg r2 |
} |
flags |= LADJUST; |
ed2: 50 e1 ldi r21, 0x10 ; 16 |
ed4: 55 2a or r5, r21 |
flags &= ~ZEROPAD; /* '-' disables '0' */ |
ed6: 8f ed ldi r24, 0xDF ; 223 |
ed8: 58 22 and r5, r24 |
goto rflag; |
eda: b8 cf rjmp .-144 ; 0xe4c <_printf_P+0x86> |
} else if (ch=='+') { |
edc: 0b 32 cpi r16, 0x2B ; 43 |
ede: 11 f4 brne .+4 ; 0xee4 <_printf_P+0x11e> |
sign = '+'; |
ee0: 09 a7 std Y+41, r16 ; 0x29 |
goto rflag; |
ee2: b4 cf rjmp .-152 ; 0xe4c <_printf_P+0x86> |
} else if (ch=='.') { |
ee4: 0e 32 cpi r16, 0x2E ; 46 |
ee6: c1 f5 brne .+112 ; 0xf58 <_printf_P+0x192> |
if ((ch = PRG_RDB(fmt++)) == '*') { |
ee8: f5 01 movw r30, r10 |
eea: 08 94 sec |
eec: a1 1c adc r10, r1 |
eee: b1 1c adc r11, r1 |
ef0: 04 91 lpm r16, Z |
ef2: 0a 32 cpi r16, 0x2A ; 42 |
ef4: 79 f4 brne .+30 ; 0xf14 <_printf_P+0x14e> |
n = va_arg(ap, int); |
ef6: f3 01 movw r30, r6 |
ef8: a2 e0 ldi r26, 0x02 ; 2 |
efa: b0 e0 ldi r27, 0x00 ; 0 |
efc: 6a 0e add r6, r26 |
efe: 7b 1e adc r7, r27 |
f00: 60 81 ld r22, Z |
f02: 71 81 ldd r23, Z+1 ; 0x01 |
prec = n < 0 ? -1 : n; |
f04: bf ef ldi r27, 0xFF ; 255 |
f06: 6f 3f cpi r22, 0xFF ; 255 |
f08: 7b 07 cpc r23, r27 |
f0a: 14 f4 brge .+4 ; 0xf10 <_printf_P+0x14a> |
f0c: 6f ef ldi r22, 0xFF ; 255 |
f0e: 7f ef ldi r23, 0xFF ; 255 |
f10: 16 2f mov r17, r22 |
goto rflag; |
f12: 9c cf rjmp .-200 ; 0xe4c <_printf_P+0x86> |
} |
n = 0; |
f14: 60 e0 ldi r22, 0x00 ; 0 |
f16: 70 e0 ldi r23, 0x00 ; 0 |
while (is_digit(ch)) { |
n = n*10 + to_digit(ch); |
ch = PRG_RDB(fmt++); |
f18: 80 2f mov r24, r16 |
f1a: 80 53 subi r24, 0x30 ; 48 |
f1c: 8a 30 cpi r24, 0x0A ; 10 |
f1e: a0 f4 brcc .+40 ; 0xf48 <_printf_P+0x182> |
f20: cb 01 movw r24, r22 |
f22: f3 e0 ldi r31, 0x03 ; 3 |
f24: 88 0f add r24, r24 |
f26: 99 1f adc r25, r25 |
f28: fa 95 dec r31 |
f2a: e1 f7 brne .-8 ; 0xf24 <_printf_P+0x15e> |
f2c: 86 0f add r24, r22 |
f2e: 97 1f adc r25, r23 |
f30: 68 0f add r22, r24 |
f32: 79 1f adc r23, r25 |
f34: 60 0f add r22, r16 |
f36: 71 1d adc r23, r1 |
f38: 60 53 subi r22, 0x30 ; 48 |
f3a: 70 40 sbci r23, 0x00 ; 0 |
f3c: f5 01 movw r30, r10 |
f3e: 08 94 sec |
f40: a1 1c adc r10, r1 |
f42: b1 1c adc r11, r1 |
f44: 04 91 lpm r16, Z |
f46: e8 cf rjmp .-48 ; 0xf18 <_printf_P+0x152> |
} |
prec = n < 0 ? -1 : n; |
f48: ef ef ldi r30, 0xFF ; 255 |
f4a: 6f 3f cpi r22, 0xFF ; 255 |
f4c: 7e 07 cpc r23, r30 |
f4e: 14 f4 brge .+4 ; 0xf54 <_printf_P+0x18e> |
f50: 6f ef ldi r22, 0xFF ; 255 |
f52: 7f ef ldi r23, 0xFF ; 255 |
f54: 16 2f mov r17, r22 |
goto reswitch; |
f56: 7f cf rjmp .-258 ; 0xe56 <_printf_P+0x90> |
} else |
#endif /* LIGHTPRINTF */ |
if (ch=='0') { |
f58: 00 33 cpi r16, 0x30 ; 48 |
f5a: 29 f4 brne .+10 ; 0xf66 <_printf_P+0x1a0> |
/* |
* ``Note that 0 is taken as a flag, not as the |
* beginning of a field width.'' |
* -- ANSI X3J11 |
*/ |
if (!(flags & LADJUST)) |
f5c: 54 fc sbrc r5, 4 |
f5e: 76 cf rjmp .-276 ; 0xe4c <_printf_P+0x86> |
flags |= ZEROPAD; /* '-' disables '0' */ |
f60: f0 e2 ldi r31, 0x20 ; 32 |
f62: 5f 2a or r5, r31 |
goto rflag; |
f64: 73 cf rjmp .-282 ; 0xe4c <_printf_P+0x86> |
} else if (ch>='1' && ch<='9') { |
f66: 80 2f mov r24, r16 |
f68: 81 53 subi r24, 0x31 ; 49 |
f6a: 89 30 cpi r24, 0x09 ; 9 |
f6c: d8 f4 brcc .+54 ; 0xfa4 <_printf_P+0x1de> |
n = 0; |
f6e: 60 e0 ldi r22, 0x00 ; 0 |
f70: 70 e0 ldi r23, 0x00 ; 0 |
do { |
n = 10 * n + to_digit(ch); |
f72: cb 01 movw r24, r22 |
f74: e3 e0 ldi r30, 0x03 ; 3 |
f76: 88 0f add r24, r24 |
f78: 99 1f adc r25, r25 |
f7a: ea 95 dec r30 |
f7c: e1 f7 brne .-8 ; 0xf76 <_printf_P+0x1b0> |
f7e: 86 0f add r24, r22 |
f80: 97 1f adc r25, r23 |
f82: 68 0f add r22, r24 |
f84: 79 1f adc r23, r25 |
f86: 60 0f add r22, r16 |
f88: 71 1d adc r23, r1 |
f8a: 60 53 subi r22, 0x30 ; 48 |
f8c: 70 40 sbci r23, 0x00 ; 0 |
ch = PRG_RDB(fmt++); |
f8e: f5 01 movw r30, r10 |
f90: 08 94 sec |
f92: a1 1c adc r10, r1 |
f94: b1 1c adc r11, r1 |
f96: 04 91 lpm r16, Z |
} while (is_digit(ch)); |
f98: 80 2f mov r24, r16 |
f9a: 80 53 subi r24, 0x30 ; 48 |
f9c: 8a 30 cpi r24, 0x0A ; 10 |
f9e: 48 f3 brcs .-46 ; 0xf72 <_printf_P+0x1ac> |
width = n; |
fa0: 26 2e mov r2, r22 |
goto reswitch; |
fa2: 59 cf rjmp .-334 ; 0xe56 <_printf_P+0x90> |
} else if (ch=='h') { |
fa4: 08 36 cpi r16, 0x68 ; 104 |
fa6: 19 f4 brne .+6 ; 0xfae <_printf_P+0x1e8> |
flags |= SHORTINT; |
fa8: 24 e0 ldi r18, 0x04 ; 4 |
faa: 52 2a or r5, r18 |
goto rflag; |
fac: 4f cf rjmp .-354 ; 0xe4c <_printf_P+0x86> |
} else if (ch=='l') { |
fae: 0c 36 cpi r16, 0x6C ; 108 |
fb0: 19 f4 brne .+6 ; 0xfb8 <_printf_P+0x1f2> |
flags |= LONGINT; |
fb2: 31 e0 ldi r19, 0x01 ; 1 |
fb4: 53 2a or r5, r19 |
goto rflag; |
fb6: 4a cf rjmp .-364 ; 0xe4c <_printf_P+0x86> |
} else if (ch=='c') { |
fb8: 03 36 cpi r16, 0x63 ; 99 |
fba: 61 f4 brne .+24 ; 0xfd4 <_printf_P+0x20e> |
*(cp = buf) = va_arg(ap, int); |
fbc: 4e 01 movw r8, r28 |
fbe: 08 94 sec |
fc0: 81 1c adc r8, r1 |
fc2: 91 1c adc r9, r1 |
fc4: f3 01 movw r30, r6 |
fc6: 42 e0 ldi r20, 0x02 ; 2 |
fc8: 50 e0 ldi r21, 0x00 ; 0 |
fca: 64 0e add r6, r20 |
fcc: 75 1e adc r7, r21 |
fce: 80 81 ld r24, Z |
fd0: 89 83 std Y+1, r24 ; 0x01 |
fd2: 1b c1 rjmp .+566 ; 0x120a <_printf_P+0x444> |
size = 1; |
sign = '\0'; |
} else if (ch=='D'||ch=='d'||ch=='i') { |
fd4: 04 34 cpi r16, 0x44 ; 68 |
fd6: 21 f0 breq .+8 ; 0xfe0 <_printf_P+0x21a> |
fd8: 04 36 cpi r16, 0x64 ; 100 |
fda: 11 f0 breq .+4 ; 0xfe0 <_printf_P+0x21a> |
fdc: 09 36 cpi r16, 0x69 ; 105 |
fde: b1 f5 brne .+108 ; 0x104c <_printf_P+0x286> |
if(ch=='D') |
fe0: 04 34 cpi r16, 0x44 ; 68 |
fe2: 11 f4 brne .+4 ; 0xfe8 <_printf_P+0x222> |
flags |= LONGINT; |
fe4: 51 e0 ldi r21, 0x01 ; 1 |
fe6: 55 2a or r5, r21 |
if (flags&LONGINT) { |
fe8: 50 fe sbrs r5, 0 |
fea: 0a c0 rjmp .+20 ; 0x1000 <_printf_P+0x23a> |
_ulong=va_arg(ap, long); |
fec: f3 01 movw r30, r6 |
fee: 84 e0 ldi r24, 0x04 ; 4 |
ff0: 90 e0 ldi r25, 0x00 ; 0 |
ff2: 68 0e add r6, r24 |
ff4: 79 1e adc r7, r25 |
ff6: 20 81 ld r18, Z |
ff8: 31 81 ldd r19, Z+1 ; 0x01 |
ffa: 42 81 ldd r20, Z+2 ; 0x02 |
ffc: 53 81 ldd r21, Z+3 ; 0x03 |
ffe: 0c c0 rjmp .+24 ; 0x1018 <_printf_P+0x252> |
} else { |
register int _d; |
_d=va_arg(ap, int); |
1000: f3 01 movw r30, r6 |
1002: 42 e0 ldi r20, 0x02 ; 2 |
1004: 50 e0 ldi r21, 0x00 ; 0 |
1006: 64 0e add r6, r20 |
1008: 75 1e adc r7, r21 |
100a: 80 81 ld r24, Z |
100c: 91 81 ldd r25, Z+1 ; 0x01 |
_ulong = flags&SHORTINT ? (long)(short)_d : (long)_d; |
100e: 9c 01 movw r18, r24 |
1010: 44 27 eor r20, r20 |
1012: 37 fd sbrc r19, 7 |
1014: 40 95 com r20 |
1016: 54 2f mov r21, r20 |
1018: 2c a7 std Y+44, r18 ; 0x2c |
101a: 3d a7 std Y+45, r19 ; 0x2d |
101c: 4e a7 std Y+46, r20 ; 0x2e |
101e: 5f a7 std Y+47, r21 ; 0x2f |
} |
if ((long)_ulong < 0) { |
1020: 8c a5 ldd r24, Y+44 ; 0x2c |
1022: 9d a5 ldd r25, Y+45 ; 0x2d |
1024: ae a5 ldd r26, Y+46 ; 0x2e |
1026: bf a5 ldd r27, Y+47 ; 0x2f |
1028: b7 ff sbrs r27, 7 |
102a: 0d c0 rjmp .+26 ; 0x1046 <_printf_P+0x280> |
_ulong = -_ulong; |
102c: b0 95 com r27 |
102e: a0 95 com r26 |
1030: 90 95 com r25 |
1032: 81 95 neg r24 |
1034: 9f 4f sbci r25, 0xFF ; 255 |
1036: af 4f sbci r26, 0xFF ; 255 |
1038: bf 4f sbci r27, 0xFF ; 255 |
103a: 8c a7 std Y+44, r24 ; 0x2c |
103c: 9d a7 std Y+45, r25 ; 0x2d |
103e: ae a7 std Y+46, r26 ; 0x2e |
1040: bf a7 std Y+47, r27 ; 0x2f |
sign = '-'; |
1042: 8d e2 ldi r24, 0x2D ; 45 |
1044: 89 a7 std Y+41, r24 ; 0x29 |
} |
base = DEC; |
1046: 7a e0 ldi r23, 0x0A ; 10 |
1048: 47 2e mov r4, r23 |
goto number; |
104a: 7b c0 rjmp .+246 ; 0x1142 <_printf_P+0x37c> |
} else |
/* |
if (ch=='n') { |
if (flags & LONGINT) |
*va_arg(ap, long *) = ret; |
else if (flags & SHORTINT) |
*va_arg(ap, short *) = ret; |
else |
*va_arg(ap, int *) = ret; |
continue; // no output |
} else |
*/ |
#ifndef LIGHTPRINTF |
if (ch=='O'||ch=='o') { |
104c: 0f 34 cpi r16, 0x4F ; 79 |
104e: 11 f0 breq .+4 ; 0x1054 <_printf_P+0x28e> |
1050: 0f 36 cpi r16, 0x6F ; 111 |
1052: 39 f4 brne .+14 ; 0x1062 <_printf_P+0x29c> |
if (ch=='O') |
1054: 0f 34 cpi r16, 0x4F ; 79 |
1056: 11 f4 brne .+4 ; 0x105c <_printf_P+0x296> |
flags |= LONGINT; |
1058: 91 e0 ldi r25, 0x01 ; 1 |
105a: 59 2a or r5, r25 |
base = OCT; |
105c: 68 e0 ldi r22, 0x08 ; 8 |
105e: 46 2e mov r4, r22 |
goto nosign; |
1060: 6f c0 rjmp .+222 ; 0x1140 <_printf_P+0x37a> |
} else if (ch=='p') { |
1062: 00 37 cpi r16, 0x70 ; 112 |
1064: a1 f4 brne .+40 ; 0x108e <_printf_P+0x2c8> |
/* |
* ``The argument shall be a pointer to void. The |
* value of the pointer is converted to a sequence |
* of printable characters, in an implementation- |
* defined manner.'' |
* -- ANSI X3J11 |
*/ |
/* NOSTRICT */ |
_ulong = (unsigned int)va_arg(ap, void *); |
1066: f3 01 movw r30, r6 |
1068: a2 e0 ldi r26, 0x02 ; 2 |
106a: b0 e0 ldi r27, 0x00 ; 0 |
106c: 6a 0e add r6, r26 |
106e: 7b 1e adc r7, r27 |
1070: 80 81 ld r24, Z |
1072: 91 81 ldd r25, Z+1 ; 0x01 |
1074: 9c 01 movw r18, r24 |
1076: 44 27 eor r20, r20 |
1078: 55 27 eor r21, r21 |
107a: 2c a7 std Y+44, r18 ; 0x2c |
107c: 3d a7 std Y+45, r19 ; 0x2d |
107e: 4e a7 std Y+46, r20 ; 0x2e |
1080: 5f a7 std Y+47, r21 ; 0x2f |
base = HEX; |
1082: 50 e1 ldi r21, 0x10 ; 16 |
1084: 45 2e mov r4, r21 |
flags |= HEXPREFIX; |
1086: 30 e4 ldi r19, 0x40 ; 64 |
1088: 53 2a or r5, r19 |
ch = 'x'; |
108a: 08 e7 ldi r16, 0x78 ; 120 |
goto nosign; |
108c: 59 c0 rjmp .+178 ; 0x1140 <_printf_P+0x37a> |
} else if (ch=='s') { // print a string from RAM |
108e: 03 37 cpi r16, 0x73 ; 115 |
1090: c1 f5 brne .+112 ; 0x1102 <_printf_P+0x33c> |
if ((cp = va_arg(ap, char *)) == NULL) { |
1092: f3 01 movw r30, r6 |
1094: 42 e0 ldi r20, 0x02 ; 2 |
1096: 50 e0 ldi r21, 0x00 ; 0 |
1098: 64 0e add r6, r20 |
109a: 75 1e adc r7, r21 |
109c: 80 80 ld r8, Z |
109e: 91 80 ldd r9, Z+1 ; 0x01 |
10a0: 81 14 cp r8, r1 |
10a2: 91 04 cpc r9, r1 |
10a4: 89 f4 brne .+34 ; 0x10c8 <_printf_P+0x302> |
cp=buf; |
10a6: 4e 01 movw r8, r28 |
10a8: 08 94 sec |
10aa: 81 1c adc r8, r1 |
10ac: 91 1c adc r9, r1 |
cp[0] = '('; |
10ae: 88 e2 ldi r24, 0x28 ; 40 |
10b0: 89 83 std Y+1, r24 ; 0x01 |
cp[1] = 'n'; |
10b2: 8e e6 ldi r24, 0x6E ; 110 |
10b4: f4 01 movw r30, r8 |
10b6: 81 83 std Z+1, r24 ; 0x01 |
cp[2] = 'u'; |
10b8: 85 e7 ldi r24, 0x75 ; 117 |
10ba: 8b 83 std Y+3, r24 ; 0x03 |
cp[4] = cp[3] = 'l'; |
10bc: 8c e6 ldi r24, 0x6C ; 108 |
10be: 8c 83 std Y+4, r24 ; 0x04 |
10c0: 8d 83 std Y+5, r24 ; 0x05 |
cp[5] = ')'; |
10c2: 89 e2 ldi r24, 0x29 ; 41 |
10c4: 8e 83 std Y+6, r24 ; 0x06 |
cp[6] = '\0'; |
10c6: 1f 82 std Y+7, r1 ; 0x07 |
} |
if (prec >= 0) { |
10c8: 17 fd sbrc r17, 7 |
10ca: 13 c0 rjmp .+38 ; 0x10f2 <_printf_P+0x32c> |
/* |
* can't use strlen; can only look for the |
* NUL in the first `prec' characters, and |
* strlen() will go further. |
*/ |
char *p = (char*)memchr(cp, 0, prec); |
10cc: 81 2f mov r24, r17 |
10ce: 99 27 eor r25, r25 |
10d0: 87 fd sbrc r24, 7 |
10d2: 90 95 com r25 |
10d4: ac 01 movw r20, r24 |
10d6: 60 e0 ldi r22, 0x00 ; 0 |
10d8: 70 e0 ldi r23, 0x00 ; 0 |
10da: c4 01 movw r24, r8 |
10dc: 0e 94 64 0c call 0x18c8 <memchr> |
if (p != NULL) { |
10e0: 00 97 sbiw r24, 0x00 ; 0 |
10e2: 29 f0 breq .+10 ; 0x10ee <_printf_P+0x328> |
size = p - cp; |
10e4: d8 2e mov r13, r24 |
10e6: d8 18 sub r13, r8 |
if (size > prec) |
10e8: 1d 15 cp r17, r13 |
10ea: 0c f0 brlt .+2 ; 0x10ee <_printf_P+0x328> |
10ec: 90 c0 rjmp .+288 ; 0x120e <_printf_P+0x448> |
size = prec; |
} else |
size = prec; |
10ee: d1 2e mov r13, r17 |
10f0: 8e c0 rjmp .+284 ; 0x120e <_printf_P+0x448> |
} else |
size = strlen(cp); |
10f2: f4 01 movw r30, r8 |
10f4: 01 90 ld r0, Z+ |
10f6: 00 20 and r0, r0 |
10f8: e9 f7 brne .-6 ; 0x10f4 <_printf_P+0x32e> |
10fa: 31 97 sbiw r30, 0x01 ; 1 |
10fc: de 2e mov r13, r30 |
10fe: d8 18 sub r13, r8 |
1100: 86 c0 rjmp .+268 ; 0x120e <_printf_P+0x448> |
sign = '\0'; |
} else |
#endif /* LIGHTPRINTF */ |
if(ch=='U'||ch=='u') { |
1102: 05 35 cpi r16, 0x55 ; 85 |
1104: 11 f0 breq .+4 ; 0x110a <_printf_P+0x344> |
1106: 05 37 cpi r16, 0x75 ; 117 |
1108: 39 f4 brne .+14 ; 0x1118 <_printf_P+0x352> |
if (ch=='U') |
110a: 05 35 cpi r16, 0x55 ; 85 |
110c: 11 f4 brne .+4 ; 0x1112 <_printf_P+0x34c> |
flags |= LONGINT; |
110e: f1 e0 ldi r31, 0x01 ; 1 |
1110: 5f 2a or r5, r31 |
base = DEC; |
1112: 4a e0 ldi r20, 0x0A ; 10 |
1114: 44 2e mov r4, r20 |
goto nosign; |
1116: 14 c0 rjmp .+40 ; 0x1140 <_printf_P+0x37a> |
} else if (ch=='X'||ch=='x') { |
1118: 08 35 cpi r16, 0x58 ; 88 |
111a: 19 f0 breq .+6 ; 0x1122 <_printf_P+0x35c> |
111c: 08 37 cpi r16, 0x78 ; 120 |
111e: 09 f0 breq .+2 ; 0x1122 <_printf_P+0x35c> |
1120: 6c c0 rjmp .+216 ; 0x11fa <_printf_P+0x434> |
base = HEX; |
1122: 30 e1 ldi r19, 0x10 ; 16 |
1124: 43 2e mov r4, r19 |
/* leading 0x/X only if non-zero */ |
if (flags & ALT && _ulong != 0) |
1126: 53 fe sbrs r5, 3 |
1128: 0b c0 rjmp .+22 ; 0x1140 <_printf_P+0x37a> |
112a: 2c a5 ldd r18, Y+44 ; 0x2c |
112c: 3d a5 ldd r19, Y+45 ; 0x2d |
112e: 4e a5 ldd r20, Y+46 ; 0x2e |
1130: 5f a5 ldd r21, Y+47 ; 0x2f |
1132: 21 15 cp r18, r1 |
1134: 31 05 cpc r19, r1 |
1136: 41 05 cpc r20, r1 |
1138: 51 05 cpc r21, r1 |
113a: 11 f0 breq .+4 ; 0x1140 <_printf_P+0x37a> |
flags |= HEXPREFIX; |
113c: 30 e4 ldi r19, 0x40 ; 64 |
113e: 53 2a or r5, r19 |
/* unsigned conversions */ |
nosign: sign = '\0'; |
1140: 19 a6 std Y+41, r1 ; 0x29 |
/* |
* ``... diouXx conversions ... if a precision is |
* specified, the 0 flag will be ignored.'' |
* -- ANSI X3J11 |
*/ |
number: if ((dprec = prec) >= 0) |
1142: 18 ab std Y+48, r17 ; 0x30 |
1144: 17 fd sbrc r17, 7 |
1146: 02 c0 rjmp .+4 ; 0x114c <_printf_P+0x386> |
flags &= ~ZEROPAD; |
1148: 4f ed ldi r20, 0xDF ; 223 |
114a: 54 22 and r5, r20 |
/* |
* ``The result of converting a zero value with an |
* explicit precision of zero is no characters.'' |
* -- ANSI X3J11 |
*/ |
cp = buf + BUF; |
114c: 29 e2 ldi r18, 0x29 ; 41 |
114e: 82 2e mov r8, r18 |
1150: 91 2c mov r9, r1 |
1152: 8c 0e add r8, r28 |
1154: 9d 1e adc r9, r29 |
if (_ulong != 0 || prec != 0) { |
1156: 8c a5 ldd r24, Y+44 ; 0x2c |
1158: 9d a5 ldd r25, Y+45 ; 0x2d |
115a: ae a5 ldd r26, Y+46 ; 0x2e |
115c: bf a5 ldd r27, Y+47 ; 0x2f |
115e: 00 97 sbiw r24, 0x00 ; 0 |
1160: a1 05 cpc r26, r1 |
1162: b1 05 cpc r27, r1 |
1164: 21 f4 brne .+8 ; 0x116e <_printf_P+0x3a8> |
1166: 98 a9 ldd r25, Y+48 ; 0x30 |
1168: 99 23 and r25, r25 |
116a: 09 f4 brne .+2 ; 0x116e <_printf_P+0x3a8> |
116c: 3f c0 rjmp .+126 ; 0x11ec <_printf_P+0x426> |
116e: c4 2c mov r12, r4 |
1170: dd 24 eor r13, r13 |
1172: ee 24 eor r14, r14 |
1174: ff 24 eor r15, r15 |
register unsigned char _d,notlastdigit; |
do { |
notlastdigit=(_ulong>=base); |
1176: 33 24 eor r3, r3 |
1178: 2c a5 ldd r18, Y+44 ; 0x2c |
117a: 3d a5 ldd r19, Y+45 ; 0x2d |
117c: 4e a5 ldd r20, Y+46 ; 0x2e |
117e: 5f a5 ldd r21, Y+47 ; 0x2f |
1180: 2c 15 cp r18, r12 |
1182: 3d 05 cpc r19, r13 |
1184: 4e 05 cpc r20, r14 |
1186: 5f 05 cpc r21, r15 |
1188: 10 f0 brcs .+4 ; 0x118e <_printf_P+0x3c8> |
118a: 91 e0 ldi r25, 0x01 ; 1 |
118c: 39 2e mov r3, r25 |
_d = _ulong % base; |
118e: 6c a5 ldd r22, Y+44 ; 0x2c |
1190: 7d a5 ldd r23, Y+45 ; 0x2d |
1192: 8e a5 ldd r24, Y+46 ; 0x2e |
1194: 9f a5 ldd r25, Y+47 ; 0x2f |
1196: a7 01 movw r20, r14 |
1198: 96 01 movw r18, r12 |
119a: 0e 94 d4 0d call 0x1ba8 <__udivmodsi4> |
119e: dc 01 movw r26, r24 |
11a0: cb 01 movw r24, r22 |
11a2: 18 2f mov r17, r24 |
if (_d<10) { |
11a4: 8a 30 cpi r24, 0x0A ; 10 |
11a6: 10 f4 brcc .+4 ; 0x11ac <_printf_P+0x3e6> |
_d+='0'; |
11a8: 10 5d subi r17, 0xD0 ; 208 |
11aa: 04 c0 rjmp .+8 ; 0x11b4 <_printf_P+0x3ee> |
} else { |
_d+='a'-10; |
11ac: 19 5a subi r17, 0xA9 ; 169 |
if (ch=='X') _d&=~0x20; |
11ae: 08 35 cpi r16, 0x58 ; 88 |
11b0: 09 f4 brne .+2 ; 0x11b4 <_printf_P+0x3ee> |
11b2: 1f 7d andi r17, 0xDF ; 223 |
} |
*--cp=_d; |
11b4: d4 01 movw r26, r8 |
11b6: 1e 93 st -X, r17 |
11b8: 4d 01 movw r8, r26 |
_ulong /= base; |
11ba: 6c a5 ldd r22, Y+44 ; 0x2c |
11bc: 7d a5 ldd r23, Y+45 ; 0x2d |
11be: 8e a5 ldd r24, Y+46 ; 0x2e |
11c0: 9f a5 ldd r25, Y+47 ; 0x2f |
11c2: a7 01 movw r20, r14 |
11c4: 96 01 movw r18, r12 |
11c6: 0e 94 d4 0d call 0x1ba8 <__udivmodsi4> |
11ca: 2c a7 std Y+44, r18 ; 0x2c |
11cc: 3d a7 std Y+45, r19 ; 0x2d |
11ce: 4e a7 std Y+46, r20 ; 0x2e |
11d0: 5f a7 std Y+47, r21 ; 0x2f |
} while (notlastdigit); |
11d2: 33 20 and r3, r3 |
11d4: 81 f6 brne .-96 ; 0x1176 <_printf_P+0x3b0> |
#ifndef LIGHTPRINTF |
// handle octal leading 0 |
if (base==OCT && flags & ALT && *cp != '0') |
11d6: b8 e0 ldi r27, 0x08 ; 8 |
11d8: 4b 16 cp r4, r27 |
11da: 41 f4 brne .+16 ; 0x11ec <_printf_P+0x426> |
11dc: 53 fe sbrs r5, 3 |
11de: 06 c0 rjmp .+12 ; 0x11ec <_printf_P+0x426> |
11e0: 10 33 cpi r17, 0x30 ; 48 |
11e2: 21 f0 breq .+8 ; 0x11ec <_printf_P+0x426> |
*--cp = '0'; |
11e4: 80 e3 ldi r24, 0x30 ; 48 |
11e6: f4 01 movw r30, r8 |
11e8: 82 93 st -Z, r24 |
11ea: 4f 01 movw r8, r30 |
#endif |
} |
size = buf + BUF - cp; |
11ec: ce 01 movw r24, r28 |
11ee: 01 96 adiw r24, 0x01 ; 1 |
11f0: d8 2e mov r13, r24 |
11f2: d8 18 sub r13, r8 |
11f4: f8 e2 ldi r31, 0x28 ; 40 |
11f6: df 0e add r13, r31 |
11f8: 0b c0 rjmp .+22 ; 0x1210 <_printf_P+0x44a> |
} else { //default |
/* "%?" prints ?, unless ? is NUL */ |
if (ch == '\0') |
11fa: 00 23 and r16, r16 |
11fc: 09 f4 brne .+2 ; 0x1200 <_printf_P+0x43a> |
11fe: 4e c0 rjmp .+156 ; 0x129c <_printf_P+0x4d6> |
goto done; |
/* pretend it was %c with argument ch */ |
cp = buf; |
1200: 4e 01 movw r8, r28 |
1202: 08 94 sec |
1204: 81 1c adc r8, r1 |
1206: 91 1c adc r9, r1 |
*cp = ch; |
1208: 09 83 std Y+1, r16 ; 0x01 |
size = 1; |
120a: 81 e0 ldi r24, 0x01 ; 1 |
120c: d8 2e mov r13, r24 |
sign = '\0'; |
120e: 19 a6 std Y+41, r1 ; 0x29 |
} |
/* |
* All reasonable formats wind up here. At this point, |
* `cp' points to a string which (if not flags&LADJUST) |
* should be padded out to `width' places. If |
* flags&ZEROPAD, it should first be prefixed by any |
* sign or other prefix; otherwise, it should be blank |
* padded before the prefix is emitted. After any |
* left-hand padding and prefixing, emit zeroes |
* required by a decimal [diouxX] precision, then print |
* the string proper, then emit zeroes required by any |
* leftover floating precision; finally, if LADJUST, |
* pad with blanks. |
*/ |
/* |
* compute actual size, so we know how much to pad. |
*/ |
fieldsz = size; |
1210: 1d 2d mov r17, r13 |
dpad = dprec - size; |
1212: c8 a8 ldd r12, Y+48 ; 0x30 |
1214: cd 18 sub r12, r13 |
if (dpad < 0) |
1216: c7 fc sbrc r12, 7 |
dpad = 0; |
1218: cc 24 eor r12, r12 |
if (sign) |
121a: 89 a5 ldd r24, Y+41 ; 0x29 |
121c: 88 23 and r24, r24 |
121e: 11 f0 breq .+4 ; 0x1224 <_printf_P+0x45e> |
fieldsz++; |
1220: 1f 5f subi r17, 0xFF ; 255 |
1222: 02 c0 rjmp .+4 ; 0x1228 <_printf_P+0x462> |
else if (flags & HEXPREFIX) |
1224: 56 fc sbrc r5, 6 |
fieldsz += 2; |
1226: 1e 5f subi r17, 0xFE ; 254 |
fieldsz += dpad; |
1228: 1c 0d add r17, r12 |
/* right-adjusting blank padding */ |
if ((flags & (LADJUST|ZEROPAD)) == 0) |
122a: e5 2c mov r14, r5 |
122c: ff 24 eor r15, r15 |
122e: c7 01 movw r24, r14 |
1230: 80 73 andi r24, 0x30 ; 48 |
1232: 90 70 andi r25, 0x00 ; 0 |
1234: 89 2b or r24, r25 |
1236: 21 f4 brne .+8 ; 0x1240 <_printf_P+0x47a> |
PAD_SP(width - fieldsz); |
1238: 82 2d mov r24, r2 |
123a: 81 1b sub r24, r17 |
123c: 0e 94 cb 06 call 0xd96 <PAD_SP> |
/* prefix */ |
if (sign) { |
1240: 89 a5 ldd r24, Y+41 ; 0x29 |
1242: 88 23 and r24, r24 |
1244: 29 f0 breq .+10 ; 0x1250 <_printf_P+0x48a> |
PRINT(&sign, 1); |
1246: 61 e0 ldi r22, 0x01 ; 1 |
1248: 70 e0 ldi r23, 0x00 ; 0 |
124a: ce 01 movw r24, r28 |
124c: 89 96 adiw r24, 0x29 ; 41 |
124e: 09 c0 rjmp .+18 ; 0x1262 <_printf_P+0x49c> |
} else if (flags & HEXPREFIX) { |
1250: e6 fe sbrs r14, 6 |
1252: 09 c0 rjmp .+18 ; 0x1266 <_printf_P+0x4a0> |
ox[0] = '0'; |
1254: 80 e3 ldi r24, 0x30 ; 48 |
1256: 8a a7 std Y+42, r24 ; 0x2a |
ox[1] = ch; |
1258: 0b a7 std Y+43, r16 ; 0x2b |
PRINT(ox, 2); |
125a: 62 e0 ldi r22, 0x02 ; 2 |
125c: 70 e0 ldi r23, 0x00 ; 0 |
125e: ce 01 movw r24, r28 |
1260: 8a 96 adiw r24, 0x2a ; 42 |
1262: 0e 94 a2 06 call 0xd44 <PRINT> |
} |
/* right-adjusting zero padding */ |
if ((flags & (LADJUST|ZEROPAD)) == ZEROPAD) |
1266: c7 01 movw r24, r14 |
1268: 80 73 andi r24, 0x30 ; 48 |
126a: 90 70 andi r25, 0x00 ; 0 |
126c: 80 97 sbiw r24, 0x20 ; 32 |
126e: 21 f4 brne .+8 ; 0x1278 <_printf_P+0x4b2> |
PAD_0(width - fieldsz); |
1270: 82 2d mov r24, r2 |
1272: 81 1b sub r24, r17 |
1274: 0e 94 d7 06 call 0xdae <PAD_0> |
/* leading zeroes from decimal precision */ |
PAD_0(dpad); |
1278: 8c 2d mov r24, r12 |
127a: 0e 94 d7 06 call 0xdae <PAD_0> |
/* the string or number proper */ |
PRINT(cp, size); |
127e: 8d 2d mov r24, r13 |
1280: 99 27 eor r25, r25 |
1282: 87 fd sbrc r24, 7 |
1284: 90 95 com r25 |
1286: bc 01 movw r22, r24 |
1288: c4 01 movw r24, r8 |
128a: 0e 94 a2 06 call 0xd44 <PRINT> |
/* left-adjusting padding (always blank) */ |
if (flags & LADJUST) |
128e: e4 fe sbrs r14, 4 |
1290: c1 cd rjmp .-1150 ; 0xe14 <_printf_P+0x4e> |
PAD_SP(width - fieldsz); |
1292: 82 2d mov r24, r2 |
1294: 81 1b sub r24, r17 |
1296: 0e 94 cb 06 call 0xd96 <PAD_SP> |
129a: bc cd rjmp .-1160 ; 0xe14 <_printf_P+0x4e> |
129c: e0 96 adiw r28, 0x30 ; 48 |
129e: 0f b6 in r0, 0x3f ; 63 |
12a0: f8 94 cli |
12a2: de bf out 0x3e, r29 ; 62 |
12a4: 0f be out 0x3f, r0 ; 63 |
12a6: cd bf out 0x3d, r28 ; 61 |
12a8: df 91 pop r29 |
12aa: cf 91 pop r28 |
12ac: 1f 91 pop r17 |
12ae: 0f 91 pop r16 |
12b0: ff 90 pop r15 |
12b2: ef 90 pop r14 |
12b4: df 90 pop r13 |
12b6: cf 90 pop r12 |
12b8: bf 90 pop r11 |
12ba: af 90 pop r10 |
12bc: 9f 90 pop r9 |
12be: 8f 90 pop r8 |
12c0: 7f 90 pop r7 |
12c2: 6f 90 pop r6 |
12c4: 5f 90 pop r5 |
12c6: 4f 90 pop r4 |
12c8: 3f 90 pop r3 |
12ca: 2f 90 pop r2 |
12cc: 08 95 ret |
000012ce <__vector_9>: |
}; |
SIGNAL (SIG_OVERFLOW1) |
{ |
12ce: 1f 92 push r1 |
12d0: 0f 92 push r0 |
12d2: 0f b6 in r0, 0x3f ; 63 |
12d4: 0f 92 push r0 |
12d6: 11 24 eor r1, r1 |
12d8: 8f 93 push r24 |
12da: 9f 93 push r25 |
static unsigned char cnt_10ms = 0; |
TCNT1 -= TIMER_RELOAD_VALUE; |
12dc: 8c b5 in r24, 0x2c ; 44 |
12de: 9d b5 in r25, 0x2d ; 45 |
12e0: 8a 5f subi r24, 0xFA ; 250 |
12e2: 90 40 sbci r25, 0x00 ; 0 |
12e4: 9d bd out 0x2d, r25 ; 45 |
12e6: 8c bd out 0x2c, r24 ; 44 |
CountMilliseconds++; |
12e8: 80 91 a5 00 lds r24, 0x00A5 |
12ec: 90 91 a6 00 lds r25, 0x00A6 |
12f0: 01 96 adiw r24, 0x01 ; 1 |
12f2: 90 93 a6 00 sts 0x00A6, r25 |
12f6: 80 93 a5 00 sts 0x00A5, r24 |
if(DisplayBusy) DisplayBusy--; |
12fa: 80 91 93 00 lds r24, 0x0093 |
12fe: 88 23 and r24, r24 |
1300: 29 f0 breq .+10 ; 0x130c <__vector_9+0x3e> |
1302: 80 91 93 00 lds r24, 0x0093 |
1306: 81 50 subi r24, 0x01 ; 1 |
1308: 80 93 93 00 sts 0x0093, r24 |
if(LoescheIrCodeTimer) |
130c: 80 91 7c 00 lds r24, 0x007C |
1310: 90 91 7d 00 lds r25, 0x007D |
1314: 00 97 sbiw r24, 0x00 ; 0 |
1316: 59 f0 breq .+22 ; 0x132e <__vector_9+0x60> |
{ |
if(--LoescheIrCodeTimer == 0) IR_Code = 0; |
1318: 01 97 sbiw r24, 0x01 ; 1 |
131a: 90 93 7d 00 sts 0x007D, r25 |
131e: 80 93 7c 00 sts 0x007C, r24 |
1322: 00 97 sbiw r24, 0x00 ; 0 |
1324: 21 f4 brne .+8 ; 0x132e <__vector_9+0x60> |
1326: 90 93 c8 01 sts 0x01C8, r25 |
132a: 80 93 c7 01 sts 0x01C7, r24 |
132e: 9f 91 pop r25 |
1330: 8f 91 pop r24 |
1332: 0f 90 pop r0 |
1334: 0f be out 0x3f, r0 ; 63 |
1336: 0f 90 pop r0 |
1338: 1f 90 pop r1 |
133a: 18 95 reti |
0000133c <Timer1_Init>: |
} |
} |
void Timer1_Init(void) |
{ |
TCCR1B = TIMER_TEILER; |
133c: 83 e0 ldi r24, 0x03 ; 3 |
133e: 8e bd out 0x2e, r24 ; 46 |
TCNT1 = -TIMER_RELOAD_VALUE; // reload |
1340: 86 e0 ldi r24, 0x06 ; 6 |
1342: 9f ef ldi r25, 0xFF ; 255 |
1344: 9d bd out 0x2d, r25 ; 45 |
1346: 8c bd out 0x2c, r24 ; 44 |
//OCR1 = 0x00; |
// Timer(s)/Counter(s) Interrupt(s) initialization |
#if defined (__AVR_ATmega32__) |
TIMSK |= 0x04; |
1348: 89 b7 in r24, 0x39 ; 57 |
134a: 84 60 ori r24, 0x04 ; 4 |
134c: 89 bf out 0x39, r24 ; 57 |
134e: 08 95 ret |
00001350 <SetDelay>: |
#endif |
#if defined (__AVR_ATmega644__) |
TIMSK1 |= _BV(TOIE1); |
#endif |
} |
unsigned int SetDelay (unsigned int t) |
{ |
return(CountMilliseconds + t - 1); |
1350: 20 91 a5 00 lds r18, 0x00A5 |
1354: 30 91 a6 00 lds r19, 0x00A6 |
1358: 28 0f add r18, r24 |
135a: 39 1f adc r19, r25 |
} |
135c: c9 01 movw r24, r18 |
135e: 01 97 sbiw r24, 0x01 ; 1 |
1360: 08 95 ret |
00001362 <CheckDelay>: |
char CheckDelay (unsigned int t) |
{ |
return(((t - CountMilliseconds) & 0x8000) >> 8); |
1362: 20 91 a5 00 lds r18, 0x00A5 |
1366: 30 91 a6 00 lds r19, 0x00A6 |
136a: 82 1b sub r24, r18 |
136c: 93 0b sbc r25, r19 |
136e: 89 2f mov r24, r25 |
1370: 99 27 eor r25, r25 |
1372: 80 78 andi r24, 0x80 ; 128 |
} |
1374: 99 27 eor r25, r25 |
1376: 08 95 ret |
00001378 <Delay_ms>: |
void Delay_ms(unsigned int w) |
{ |
1378: cf 93 push r28 |
137a: df 93 push r29 |
unsigned int akt; |
akt = SetDelay(w); |
137c: 0e 94 a8 09 call 0x1350 <SetDelay> |
1380: ec 01 movw r28, r24 |
while (!CheckDelay(akt)); |
1382: ce 01 movw r24, r28 |
1384: 0e 94 b1 09 call 0x1362 <CheckDelay> |
1388: 88 23 and r24, r24 |
138a: d9 f3 breq .-10 ; 0x1382 <Delay_ms+0xa> |
138c: df 91 pop r29 |
138e: cf 91 pop r28 |
1390: 08 95 ret |
00001392 <Keyboard_Init>: |
unsigned int KeyTimer = 0; |
void Keyboard_Init(void) |
{ |
KeyTimer = SetDelay(KEY_DELAY_MS); |
1392: 82 e3 ldi r24, 0x32 ; 50 |
1394: 90 e0 ldi r25, 0x00 ; 0 |
1396: 0e 94 a8 09 call 0x1350 <SetDelay> |
139a: 90 93 a9 00 sts 0x00A9, r25 |
139e: 80 93 a8 00 sts 0x00A8, r24 |
13a2: 08 95 ret |
000013a4 <GetKeyboard>: |
} |
unsigned char GetKeyboard(void) |
{ |
13a4: cf 93 push r28 |
static char taste1 = 0, taste2 = 0,taste3 = 0,taste4 = 0,taste5 = 0; |
unsigned char ret = 0; |
13a6: c0 e0 ldi r28, 0x00 ; 0 |
if(CheckDelay(KeyTimer)) |
13a8: 80 91 a8 00 lds r24, 0x00A8 |
13ac: 90 91 a9 00 lds r25, 0x00A9 |
13b0: 0e 94 b1 09 call 0x1362 <CheckDelay> |
13b4: 88 23 and r24, r24 |
13b6: 09 f4 brne .+2 ; 0x13ba <GetKeyboard+0x16> |
13b8: 76 c0 rjmp .+236 ; 0x14a6 <GetKeyboard+0x102> |
{ |
if(_TASTE1) { if(taste1++ == 0 || taste1 == CNT_TASTE) ret |= KEY1; if(taste1 == CNT_TASTE) taste1 = CNT_TASTE-CNT_TASTE/3;} else taste1 = 0; |
13ba: cf 9b sbis 0x19, 7 ; 25 |
13bc: 12 c0 rjmp .+36 ; 0x13e2 <GetKeyboard+0x3e> |
13be: 80 91 aa 00 lds r24, 0x00AA |
13c2: 8f 5f subi r24, 0xFF ; 255 |
13c4: 80 93 aa 00 sts 0x00AA, r24 |
13c8: 81 30 cpi r24, 0x01 ; 1 |
13ca: 11 f0 breq .+4 ; 0x13d0 <GetKeyboard+0x2c> |
13cc: 8a 30 cpi r24, 0x0A ; 10 |
13ce: 09 f4 brne .+2 ; 0x13d2 <GetKeyboard+0x2e> |
13d0: c1 e0 ldi r28, 0x01 ; 1 |
13d2: 80 91 aa 00 lds r24, 0x00AA |
13d6: 8a 30 cpi r24, 0x0A ; 10 |
13d8: 31 f4 brne .+12 ; 0x13e6 <GetKeyboard+0x42> |
13da: 87 e0 ldi r24, 0x07 ; 7 |
13dc: 80 93 aa 00 sts 0x00AA, r24 |
13e0: 02 c0 rjmp .+4 ; 0x13e6 <GetKeyboard+0x42> |
13e2: c0 93 aa 00 sts 0x00AA, r28 |
if(_TASTE2) { if(taste2++ == 0 || taste2 == CNT_TASTE) ret |= KEY2; if(taste2 == CNT_TASTE) taste2 = CNT_TASTE-CNT_TASTE/3;} else taste2 = 0; |
13e6: ce 9b sbis 0x19, 6 ; 25 |
13e8: 12 c0 rjmp .+36 ; 0x140e <GetKeyboard+0x6a> |
13ea: 80 91 ab 00 lds r24, 0x00AB |
13ee: 8f 5f subi r24, 0xFF ; 255 |
13f0: 80 93 ab 00 sts 0x00AB, r24 |
13f4: 81 30 cpi r24, 0x01 ; 1 |
13f6: 11 f0 breq .+4 ; 0x13fc <GetKeyboard+0x58> |
13f8: 8a 30 cpi r24, 0x0A ; 10 |
13fa: 09 f4 brne .+2 ; 0x13fe <GetKeyboard+0x5a> |
13fc: c2 60 ori r28, 0x02 ; 2 |
13fe: 80 91 ab 00 lds r24, 0x00AB |
1402: 8a 30 cpi r24, 0x0A ; 10 |
1404: 31 f4 brne .+12 ; 0x1412 <GetKeyboard+0x6e> |
1406: 87 e0 ldi r24, 0x07 ; 7 |
1408: 80 93 ab 00 sts 0x00AB, r24 |
140c: 02 c0 rjmp .+4 ; 0x1412 <GetKeyboard+0x6e> |
140e: 10 92 ab 00 sts 0x00AB, r1 |
if(_TASTE3) { if(taste3++ == 0 || taste3 == CNT_TASTE) ret |= KEY3; if(taste3 == CNT_TASTE) taste3 = CNT_TASTE-CNT_TASTE/3;} else taste3 = 0; |
1412: cd 9b sbis 0x19, 5 ; 25 |
1414: 12 c0 rjmp .+36 ; 0x143a <GetKeyboard+0x96> |
1416: 80 91 ac 00 lds r24, 0x00AC |
141a: 8f 5f subi r24, 0xFF ; 255 |
141c: 80 93 ac 00 sts 0x00AC, r24 |
1420: 81 30 cpi r24, 0x01 ; 1 |
1422: 11 f0 breq .+4 ; 0x1428 <GetKeyboard+0x84> |
1424: 8a 30 cpi r24, 0x0A ; 10 |
1426: 09 f4 brne .+2 ; 0x142a <GetKeyboard+0x86> |
1428: c4 60 ori r28, 0x04 ; 4 |
142a: 80 91 ac 00 lds r24, 0x00AC |
142e: 8a 30 cpi r24, 0x0A ; 10 |
1430: 31 f4 brne .+12 ; 0x143e <GetKeyboard+0x9a> |
1432: 87 e0 ldi r24, 0x07 ; 7 |
1434: 80 93 ac 00 sts 0x00AC, r24 |
1438: 02 c0 rjmp .+4 ; 0x143e <GetKeyboard+0x9a> |
143a: 10 92 ac 00 sts 0x00AC, r1 |
if(_TASTE4) { if(taste4++ == 0 || taste4 == CNT_TASTE) ret |= KEY4; if(taste4 == CNT_TASTE) taste4 = CNT_TASTE-CNT_TASTE/3;} else taste4 = 0; |
143e: cc 9b sbis 0x19, 4 ; 25 |
1440: 12 c0 rjmp .+36 ; 0x1466 <GetKeyboard+0xc2> |
1442: 80 91 ad 00 lds r24, 0x00AD |
1446: 8f 5f subi r24, 0xFF ; 255 |
1448: 80 93 ad 00 sts 0x00AD, r24 |
144c: 81 30 cpi r24, 0x01 ; 1 |
144e: 11 f0 breq .+4 ; 0x1454 <GetKeyboard+0xb0> |
1450: 8a 30 cpi r24, 0x0A ; 10 |
1452: 09 f4 brne .+2 ; 0x1456 <GetKeyboard+0xb2> |
1454: c8 60 ori r28, 0x08 ; 8 |
1456: 80 91 ad 00 lds r24, 0x00AD |
145a: 8a 30 cpi r24, 0x0A ; 10 |
145c: 31 f4 brne .+12 ; 0x146a <GetKeyboard+0xc6> |
145e: 87 e0 ldi r24, 0x07 ; 7 |
1460: 80 93 ad 00 sts 0x00AD, r24 |
1464: 02 c0 rjmp .+4 ; 0x146a <GetKeyboard+0xc6> |
1466: 10 92 ad 00 sts 0x00AD, r1 |
if(_TASTE5) { if(taste5++ == 0 || taste5 == CNT_TASTE) ret |= KEY5; if(taste5 == CNT_TASTE) taste5 = CNT_TASTE-CNT_TASTE/3;} else taste5 = 0; |
146a: cb 9b sbis 0x19, 3 ; 25 |
146c: 12 c0 rjmp .+36 ; 0x1492 <GetKeyboard+0xee> |
146e: 80 91 ae 00 lds r24, 0x00AE |
1472: 8f 5f subi r24, 0xFF ; 255 |
1474: 80 93 ae 00 sts 0x00AE, r24 |
1478: 81 30 cpi r24, 0x01 ; 1 |
147a: 11 f0 breq .+4 ; 0x1480 <GetKeyboard+0xdc> |
147c: 8a 30 cpi r24, 0x0A ; 10 |
147e: 09 f4 brne .+2 ; 0x1482 <GetKeyboard+0xde> |
1480: c0 61 ori r28, 0x10 ; 16 |
1482: 80 91 ae 00 lds r24, 0x00AE |
1486: 8a 30 cpi r24, 0x0A ; 10 |
1488: 31 f4 brne .+12 ; 0x1496 <GetKeyboard+0xf2> |
148a: 87 e0 ldi r24, 0x07 ; 7 |
148c: 80 93 ae 00 sts 0x00AE, r24 |
1490: 02 c0 rjmp .+4 ; 0x1496 <GetKeyboard+0xf2> |
1492: 10 92 ae 00 sts 0x00AE, r1 |
KeyTimer = SetDelay(KEY_DELAY_MS); |
1496: 82 e3 ldi r24, 0x32 ; 50 |
1498: 90 e0 ldi r25, 0x00 ; 0 |
149a: 0e 94 a8 09 call 0x1350 <SetDelay> |
149e: 90 93 a9 00 sts 0x00A9, r25 |
14a2: 80 93 a8 00 sts 0x00A8, r24 |
} |
return(ret); |
} |
14a6: 8c 2f mov r24, r28 |
14a8: 99 27 eor r25, r25 |
14aa: cf 91 pop r28 |
14ac: 08 95 ret |
000014ae <GetKeyboard2>: |
unsigned char GetKeyboard2(void) |
{ |
unsigned char ret = 0; |
14ae: 80 e0 ldi r24, 0x00 ; 0 |
if(_TASTE1) ret |= KEY1; |
14b0: cf 99 sbic 0x19, 7 ; 25 |
14b2: 81 e0 ldi r24, 0x01 ; 1 |
if(_TASTE2) ret |= KEY2; |
14b4: ce 99 sbic 0x19, 6 ; 25 |
14b6: 82 60 ori r24, 0x02 ; 2 |
if(_TASTE3) ret |= KEY3; |
14b8: cd 99 sbic 0x19, 5 ; 25 |
14ba: 84 60 ori r24, 0x04 ; 4 |
if(_TASTE4) ret |= KEY4; |
14bc: cc 99 sbic 0x19, 4 ; 25 |
14be: 88 60 ori r24, 0x08 ; 8 |
if(_TASTE5) ret |= KEY5; |
14c0: cb 99 sbic 0x19, 3 ; 25 |
14c2: 80 61 ori r24, 0x10 ; 16 |
return(ret); |
} |
14c4: 99 27 eor r25, r25 |
14c6: 08 95 ret |
000014c8 <Menu>: |
unsigned char KanalVon[MAX_KANAL]; |
unsigned char KanalAn[MAX_KANAL]; |
void Menu(unsigned char key) |
{ |
14c8: 0f 93 push r16 |
14ca: 1f 93 push r17 |
14cc: cf 93 push r28 |
14ce: df 93 push r29 |
static unsigned int arr = 0; |
static unsigned char MaxMenue = 2,MenuePunkt=0; |
unsigned char kanal = 0; |
if(key & KEY1) { if(MenuePunkt) MenuePunkt--; else MenuePunkt = MaxMenue; LCD_Clear; } |
14d0: c8 2f mov r28, r24 |
14d2: dd 27 eor r29, r29 |
14d4: c0 ff sbrs r28, 0 |
14d6: 0f c0 rjmp .+30 ; 0x14f6 <Menu+0x2e> |
14d8: 80 91 b3 00 lds r24, 0x00B3 |
14dc: 88 23 and r24, r24 |
14de: 11 f0 breq .+4 ; 0x14e4 <Menu+0x1c> |
14e0: 81 50 subi r24, 0x01 ; 1 |
14e2: 02 c0 rjmp .+4 ; 0x14e8 <Menu+0x20> |
14e4: 80 91 7b 00 lds r24, 0x007B |
14e8: 80 93 b3 00 sts 0x00B3, r24 |
14ec: 81 e0 ldi r24, 0x01 ; 1 |
14ee: 0e 94 e1 05 call 0xbc2 <_lcd_write_command> |
14f2: 0e 94 c9 05 call 0xb92 <_long_delay> |
if(key & KEY2) { MenuePunkt++; LCD_Clear; } |
14f6: 8e 01 movw r16, r28 |
14f8: 02 70 andi r16, 0x02 ; 2 |
14fa: 10 70 andi r17, 0x00 ; 0 |
14fc: c1 ff sbrs r28, 1 |
14fe: 0a c0 rjmp .+20 ; 0x1514 <Menu+0x4c> |
1500: 80 91 b3 00 lds r24, 0x00B3 |
1504: 8f 5f subi r24, 0xFF ; 255 |
1506: 80 93 b3 00 sts 0x00B3, r24 |
150a: 81 e0 ldi r24, 0x01 ; 1 |
150c: 0e 94 e1 05 call 0xbc2 <_lcd_write_command> |
1510: 0e 94 c9 05 call 0xb92 <_long_delay> |
if((key & KEY1) && (key & KEY2)) MenuePunkt = 0; |
1514: c0 ff sbrs r28, 0 |
1516: 04 c0 rjmp .+8 ; 0x1520 <Menu+0x58> |
1518: 01 2b or r16, r17 |
151a: 11 f0 breq .+4 ; 0x1520 <Menu+0x58> |
151c: 10 92 b3 00 sts 0x00B3, r1 |
// LCD_printfxy(13,0,"[%i]",MenuePunkt); |
switch(MenuePunkt) |
1520: 20 91 b3 00 lds r18, 0x00B3 |
1524: 82 2f mov r24, r18 |
1526: 99 27 eor r25, r25 |
1528: 81 30 cpi r24, 0x01 ; 1 |
152a: 91 05 cpc r25, r1 |
152c: 09 f4 brne .+2 ; 0x1530 <Menu+0x68> |
152e: 41 c0 rjmp .+130 ; 0x15b2 <Menu+0xea> |
1530: 82 30 cpi r24, 0x02 ; 2 |
1532: 91 05 cpc r25, r1 |
1534: 1c f4 brge .+6 ; 0x153c <Menu+0x74> |
1536: 89 2b or r24, r25 |
1538: 49 f0 breq .+18 ; 0x154c <Menu+0x84> |
153a: bf c0 rjmp .+382 ; 0x16ba <Menu+0x1f2> |
153c: 82 30 cpi r24, 0x02 ; 2 |
153e: 91 05 cpc r25, r1 |
1540: 09 f4 brne .+2 ; 0x1544 <Menu+0x7c> |
1542: 6a c0 rjmp .+212 ; 0x1618 <Menu+0x150> |
1544: 03 97 sbiw r24, 0x03 ; 3 |
1546: 09 f4 brne .+2 ; 0x154a <Menu+0x82> |
1548: 8e c0 rjmp .+284 ; 0x1666 <Menu+0x19e> |
154a: b7 c0 rjmp .+366 ; 0x16ba <Menu+0x1f2> |
{ |
case 0: |
LCD_printfxy(0,0,"Verbinden mit"); |
154c: 60 e0 ldi r22, 0x00 ; 0 |
154e: 86 2f mov r24, r22 |
1550: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
1554: 84 eb ldi r24, 0xB4 ; 180 |
1556: 90 e0 ldi r25, 0x00 ; 0 |
1558: 9f 93 push r25 |
155a: 8f 93 push r24 |
155c: 0e 94 e3 06 call 0xdc6 <_printf_P> |
LCD_printfxy(0,1,"MicroSPS:%2i ",SlaveAdresse); |
1560: 61 e0 ldi r22, 0x01 ; 1 |
1562: 80 e0 ldi r24, 0x00 ; 0 |
1564: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
1568: 0f 90 pop r0 |
156a: 0f 90 pop r0 |
156c: 80 91 64 00 lds r24, 0x0064 |
1570: 99 27 eor r25, r25 |
1572: 9f 93 push r25 |
1574: 8f 93 push r24 |
1576: 82 ec ldi r24, 0xC2 ; 194 |
1578: 90 e0 ldi r25, 0x00 ; 0 |
157a: 9f 93 push r25 |
157c: 8f 93 push r24 |
157e: 0e 94 e3 06 call 0xdc6 <_printf_P> |
if(key & KEY3 && SlaveAdresse > 1) SlaveAdresse--; |
1582: 0f 90 pop r0 |
1584: 0f 90 pop r0 |
1586: 0f 90 pop r0 |
1588: 0f 90 pop r0 |
158a: c2 ff sbrs r28, 2 |
158c: 07 c0 rjmp .+14 ; 0x159c <Menu+0xd4> |
158e: 80 91 64 00 lds r24, 0x0064 |
1592: 82 30 cpi r24, 0x02 ; 2 |
1594: 18 f0 brcs .+6 ; 0x159c <Menu+0xd4> |
1596: 81 50 subi r24, 0x01 ; 1 |
1598: 80 93 64 00 sts 0x0064, r24 |
if(key & KEY4 && SlaveAdresse < 26) SlaveAdresse++; |
159c: c3 ff sbrs r28, 3 |
159e: 92 c0 rjmp .+292 ; 0x16c4 <Menu+0x1fc> |
15a0: 80 91 64 00 lds r24, 0x0064 |
15a4: 8a 31 cpi r24, 0x1A ; 26 |
15a6: 08 f0 brcs .+2 ; 0x15aa <Menu+0xe2> |
15a8: 8d c0 rjmp .+282 ; 0x16c4 <Menu+0x1fc> |
15aa: 8f 5f subi r24, 0xFF ; 255 |
15ac: 80 93 64 00 sts 0x0064, r24 |
break; |
15b0: 89 c0 rjmp .+274 ; 0x16c4 <Menu+0x1fc> |
case 1: |
LCD_printfxy(0,0,"Max Adresse"); |
15b2: 60 e0 ldi r22, 0x00 ; 0 |
15b4: 86 2f mov r24, r22 |
15b6: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
15ba: 80 ed ldi r24, 0xD0 ; 208 |
15bc: 90 e0 ldi r25, 0x00 ; 0 |
15be: 9f 93 push r25 |
15c0: 8f 93 push r24 |
15c2: 0e 94 e3 06 call 0xdc6 <_printf_P> |
LCD_printfxy(0,1,"%2i ",AnzahlTeilnehmer); |
15c6: 61 e0 ldi r22, 0x01 ; 1 |
15c8: 80 e0 ldi r24, 0x00 ; 0 |
15ca: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
15ce: 0f 90 pop r0 |
15d0: 0f 90 pop r0 |
15d2: 80 91 6c 00 lds r24, 0x006C |
15d6: 99 27 eor r25, r25 |
15d8: 9f 93 push r25 |
15da: 8f 93 push r24 |
15dc: 8c ed ldi r24, 0xDC ; 220 |
15de: 90 e0 ldi r25, 0x00 ; 0 |
15e0: 9f 93 push r25 |
15e2: 8f 93 push r24 |
15e4: 0e 94 e3 06 call 0xdc6 <_printf_P> |
if(key & KEY3 && AnzahlTeilnehmer > 1) AnzahlTeilnehmer--; |
15e8: 0f 90 pop r0 |
15ea: 0f 90 pop r0 |
15ec: 0f 90 pop r0 |
15ee: 0f 90 pop r0 |
15f0: c2 ff sbrs r28, 2 |
15f2: 07 c0 rjmp .+14 ; 0x1602 <Menu+0x13a> |
15f4: 80 91 6c 00 lds r24, 0x006C |
15f8: 82 30 cpi r24, 0x02 ; 2 |
15fa: 18 f0 brcs .+6 ; 0x1602 <Menu+0x13a> |
15fc: 81 50 subi r24, 0x01 ; 1 |
15fe: 80 93 6c 00 sts 0x006C, r24 |
if(key & KEY4 && AnzahlTeilnehmer < 26) AnzahlTeilnehmer++; |
1602: c3 ff sbrs r28, 3 |
1604: 5f c0 rjmp .+190 ; 0x16c4 <Menu+0x1fc> |
1606: 80 91 6c 00 lds r24, 0x006C |
160a: 8a 31 cpi r24, 0x1A ; 26 |
160c: 08 f0 brcs .+2 ; 0x1610 <Menu+0x148> |
160e: 5a c0 rjmp .+180 ; 0x16c4 <Menu+0x1fc> |
1610: 8f 5f subi r24, 0xFF ; 255 |
1612: 80 93 6c 00 sts 0x006C, r24 |
break; |
1616: 56 c0 rjmp .+172 ; 0x16c4 <Menu+0x1fc> |
case 2: |
LCD_printfxy(0,0,"Checksum"); |
1618: 60 e0 ldi r22, 0x00 ; 0 |
161a: 86 2f mov r24, r22 |
161c: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
1620: 81 ee ldi r24, 0xE1 ; 225 |
1622: 90 e0 ldi r25, 0x00 ; 0 |
1624: 9f 93 push r25 |
1626: 8f 93 push r24 |
1628: 0e 94 e3 06 call 0xdc6 <_printf_P> |
LCD_printfxy(0,1,"Errors:%5i ",CntCrcError); |
162c: 61 e0 ldi r22, 0x01 ; 1 |
162e: 80 e0 ldi r24, 0x00 ; 0 |
1630: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
1634: 0f 90 pop r0 |
1636: 0f 90 pop r0 |
1638: 80 91 99 00 lds r24, 0x0099 |
163c: 90 91 9a 00 lds r25, 0x009A |
1640: 9f 93 push r25 |
1642: 8f 93 push r24 |
1644: 8a ee ldi r24, 0xEA ; 234 |
1646: 90 e0 ldi r25, 0x00 ; 0 |
1648: 9f 93 push r25 |
164a: 8f 93 push r24 |
164c: 0e 94 e3 06 call 0xdc6 <_printf_P> |
if(key & KEY3) CntCrcError = 0; |
1650: 0f 90 pop r0 |
1652: 0f 90 pop r0 |
1654: 0f 90 pop r0 |
1656: 0f 90 pop r0 |
1658: c2 ff sbrs r28, 2 |
165a: 34 c0 rjmp .+104 ; 0x16c4 <Menu+0x1fc> |
165c: 10 92 9a 00 sts 0x009A, r1 |
1660: 10 92 99 00 sts 0x0099, r1 |
break; |
1664: 2f c0 rjmp .+94 ; 0x16c4 <Menu+0x1fc> |
case 3: |
LCD_printfxy(0,0,"Display"); |
1666: 60 e0 ldi r22, 0x00 ; 0 |
1668: 86 2f mov r24, r22 |
166a: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
166e: 86 ef ldi r24, 0xF6 ; 246 |
1670: 90 e0 ldi r25, 0x00 ; 0 |
1672: 9f 93 push r25 |
1674: 8f 93 push r24 |
1676: 0e 94 e3 06 call 0xdc6 <_printf_P> |
LCD_printfxy(0,1,"Zeilen:%1i ",DisplayZeilen); |
167a: 61 e0 ldi r22, 0x01 ; 1 |
167c: 80 e0 ldi r24, 0x00 ; 0 |
167e: 0e 94 55 06 call 0xcaa <LCD_Gotoxy> |
1682: 0f 90 pop r0 |
1684: 0f 90 pop r0 |
1686: 80 91 65 00 lds r24, 0x0065 |
168a: 99 27 eor r25, r25 |
168c: 9f 93 push r25 |
168e: 8f 93 push r24 |
1690: 8e ef ldi r24, 0xFE ; 254 |
1692: 90 e0 ldi r25, 0x00 ; 0 |
1694: 9f 93 push r25 |
1696: 8f 93 push r24 |
1698: 0e 94 e3 06 call 0xdc6 <_printf_P> |
if(key & KEY3) DisplayZeilen = 4; |
169c: 0f 90 pop r0 |
169e: 0f 90 pop r0 |
16a0: 0f 90 pop r0 |
16a2: 0f 90 pop r0 |
16a4: c2 ff sbrs r28, 2 |
16a6: 03 c0 rjmp .+6 ; 0x16ae <Menu+0x1e6> |
16a8: 84 e0 ldi r24, 0x04 ; 4 |
16aa: 80 93 65 00 sts 0x0065, r24 |
if(key & KEY4) DisplayZeilen = 2; |
16ae: c3 ff sbrs r28, 3 |
16b0: 09 c0 rjmp .+18 ; 0x16c4 <Menu+0x1fc> |
16b2: 82 e0 ldi r24, 0x02 ; 2 |
16b4: 80 93 65 00 sts 0x0065, r24 |
break; |
16b8: 05 c0 rjmp .+10 ; 0x16c4 <Menu+0x1fc> |
/* case 1: |
case 2: |
case 3: |
case 4: |
kanal = MenuePunkt - 1; |
LCD_printfxy(0,0,"Datenkanal:%2i",kanal); |
LCD_printfxy(0,1,"Von:%2i an %2i ",KanalVon[kanal],KanalAn[kanal]); |
if(key & KEY3) KanalVon[kanal]++; |
if(key & KEY4) KanalAn[kanal]++; |
KanalVon[kanal] % MAX_KANAL; |
KanalAn[kanal] % MAX_KANAL; |
break; |
*/ |
/* |
case 1: |
LCD_printfxy(0,0,"Intervall"); |
LCD_printfxy(0,1,"Display:%3ims ",IntervallDisplay); |
if(key & KEY3 && IntervallDisplay > 25) IntervallDisplay -= 5; |
if(key & KEY4 && IntervallDisplay < 990) IntervallDisplay += 5; |
break; |
case 2: |
LCD_printfxy(0,0,"Intervall"); |
LCD_printfxy(0,1,"Debug:%3ims ",IntervallDebug); |
if(key & KEY3 && IntervallDebug > 25) IntervallDebug -= 5; |
if(key & KEY4 && IntervallDebug < 990) IntervallDebug += 5; |
break; |
case 1: |
LCD_printfxy(0,0,"Time"); |
LCD_printfxy(0,1,"%3i:%02i",Minute,Sekunde); |
if(key & KEY3) if(Minute) Minute--; |
if(key & KEY4) Minute++; |
if(key & KEY5) Sekunde = 0; |
break; |
case 2: |
LCD_printfxy(0,0,"Testvariable"); |
LCD_printfxy(0,1,"TestInt:%5i",TestInt); |
if(key & KEY3) TestInt--; |
if(key & KEY4) TestInt++; |
break; |
case 3: |
LCD_printfxy(0,0,"Testarray"); |
LCD_printfxy(0,1,"Array[%i]=%3i",arr,Array[arr]); |
if(key & KEY5) if(++arr == ARRAYGROESSE) arr = 0; |
if(key & KEY3) Array[arr]--; |
if(key & KEY4) Array[arr]++; |
break; |
case 4: |
LCD_printfxy(0,0,"Infrarot RC5:"); |
LCD_printfxy(0,1,"Adr:%2i Cmd:%3i",(IR_Code >> 8), IR_Code & 0xff); |
break; |
*/ |
default: MaxMenue = MenuePunkt - 1; |
16ba: 21 50 subi r18, 0x01 ; 1 |
16bc: 20 93 7b 00 sts 0x007B, r18 |
MenuePunkt = 0; |
16c0: 10 92 b3 00 sts 0x00B3, r1 |
16c4: df 91 pop r29 |
16c6: cf 91 pop r28 |
16c8: 1f 91 pop r17 |
16ca: 0f 91 pop r16 |
16cc: 08 95 ret |
000016ce <InitIR>: |
// Init IR |
// ************************************************************************ |
void InitIR(void) |
{ |
INT0_ENABLE; // ext. Int0 enable |
16ce: 8b b7 in r24, 0x3b ; 59 |
16d0: 80 64 ori r24, 0x40 ; 64 |
16d2: 8b bf out 0x3b, r24 ; 59 |
CLR_INT0_FLAG; // war |= 0x40 |
16d4: 8a b7 in r24, 0x3a ; 58 |
16d6: 8f 7b andi r24, 0xBF ; 191 |
16d8: 8a bf out 0x3a, r24 ; 58 |
INIT_INT0_FLANKE; |
16da: 85 b7 in r24, 0x35 ; 53 |
16dc: 8c 7f andi r24, 0xFC ; 252 |
16de: 85 bf out 0x35, r24 ; 53 |
16e0: 85 b7 in r24, 0x35 ; 53 |
16e2: 82 60 ori r24, 0x02 ; 2 |
16e4: 85 bf out 0x35, r24 ; 53 |
TIMER0_PRESCALER = 0x04; // Timer0: Clk div 256 |
16e6: 84 e0 ldi r24, 0x04 ; 4 |
16e8: 83 bf out 0x33, r24 ; 51 |
Decodierung_Lauft = 0; |
16ea: 10 92 c9 01 sts 0x01C9, r1 |
New_IR_Code = 0; |
16ee: 10 92 c6 01 sts 0x01C6, r1 |
IR_Code = 0; |
16f2: 10 92 c8 01 sts 0x01C8, r1 |
16f6: 10 92 c7 01 sts 0x01C7, r1 |
16fa: 08 95 ret |
000016fc <__vector_1>: |
} |
// ************************************************************************** |
// * aufgerufen durch: externer Interrupt |
// ************************************************************************** |
// * Die Funktion wird durch einen externen Interrupt aufgerufen. |
// * Sie dient nur zum Starten der Abtastsequenz und zum Triggern auf die |
// * Signalflanken in der Mitte der Daten. |
// ************************************************************************** |
SIGNAL (SIG_INTERRUPT0) |
{ |
16fc: 1f 92 push r1 |
16fe: 0f 92 push r0 |
1700: 0f b6 in r0, 0x3f ; 63 |
1702: 0f 92 push r0 |
1704: 11 24 eor r1, r1 |
1706: 8f 93 push r24 |
// Zeitbasis fuer Timer einstellen |
// Entspricht 1,5 mal einer Bitlaenge |
// PORTB++; |
TCNT0 = -41; |
1708: 87 ed ldi r24, 0xD7 ; 215 |
170a: 82 bf out 0x32, r24 ; 50 |
TIM0_START; // Timer 0 starten, |
170c: 89 b7 in r24, 0x39 ; 57 |
170e: 81 60 ori r24, 0x01 ; 1 |
1710: 89 bf out 0x39, r24 ; 57 |
if(Decodierung_Lauft) INT0_DISABLE; // die erneute Int.-Auslsung soll |
1712: 80 91 c9 01 lds r24, 0x01C9 |
1716: 88 23 and r24, r24 |
1718: 19 f0 breq .+6 ; 0x1720 <__vector_1+0x24> |
171a: 8b b7 in r24, 0x3b ; 59 |
171c: 8f 7b andi r24, 0xBF ; 191 |
171e: 8b bf out 0x3b, r24 ; 59 |
1720: 8f 91 pop r24 |
1722: 0f 90 pop r0 |
1724: 0f be out 0x3f, r0 ; 63 |
1726: 0f 90 pop r0 |
1728: 1f 90 pop r1 |
172a: 18 95 reti |
0000172c <__vector_11>: |
// nur die Timer-Routine erlauben |
} |
// ************************************************************************** |
// * aufgerufen durch: Timerueberlauf Timer 0 |
// ************************************************************************** |
// * Die Funktion wird durch einen Timer0-Interrupt aufgerufen. |
// * Der Timer wird vom ext. Int0 gestartet. |
// * Das Infrarotsignal wird hier abgetastet und die Wertigkeiten der |
// * Bits entsprechend aufaddiert. Das empfangende Zeichen wird in der |
// * globalen Variablen IR_Code gespeichert. Nach Empfang wird das Bit |
// * Neues_Zeichen gesetzt. |
// ************************************************************************** |
SIGNAL (SIG_OVERFLOW0) |
{ |
172c: 1f 92 push r1 |
172e: 0f 92 push r0 |
1730: 0f b6 in r0, 0x3f ; 63 |
1732: 0f 92 push r0 |
1734: 11 24 eor r1, r1 |
1736: 2f 93 push r18 |
1738: 3f 93 push r19 |
173a: 4f 93 push r20 |
173c: 8f 93 push r24 |
173e: 9f 93 push r25 |
static unsigned int Shift,IR_Code_tmp; |
static unsigned char IR_Zaehler=0,IRSperrCounter=0; |
// Reinitialize Timer's 0 value |
TCNT1 = -41; |
1740: 87 ed ldi r24, 0xD7 ; 215 |
1742: 9f ef ldi r25, 0xFF ; 255 |
1744: 9d bd out 0x2d, r25 ; 45 |
1746: 8c bd out 0x2c, r24 ; 44 |
if (IRSperrCounter) |
1748: 80 91 b9 00 lds r24, 0x00B9 |
174c: 88 23 and r24, r24 |
174e: 69 f0 breq .+26 ; 0x176a <__vector_11+0x3e> |
{ IRSperrCounter--; |
1750: 81 50 subi r24, 0x01 ; 1 |
1752: 80 93 b9 00 sts 0x00B9, r24 |
if (!IRSperrCounter) |
1756: 88 23 and r24, r24 |
1758: 09 f0 breq .+2 ; 0x175c <__vector_11+0x30> |
175a: 8a c0 rjmp .+276 ; 0x1870 <__vector_11+0x144> |
{ |
TIM0_STOPP; // Timer0 sperre wird durch ExtInt0 gestartet |
175c: 89 b7 in r24, 0x39 ; 57 |
175e: 8e 7f andi r24, 0xFE ; 254 |
1760: 89 bf out 0x39, r24 ; 57 |
CLR_INT0_FLAG; // IntFlag Loeschen |
1762: 8a b7 in r24, 0x3a ; 58 |
1764: 8f 7b andi r24, 0xBF ; 191 |
1766: 8a bf out 0x3a, r24 ; 58 |
1768: 80 c0 rjmp .+256 ; 0x186a <__vector_11+0x13e> |
INT0_ENABLE; // externen Interrupt wieder freigenben |
} |
} |
else |
{ |
if(IR_Zaehler > 1) |
176a: 40 91 b8 00 lds r20, 0x00B8 |
176e: 42 30 cpi r20, 0x02 ; 2 |
1770: 88 f0 brcs .+34 ; 0x1794 <__vector_11+0x68> |
{ |
Decodierung_Lauft = 1; |
1772: 81 e0 ldi r24, 0x01 ; 1 |
1774: 80 93 c9 01 sts 0x01C9, r24 |
{ |
CLR_INT0_FLAG; // Interrupt Flag loeschen |
1778: 8a b7 in r24, 0x3a ; 58 |
177a: 8f 7b andi r24, 0xBF ; 191 |
177c: 8a bf out 0x3a, r24 ; 58 |
if(IR_PP) INT0_NEG_FLANKE; // naechste fallende Flanke soll Int0 ausloesen |
177e: 82 9b sbis 0x10, 2 ; 16 |
1780: 03 c0 rjmp .+6 ; 0x1788 <__vector_11+0x5c> |
1782: 85 b7 in r24, 0x35 ; 53 |
1784: 8e 7f andi r24, 0xFE ; 254 |
1786: 02 c0 rjmp .+4 ; 0x178c <__vector_11+0x60> |
else INT0_POS_FLANKE; // naechste steigende Flanke soll Int0 ausloesen |
1788: 85 b7 in r24, 0x35 ; 53 |
178a: 81 60 ori r24, 0x01 ; 1 |
178c: 85 bf out 0x35, r24 ; 53 |
INT0_ENABLE; // externen Int frei |
178e: 8b b7 in r24, 0x3b ; 59 |
1790: 80 64 ori r24, 0x40 ; 64 |
1792: 8b bf out 0x3b, r24 ; 59 |
} |
} |
if(!IR_Zaehler) // es beginnt eine neue Abtastung |
1794: 44 23 and r20, r20 |
1796: 59 f4 brne .+22 ; 0x17ae <__vector_11+0x82> |
{ // es handelt sich um das 1. Sync-Bit |
IR_Code_tmp=0; // Merker löschen |
1798: 10 92 b7 00 sts 0x00B7, r1 |
179c: 10 92 b6 00 sts 0x00B6, r1 |
Shift=0x8000; //;8192; // Maske auf MSB |
17a0: 80 e0 ldi r24, 0x00 ; 0 |
17a2: 90 e8 ldi r25, 0x80 ; 128 |
17a4: 90 93 b5 00 sts 0x00B5, r25 |
17a8: 80 93 b4 00 sts 0x00B4, r24 |
17ac: 14 c0 rjmp .+40 ; 0x17d6 <__vector_11+0xaa> |
} |
else |
if(IR_PP==1) // das empfangende Bit ist logisch High |
17ae: 82 9b sbis 0x10, 2 ; 16 |
17b0: 10 c0 rjmp .+32 ; 0x17d2 <__vector_11+0xa6> |
{ if(IR_Zaehler>2) // (IR_Zaehler ist gleich 1 beim 2. Sync-Bit) |
17b2: 43 30 cpi r20, 0x03 ; 3 |
17b4: 70 f0 brcs .+28 ; 0x17d2 <__vector_11+0xa6> |
{ // 2 --> Toggle-Bit (wird übersprungen) |
IR_Code_tmp |= Shift; // entsprechendse Bit setzen |
17b6: 80 91 b6 00 lds r24, 0x00B6 |
17ba: 90 91 b7 00 lds r25, 0x00B7 |
17be: 20 91 b4 00 lds r18, 0x00B4 |
17c2: 30 91 b5 00 lds r19, 0x00B5 |
17c6: 82 2b or r24, r18 |
17c8: 93 2b or r25, r19 |
17ca: 90 93 b7 00 sts 0x00B7, r25 |
17ce: 80 93 b6 00 sts 0x00B6, r24 |
} |
} |
if ((IR_Zaehler < 2) && !(IR_PP==1)) // startbits überprüfen |
17d2: 42 30 cpi r20, 0x02 ; 2 |
17d4: 20 f4 brcc .+8 ; 0x17de <__vector_11+0xb2> |
17d6: 82 99 sbic 0x10, 2 ; 16 |
17d8: 02 c0 rjmp .+4 ; 0x17de <__vector_11+0xb2> |
{ |
IR_Zaehler = 0; |
17da: 10 92 b8 00 sts 0x00B8, r1 |
} |
Shift >>=1; // Shiftregister um 1 nach rechts schieben |
17de: 80 91 b4 00 lds r24, 0x00B4 |
17e2: 90 91 b5 00 lds r25, 0x00B5 |
17e6: 96 95 lsr r25 |
17e8: 87 95 ror r24 |
17ea: 90 93 b5 00 sts 0x00B5, r25 |
17ee: 80 93 b4 00 sts 0x00B4, r24 |
// (für das nächste empf. Bit |
if (Shift == 128) Shift = 32; // Adresse ins HighByte, Kommando ins LowByte |
17f2: 80 38 cpi r24, 0x80 ; 128 |
17f4: 91 05 cpc r25, r1 |
17f6: 31 f4 brne .+12 ; 0x1804 <__vector_11+0xd8> |
17f8: 80 e2 ldi r24, 0x20 ; 32 |
17fa: 90 e0 ldi r25, 0x00 ; 0 |
17fc: 90 93 b5 00 sts 0x00B5, r25 |
1800: 80 93 b4 00 sts 0x00B4, r24 |
if(IR_Zaehler++==15) // Das IR-Wort wurde vollstaendig abgetastet |
1804: 80 91 b8 00 lds r24, 0x00B8 |
1808: 8f 5f subi r24, 0xFF ; 255 |
180a: 80 93 b8 00 sts 0x00B8, r24 |
180e: 80 31 cpi r24, 0x10 ; 16 |
1810: 79 f5 brne .+94 ; 0x1870 <__vector_11+0x144> |
{ |
CLR_INT0_FLAG; // IntFlag Loeschen |
1812: 8a b7 in r24, 0x3a ; 58 |
1814: 8f 7b andi r24, 0xBF ; 191 |
1816: 8a bf out 0x3a, r24 ; 58 |
INT0_NEG_FLANKE; // fallende Flanke |
1818: 85 b7 in r24, 0x35 ; 53 |
181a: 8e 7f andi r24, 0xFE ; 254 |
181c: 85 bf out 0x35, r24 ; 53 |
IR_Zaehler = 0; |
181e: 10 92 b8 00 sts 0x00B8, r1 |
Decodierung_Lauft=0; |
1822: 10 92 c9 01 sts 0x01C9, r1 |
/* if ((HIGH(IR_Code_tmp)==ALLOWED1)|| (HIGH(IR_Code_tmp)==ALLOWED2)|| |
(HIGH(IR_Code_tmp)==ALLOWED3)||(HIGH(IR_Code_tmp)==ALLOWED4)|| |
(HIGH(IR_Code_tmp)==ALLOWED5) ) |
if ((HIGH(IR_Code_tmp)< 10))*/ |
if ((HIGH(IR_Code_tmp)< 10 ) && (LOW(IR_Code_tmp)!=0x3F) ) |
1826: 80 91 b7 00 lds r24, 0x00B7 |
182a: 8a 30 cpi r24, 0x0A ; 10 |
182c: d8 f4 brcc .+54 ; 0x1864 <__vector_11+0x138> |
182e: 80 91 b6 00 lds r24, 0x00B6 |
1832: 8f 33 cpi r24, 0x3F ; 63 |
1834: b9 f0 breq .+46 ; 0x1864 <__vector_11+0x138> |
{ // nur erlaubt Adressen werden akzepetiert |
IR_Code=IR_Code_tmp; // IR-Wort in die globale Variable schreiben |
1836: 80 91 b6 00 lds r24, 0x00B6 |
183a: 90 91 b7 00 lds r25, 0x00B7 |
183e: 90 93 c8 01 sts 0x01C8, r25 |
1842: 80 93 c7 01 sts 0x01C7, r24 |
New_IR_Code = 1; // Es ist ein neues Zeichen eingetragen worden |
1846: 81 e0 ldi r24, 0x01 ; 1 |
1848: 80 93 c6 01 sts 0x01C6, r24 |
IRSperrCounter = 4; // weitere Kommandos für 200 * 1,3ms unterdrücken |
184c: 84 e0 ldi r24, 0x04 ; 4 |
184e: 80 93 b9 00 sts 0x00B9, r24 |
INT0_ENABLE; // externen Interrupt wieder freigenben |
1852: 8b b7 in r24, 0x3b ; 59 |
1854: 80 64 ori r24, 0x40 ; 64 |
1856: 8b bf out 0x3b, r24 ; 59 |
LoescheIrCodeTimer = 250; |
1858: 8a ef ldi r24, 0xFA ; 250 |
185a: 90 e0 ldi r25, 0x00 ; 0 |
185c: 90 93 7d 00 sts 0x007D, r25 |
1860: 80 93 7c 00 sts 0x007C, r24 |
} |
IRSperrCounter = 4; // weitere Kommandos für 200 * 1,3ms unterdrücken |
1864: 84 e0 ldi r24, 0x04 ; 4 |
1866: 80 93 b9 00 sts 0x00B9, r24 |
INT0_ENABLE; // externen Interrupt wieder freigenben |
186a: 8b b7 in r24, 0x3b ; 59 |
186c: 80 64 ori r24, 0x40 ; 64 |
186e: 8b bf out 0x3b, r24 ; 59 |
1870: 9f 91 pop r25 |
1872: 8f 91 pop r24 |
1874: 4f 91 pop r20 |
1876: 3f 91 pop r19 |
1878: 2f 91 pop r18 |
187a: 0f 90 pop r0 |
187c: 0f be out 0x3f, r0 ; 63 |
187e: 0f 90 pop r0 |
1880: 1f 90 pop r1 |
1882: 18 95 reti |
00001884 <ADC_Init>: |
// --------------------------------------------------------------------------------------- |
void ADC_Init(void) |
{ |
ADMUX = 0; |
1884: 17 b8 out 0x07, r1 ; 7 |
ADCSRA = 0x86; |
1886: 86 e8 ldi r24, 0x86 ; 134 |
1888: 86 b9 out 0x06, r24 ; 6 |
188a: 08 95 ret |
0000188c <ReadADC>: |
} |
// --------------------------------------------------------------------------------------- |
unsigned int ReadADC(unsigned char adc_input) |
{ |
ADMUX = adc_input; |
188c: 87 b9 out 0x07, r24 ; 7 |
ADCSRA |= 0x40; |
188e: 36 9a sbi 0x06, 6 ; 6 |
//Delay_ms(10); |
while ((ADCSRA & 0x10) == 0); |
1890: 34 9b sbis 0x06, 4 ; 6 |
1892: fe cf rjmp .-4 ; 0x1890 <ReadADC+0x4> |
ADCSRA |= 0x10; |
1894: 34 9a sbi 0x06, 4 ; 6 |
return ADCW; // read ad and calc. temp. |
1896: 84 b1 in r24, 0x04 ; 4 |
1898: 95 b1 in r25, 0x05 ; 5 |
189a: 08 95 ret |
0000189c <GetAnalogWerte>: |
} |
void GetAnalogWerte(void) |
{ |
AnalogWerte[0] = ReadADC(0); |
189c: 80 e0 ldi r24, 0x00 ; 0 |
189e: 0e 94 46 0c call 0x188c <ReadADC> |
18a2: 90 93 cb 01 sts 0x01CB, r25 |
18a6: 80 93 ca 01 sts 0x01CA, r24 |
AnalogWerte[1] = ReadADC(1); |
18aa: 81 e0 ldi r24, 0x01 ; 1 |
18ac: 0e 94 46 0c call 0x188c <ReadADC> |
18b0: 90 93 cd 01 sts 0x01CD, r25 |
18b4: 80 93 cc 01 sts 0x01CC, r24 |
AnalogWerte[2] = ReadADC(2); |
18b8: 82 e0 ldi r24, 0x02 ; 2 |
18ba: 0e 94 46 0c call 0x188c <ReadADC> |
18be: 90 93 cf 01 sts 0x01CF, r25 |
18c2: 80 93 ce 01 sts 0x01CE, r24 |
18c6: 08 95 ret |
000018c8 <memchr>: |
18c8: fc 01 movw r30, r24 |
18ca: 41 50 subi r20, 0x01 ; 1 |
18cc: 50 40 sbci r21, 0x00 ; 0 |
18ce: 30 f0 brcs .+12 ; 0x18dc <memchr+0x14> |
18d0: 01 90 ld r0, Z+ |
18d2: 06 16 cp r0, r22 |
18d4: d1 f7 brne .-12 ; 0x18ca <memchr+0x2> |
18d6: 31 97 sbiw r30, 0x01 ; 1 |
18d8: cf 01 movw r24, r30 |
18da: 08 95 ret |
18dc: 88 27 eor r24, r24 |
18de: 99 27 eor r25, r25 |
18e0: 08 95 ret |
000018e2 <fdevopen>: |
18e2: 0f 93 push r16 |
18e4: 1f 93 push r17 |
18e6: cf 93 push r28 |
18e8: df 93 push r29 |
18ea: 8c 01 movw r16, r24 |
18ec: eb 01 movw r28, r22 |
18ee: 00 97 sbiw r24, 0x00 ; 0 |
18f0: 11 f4 brne .+4 ; 0x18f6 <fdevopen+0x14> |
18f2: 67 2b or r22, r23 |
18f4: c1 f1 breq .+112 ; 0x1966 <fdevopen+0x84> |
18f6: 6e e0 ldi r22, 0x0E ; 14 |
18f8: 70 e0 ldi r23, 0x00 ; 0 |
18fa: 81 e0 ldi r24, 0x01 ; 1 |
18fc: 90 e0 ldi r25, 0x00 ; 0 |
18fe: 0e 94 b8 0c call 0x1970 <calloc> |
1902: fc 01 movw r30, r24 |
1904: 89 2b or r24, r25 |
1906: 71 f1 breq .+92 ; 0x1964 <fdevopen+0x82> |
1908: 80 e8 ldi r24, 0x80 ; 128 |
190a: 83 83 std Z+3, r24 ; 0x03 |
190c: 20 97 sbiw r28, 0x00 ; 0 |
190e: 71 f0 breq .+28 ; 0x192c <fdevopen+0x4a> |
1910: d3 87 std Z+11, r29 ; 0x0b |
1912: c2 87 std Z+10, r28 ; 0x0a |
1914: 81 e8 ldi r24, 0x81 ; 129 |
1916: 83 83 std Z+3, r24 ; 0x03 |
1918: 80 91 d0 01 lds r24, 0x01D0 |
191c: 90 91 d1 01 lds r25, 0x01D1 |
1920: 89 2b or r24, r25 |
1922: 21 f4 brne .+8 ; 0x192c <fdevopen+0x4a> |
1924: f0 93 d1 01 sts 0x01D1, r31 |
1928: e0 93 d0 01 sts 0x01D0, r30 |
192c: 01 15 cp r16, r1 |
192e: 11 05 cpc r17, r1 |
1930: c9 f0 breq .+50 ; 0x1964 <fdevopen+0x82> |
1932: 11 87 std Z+9, r17 ; 0x09 |
1934: 00 87 std Z+8, r16 ; 0x08 |
1936: 83 81 ldd r24, Z+3 ; 0x03 |
1938: 82 60 ori r24, 0x02 ; 2 |
193a: 83 83 std Z+3, r24 ; 0x03 |
193c: 80 91 d2 01 lds r24, 0x01D2 |
1940: 90 91 d3 01 lds r25, 0x01D3 |
1944: 89 2b or r24, r25 |
1946: 71 f4 brne .+28 ; 0x1964 <fdevopen+0x82> |
1948: f0 93 d3 01 sts 0x01D3, r31 |
194c: e0 93 d2 01 sts 0x01D2, r30 |
1950: 80 91 d4 01 lds r24, 0x01D4 |
1954: 90 91 d5 01 lds r25, 0x01D5 |
1958: 89 2b or r24, r25 |
195a: 21 f4 brne .+8 ; 0x1964 <fdevopen+0x82> |
195c: f0 93 d5 01 sts 0x01D5, r31 |
1960: e0 93 d4 01 sts 0x01D4, r30 |
1964: cf 01 movw r24, r30 |
1966: df 91 pop r29 |
1968: cf 91 pop r28 |
196a: 1f 91 pop r17 |
196c: 0f 91 pop r16 |
196e: 08 95 ret |
00001970 <calloc>: |
1970: 0f 93 push r16 |
1972: 1f 93 push r17 |
1974: cf 93 push r28 |
1976: df 93 push r29 |
1978: 86 9f mul r24, r22 |
197a: 80 01 movw r16, r0 |
197c: 87 9f mul r24, r23 |
197e: 10 0d add r17, r0 |
1980: 96 9f mul r25, r22 |
1982: 10 0d add r17, r0 |
1984: 11 24 eor r1, r1 |
1986: c8 01 movw r24, r16 |
1988: 0e 94 d4 0c call 0x19a8 <malloc> |
198c: ec 01 movw r28, r24 |
198e: 00 97 sbiw r24, 0x00 ; 0 |
1990: 29 f0 breq .+10 ; 0x199c <calloc+0x2c> |
1992: a8 01 movw r20, r16 |
1994: 60 e0 ldi r22, 0x00 ; 0 |
1996: 70 e0 ldi r23, 0x00 ; 0 |
1998: 0e 94 ca 0d call 0x1b94 <memset> |
199c: ce 01 movw r24, r28 |
199e: df 91 pop r29 |
19a0: cf 91 pop r28 |
19a2: 1f 91 pop r17 |
19a4: 0f 91 pop r16 |
19a6: 08 95 ret |
000019a8 <malloc>: |
19a8: cf 93 push r28 |
19aa: df 93 push r29 |
19ac: ac 01 movw r20, r24 |
19ae: 02 97 sbiw r24, 0x02 ; 2 |
19b0: 10 f4 brcc .+4 ; 0x19b6 <malloc+0xe> |
19b2: 42 e0 ldi r20, 0x02 ; 2 |
19b4: 50 e0 ldi r21, 0x00 ; 0 |
19b6: 20 e0 ldi r18, 0x00 ; 0 |
19b8: 30 e0 ldi r19, 0x00 ; 0 |
19ba: a0 91 d8 01 lds r26, 0x01D8 |
19be: b0 91 d9 01 lds r27, 0x01D9 |
19c2: bd 01 movw r22, r26 |
19c4: f9 01 movw r30, r18 |
19c6: 10 97 sbiw r26, 0x00 ; 0 |
19c8: 09 f4 brne .+2 ; 0x19cc <malloc+0x24> |
19ca: 4c c0 rjmp .+152 ; 0x1a64 <malloc+0xbc> |
19cc: 8d 91 ld r24, X+ |
19ce: 9c 91 ld r25, X |
19d0: 11 97 sbiw r26, 0x01 ; 1 |
19d2: 84 17 cp r24, r20 |
19d4: 95 07 cpc r25, r21 |
19d6: 31 f1 breq .+76 ; 0x1a24 <malloc+0x7c> |
19d8: 48 17 cp r20, r24 |
19da: 59 07 cpc r21, r25 |
19dc: 38 f4 brcc .+14 ; 0x19ec <malloc+0x44> |
19de: 21 15 cp r18, r1 |
19e0: 31 05 cpc r19, r1 |
19e2: 19 f0 breq .+6 ; 0x19ea <malloc+0x42> |
19e4: 82 17 cp r24, r18 |
19e6: 93 07 cpc r25, r19 |
19e8: 08 f4 brcc .+2 ; 0x19ec <malloc+0x44> |
19ea: 9c 01 movw r18, r24 |
19ec: fd 01 movw r30, r26 |
19ee: a2 81 ldd r26, Z+2 ; 0x02 |
19f0: b3 81 ldd r27, Z+3 ; 0x03 |
19f2: 10 97 sbiw r26, 0x00 ; 0 |
19f4: 59 f7 brne .-42 ; 0x19cc <malloc+0x24> |
19f6: 21 15 cp r18, r1 |
19f8: 31 05 cpc r19, r1 |
19fa: a1 f1 breq .+104 ; 0x1a64 <malloc+0xbc> |
19fc: c9 01 movw r24, r18 |
19fe: 84 1b sub r24, r20 |
1a00: 95 0b sbc r25, r21 |
1a02: 04 97 sbiw r24, 0x04 ; 4 |
1a04: 08 f4 brcc .+2 ; 0x1a08 <malloc+0x60> |
1a06: a9 01 movw r20, r18 |
1a08: db 01 movw r26, r22 |
1a0a: e0 e0 ldi r30, 0x00 ; 0 |
1a0c: f0 e0 ldi r31, 0x00 ; 0 |
1a0e: 10 97 sbiw r26, 0x00 ; 0 |
1a10: 49 f1 breq .+82 ; 0x1a64 <malloc+0xbc> |
1a12: 8d 91 ld r24, X+ |
1a14: 9c 91 ld r25, X |
1a16: 11 97 sbiw r26, 0x01 ; 1 |
1a18: 82 17 cp r24, r18 |
1a1a: 93 07 cpc r25, r19 |
1a1c: f9 f4 brne .+62 ; 0x1a5c <malloc+0xb4> |
1a1e: 42 17 cp r20, r18 |
1a20: 53 07 cpc r21, r19 |
1a22: 79 f4 brne .+30 ; 0x1a42 <malloc+0x9a> |
1a24: ed 01 movw r28, r26 |
1a26: 8a 81 ldd r24, Y+2 ; 0x02 |
1a28: 9b 81 ldd r25, Y+3 ; 0x03 |
1a2a: 30 97 sbiw r30, 0x00 ; 0 |
1a2c: 19 f0 breq .+6 ; 0x1a34 <malloc+0x8c> |
1a2e: 93 83 std Z+3, r25 ; 0x03 |
1a30: 82 83 std Z+2, r24 ; 0x02 |
1a32: 04 c0 rjmp .+8 ; 0x1a3c <malloc+0x94> |
1a34: 90 93 d9 01 sts 0x01D9, r25 |
1a38: 80 93 d8 01 sts 0x01D8, r24 |
1a3c: cd 01 movw r24, r26 |
1a3e: 02 96 adiw r24, 0x02 ; 2 |
1a40: 4a c0 rjmp .+148 ; 0x1ad6 <malloc+0x12e> |
1a42: 24 1b sub r18, r20 |
1a44: 35 0b sbc r19, r21 |
1a46: fd 01 movw r30, r26 |
1a48: e2 0f add r30, r18 |
1a4a: f3 1f adc r31, r19 |
1a4c: 41 93 st Z+, r20 |
1a4e: 51 93 st Z+, r21 |
1a50: 22 50 subi r18, 0x02 ; 2 |
1a52: 30 40 sbci r19, 0x00 ; 0 |
1a54: 2d 93 st X+, r18 |
1a56: 3c 93 st X, r19 |
1a58: cf 01 movw r24, r30 |
1a5a: 3d c0 rjmp .+122 ; 0x1ad6 <malloc+0x12e> |
1a5c: fd 01 movw r30, r26 |
1a5e: a2 81 ldd r26, Z+2 ; 0x02 |
1a60: b3 81 ldd r27, Z+3 ; 0x03 |
1a62: d5 cf rjmp .-86 ; 0x1a0e <malloc+0x66> |
1a64: 80 91 d6 01 lds r24, 0x01D6 |
1a68: 90 91 d7 01 lds r25, 0x01D7 |
1a6c: 89 2b or r24, r25 |
1a6e: 41 f4 brne .+16 ; 0x1a80 <malloc+0xd8> |
1a70: 80 91 80 00 lds r24, 0x0080 |
1a74: 90 91 81 00 lds r25, 0x0081 |
1a78: 90 93 d7 01 sts 0x01D7, r25 |
1a7c: 80 93 d6 01 sts 0x01D6, r24 |
1a80: e0 91 7e 00 lds r30, 0x007E |
1a84: f0 91 7f 00 lds r31, 0x007F |
1a88: 30 97 sbiw r30, 0x00 ; 0 |
1a8a: 41 f4 brne .+16 ; 0x1a9c <malloc+0xf4> |
1a8c: ed b7 in r30, 0x3d ; 61 |
1a8e: fe b7 in r31, 0x3e ; 62 |
1a90: 80 91 82 00 lds r24, 0x0082 |
1a94: 90 91 83 00 lds r25, 0x0083 |
1a98: e8 1b sub r30, r24 |
1a9a: f9 0b sbc r31, r25 |
1a9c: a0 91 d6 01 lds r26, 0x01D6 |
1aa0: b0 91 d7 01 lds r27, 0x01D7 |
1aa4: 9f 01 movw r18, r30 |
1aa6: 2a 1b sub r18, r26 |
1aa8: 3b 0b sbc r19, r27 |
1aaa: 24 17 cp r18, r20 |
1aac: 35 07 cpc r19, r21 |
1aae: 88 f0 brcs .+34 ; 0x1ad2 <malloc+0x12a> |
1ab0: ca 01 movw r24, r20 |
1ab2: 02 96 adiw r24, 0x02 ; 2 |
1ab4: 28 17 cp r18, r24 |
1ab6: 39 07 cpc r19, r25 |
1ab8: 60 f0 brcs .+24 ; 0x1ad2 <malloc+0x12a> |
1aba: cd 01 movw r24, r26 |
1abc: 84 0f add r24, r20 |
1abe: 95 1f adc r25, r21 |
1ac0: 02 96 adiw r24, 0x02 ; 2 |
1ac2: 90 93 d7 01 sts 0x01D7, r25 |
1ac6: 80 93 d6 01 sts 0x01D6, r24 |
1aca: 4d 93 st X+, r20 |
1acc: 5d 93 st X+, r21 |
1ace: cd 01 movw r24, r26 |
1ad0: 02 c0 rjmp .+4 ; 0x1ad6 <malloc+0x12e> |
1ad2: 80 e0 ldi r24, 0x00 ; 0 |
1ad4: 90 e0 ldi r25, 0x00 ; 0 |
1ad6: df 91 pop r29 |
1ad8: cf 91 pop r28 |
1ada: 08 95 ret |
00001adc <free>: |
1adc: cf 93 push r28 |
1ade: df 93 push r29 |
1ae0: 00 97 sbiw r24, 0x00 ; 0 |
1ae2: 09 f4 brne .+2 ; 0x1ae6 <free+0xa> |
1ae4: 54 c0 rjmp .+168 ; 0x1b8e <free+0xb2> |
1ae6: dc 01 movw r26, r24 |
1ae8: 12 97 sbiw r26, 0x02 ; 2 |
1aea: ed 01 movw r28, r26 |
1aec: 1b 82 std Y+3, r1 ; 0x03 |
1aee: 1a 82 std Y+2, r1 ; 0x02 |
1af0: 80 91 d8 01 lds r24, 0x01D8 |
1af4: 90 91 d9 01 lds r25, 0x01D9 |
1af8: 00 97 sbiw r24, 0x00 ; 0 |
1afa: 21 f1 breq .+72 ; 0x1b44 <free+0x68> |
1afc: fc 01 movw r30, r24 |
1afe: 40 e0 ldi r20, 0x00 ; 0 |
1b00: 50 e0 ldi r21, 0x00 ; 0 |
1b02: ea 17 cp r30, r26 |
1b04: fb 07 cpc r31, r27 |
1b06: 18 f1 brcs .+70 ; 0x1b4e <free+0x72> |
1b08: ed 01 movw r28, r26 |
1b0a: fb 83 std Y+3, r31 ; 0x03 |
1b0c: ea 83 std Y+2, r30 ; 0x02 |
1b0e: 2d 91 ld r18, X+ |
1b10: 3c 91 ld r19, X |
1b12: 11 97 sbiw r26, 0x01 ; 1 |
1b14: c2 0f add r28, r18 |
1b16: d3 1f adc r29, r19 |
1b18: ce 01 movw r24, r28 |
1b1a: 02 96 adiw r24, 0x02 ; 2 |
1b1c: 8e 17 cp r24, r30 |
1b1e: 9f 07 cpc r25, r31 |
1b20: 71 f4 brne .+28 ; 0x1b3e <free+0x62> |
1b22: 8a 81 ldd r24, Y+2 ; 0x02 |
1b24: 9b 81 ldd r25, Y+3 ; 0x03 |
1b26: 28 0f add r18, r24 |
1b28: 39 1f adc r19, r25 |
1b2a: 2e 5f subi r18, 0xFE ; 254 |
1b2c: 3f 4f sbci r19, 0xFF ; 255 |
1b2e: 11 96 adiw r26, 0x01 ; 1 |
1b30: 3c 93 st X, r19 |
1b32: 2e 93 st -X, r18 |
1b34: 82 81 ldd r24, Z+2 ; 0x02 |
1b36: 93 81 ldd r25, Z+3 ; 0x03 |
1b38: fd 01 movw r30, r26 |
1b3a: 93 83 std Z+3, r25 ; 0x03 |
1b3c: 82 83 std Z+2, r24 ; 0x02 |
1b3e: 41 15 cp r20, r1 |
1b40: 51 05 cpc r21, r1 |
1b42: 59 f4 brne .+22 ; 0x1b5a <free+0x7e> |
1b44: b0 93 d9 01 sts 0x01D9, r27 |
1b48: a0 93 d8 01 sts 0x01D8, r26 |
1b4c: 20 c0 rjmp .+64 ; 0x1b8e <free+0xb2> |
1b4e: af 01 movw r20, r30 |
1b50: 02 80 ldd r0, Z+2 ; 0x02 |
1b52: f3 81 ldd r31, Z+3 ; 0x03 |
1b54: e0 2d mov r30, r0 |
1b56: 30 97 sbiw r30, 0x00 ; 0 |
1b58: a1 f6 brne .-88 ; 0x1b02 <free+0x26> |
1b5a: ea 01 movw r28, r20 |
1b5c: bb 83 std Y+3, r27 ; 0x03 |
1b5e: aa 83 std Y+2, r26 ; 0x02 |
1b60: ca 01 movw r24, r20 |
1b62: 02 96 adiw r24, 0x02 ; 2 |
1b64: 28 81 ld r18, Y |
1b66: 39 81 ldd r19, Y+1 ; 0x01 |
1b68: 82 0f add r24, r18 |
1b6a: 93 1f adc r25, r19 |
1b6c: 8a 17 cp r24, r26 |
1b6e: 9b 07 cpc r25, r27 |
1b70: 71 f4 brne .+28 ; 0x1b8e <free+0xb2> |
1b72: 8d 91 ld r24, X+ |
1b74: 9c 91 ld r25, X |
1b76: 11 97 sbiw r26, 0x01 ; 1 |
1b78: 28 0f add r18, r24 |
1b7a: 39 1f adc r19, r25 |
1b7c: 2e 5f subi r18, 0xFE ; 254 |
1b7e: 3f 4f sbci r19, 0xFF ; 255 |
1b80: 39 83 std Y+1, r19 ; 0x01 |
1b82: 28 83 st Y, r18 |
1b84: fd 01 movw r30, r26 |
1b86: 82 81 ldd r24, Z+2 ; 0x02 |
1b88: 93 81 ldd r25, Z+3 ; 0x03 |
1b8a: 9b 83 std Y+3, r25 ; 0x03 |
1b8c: 8a 83 std Y+2, r24 ; 0x02 |
1b8e: df 91 pop r29 |
1b90: cf 91 pop r28 |
1b92: 08 95 ret |
00001b94 <memset>: |
1b94: dc 01 movw r26, r24 |
1b96: 40 ff sbrs r20, 0 |
1b98: 03 c0 rjmp .+6 ; 0x1ba0 <memset+0xc> |
1b9a: 01 c0 rjmp .+2 ; 0x1b9e <memset+0xa> |
1b9c: 6d 93 st X+, r22 |
1b9e: 6d 93 st X+, r22 |
1ba0: 42 50 subi r20, 0x02 ; 2 |
1ba2: 50 40 sbci r21, 0x00 ; 0 |
1ba4: d8 f7 brcc .-10 ; 0x1b9c <memset+0x8> |
1ba6: 08 95 ret |
00001ba8 <__udivmodsi4>: |
1ba8: a1 e2 ldi r26, 0x21 ; 33 |
1baa: 1a 2e mov r1, r26 |
1bac: aa 1b sub r26, r26 |
1bae: bb 1b sub r27, r27 |
1bb0: fd 01 movw r30, r26 |
1bb2: 0d c0 rjmp .+26 ; 0x1bce <__udivmodsi4_ep> |
00001bb4 <__udivmodsi4_loop>: |
1bb4: aa 1f adc r26, r26 |
1bb6: bb 1f adc r27, r27 |
1bb8: ee 1f adc r30, r30 |
1bba: ff 1f adc r31, r31 |
1bbc: a2 17 cp r26, r18 |
1bbe: b3 07 cpc r27, r19 |
1bc0: e4 07 cpc r30, r20 |
1bc2: f5 07 cpc r31, r21 |
1bc4: 20 f0 brcs .+8 ; 0x1bce <__udivmodsi4_ep> |
1bc6: a2 1b sub r26, r18 |
1bc8: b3 0b sbc r27, r19 |
1bca: e4 0b sbc r30, r20 |
1bcc: f5 0b sbc r31, r21 |
00001bce <__udivmodsi4_ep>: |
1bce: 66 1f adc r22, r22 |
1bd0: 77 1f adc r23, r23 |
1bd2: 88 1f adc r24, r24 |
1bd4: 99 1f adc r25, r25 |
1bd6: 1a 94 dec r1 |
1bd8: 69 f7 brne .-38 ; 0x1bb4 <__udivmodsi4_loop> |
1bda: 60 95 com r22 |
1bdc: 70 95 com r23 |
1bde: 80 95 com r24 |
1be0: 90 95 com r25 |
1be2: 9b 01 movw r18, r22 |
1be4: ac 01 movw r20, r24 |
1be6: bd 01 movw r22, r26 |
1be8: cf 01 movw r24, r30 |
1bea: 08 95 ret |
/tags/V0.14/main.map |
---|
0,0 → 1,764 |
Archive member included because of file (symbol) |
C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a(_udivmodsi4.o) |
printf_P.o (__udivmodsi4) |
C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a(_copy_data.o) |
main.o (__do_copy_data) |
C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a(_clear_bss.o) |
main.o (__do_clear_bss) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(memchr.o) |
printf_P.o (memchr) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(fdevopen.o) |
uart.o (fdevopen) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(iob.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(fdevopen.o) (__iob) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(calloc.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(fdevopen.o) (calloc) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(calloc.o) (malloc) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(memset.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(calloc.o) (memset) |
Allocating common symbols |
Common symbol size file |
SendeBuffer 0x64 uart.o |
Debug_Timer 0x2 main.o |
Debug_Display_Timer |
0x2 main.o |
__brkval 0x2 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
DebugIn 0xb main.o |
VersionInfo 0xa main.o |
New_IR_Code 0x1 ir.o |
RxdBuffer 0x64 uart.o |
AnalogWerte 0x6 analog.o |
IR_Code 0x2 ir.o |
KanalVon 0x8 menu.o |
Decodierung_Lauft 0x1 ir.o |
DebugOut 0x1a main.o |
KanalAn 0x8 menu.o |
__flp 0x2 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
PollDisplay 0x1 main.o |
__iob 0x6 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(iob.o) |
Memory Configuration |
Name Origin Length Attributes |
text 0x00000000 0x00020000 xr |
data 0x00800060 0x0000ffa0 rw !x |
eeprom 0x00810000 0x00010000 rw !x |
*default* 0x00000000 0xffffffff |
Linker script and memory map |
LOAD C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
LOAD main.o |
LOAD uart.o |
LOAD lcd.o |
LOAD printf_P.o |
LOAD timer0.o |
LOAD keyboard.o |
LOAD menu.o |
LOAD ir.o |
LOAD analog.o |
LOAD C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libm.a |
LOAD C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a |
LOAD C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a |
LOAD C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a |
.hash |
*(.hash) |
.dynsym |
*(.dynsym) |
.dynstr |
*(.dynstr) |
.gnu.version |
*(.gnu.version) |
.gnu.version_d |
*(.gnu.version_d) |
.gnu.version_r |
*(.gnu.version_r) |
.rel.init |
*(.rel.init) |
.rela.init |
*(.rela.init) |
.rel.text |
*(.rel.text) |
*(.rel.text.*) |
*(.rel.gnu.linkonce.t*) |
.rela.text |
*(.rela.text) |
*(.rela.text.*) |
*(.rela.gnu.linkonce.t*) |
.rel.fini |
*(.rel.fini) |
.rela.fini |
*(.rela.fini) |
.rel.rodata |
*(.rel.rodata) |
*(.rel.rodata.*) |
*(.rel.gnu.linkonce.r*) |
.rela.rodata |
*(.rela.rodata) |
*(.rela.rodata.*) |
*(.rela.gnu.linkonce.r*) |
.rel.data |
*(.rel.data) |
*(.rel.data.*) |
*(.rel.gnu.linkonce.d*) |
.rela.data |
*(.rela.data) |
*(.rela.data.*) |
*(.rela.gnu.linkonce.d*) |
.rel.ctors |
*(.rel.ctors) |
.rela.ctors |
*(.rela.ctors) |
.rel.dtors |
*(.rel.dtors) |
.rela.dtors |
*(.rela.dtors) |
.rel.got |
*(.rel.got) |
.rela.got |
*(.rela.got) |
.rel.bss |
*(.rel.bss) |
.rela.bss |
*(.rela.bss) |
.rel.plt |
*(.rel.plt) |
.rela.plt |
*(.rela.plt) |
.text 0x00000000 0x1c18 |
*(.vectors) |
.vectors 0x00000000 0x54 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
0x00000000 __vectors |
0x00000000 __vector_default |
0x00000054 __ctors_start = . |
*(.ctors) |
0x00000054 __ctors_end = . |
0x00000054 __dtors_start = . |
*(.dtors) |
0x00000054 __dtors_end = . |
*(.progmem.gcc*) |
*(.progmem*) |
.progmem.data 0x00000054 0x54 main.o |
.progmem.data 0x000000a8 0xc uart.o |
.progmem.data 0x000000b4 0x56 menu.o |
0x0000010a . = ALIGN (0x2) |
*(.init0) |
*(.init1) |
*(.init2) |
.init2 0x0000010a 0xc C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
*(.init3) |
*(.init4) |
.init4 0x00000116 0x16 C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a(_copy_data.o) |
0x00000116 __do_copy_data |
.init4 0x0000012c 0x10 C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a(_clear_bss.o) |
0x0000012c __do_clear_bss |
*(.init5) |
*(.init6) |
*(.init7) |
*(.init8) |
*(.init9) |
.init9 0x0000013c 0x4 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
*(.text) |
.text 0x00000140 0x4 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
0x00000140 __vector_12 |
0x00000140 __bad_interrupt |
0x00000140 __vector_6 |
0x00000140 __vector_3 |
0x00000140 __vector_17 |
0x00000140 __vector_19 |
0x00000140 __vector_7 |
0x00000140 __vector_5 |
0x00000140 __vector_4 |
0x00000140 __vector_2 |
0x00000140 __vector_8 |
0x00000140 __vector_14 |
0x00000140 __vector_10 |
0x00000140 __vector_16 |
0x00000140 __vector_18 |
0x00000140 __vector_20 |
.text 0x00000144 0x282 main.o |
0x000001b4 Init |
0x00000156 Sekundentakt |
0x000001ca main |
0x00000144 Sekundentakt_Init |
.text 0x000003c6 0x7e6 uart.o |
0x000009f8 WriteProgramData |
0x00000a16 SendeRemoteTasten |
0x000009fa UART_Init |
0x00000430 __vector_13 |
0x0000080a BearbeiteRxDaten |
0x00000abe ClearIntervalle |
0x00000a76 SendIntervalle |
0x000005de AddCRC |
0x00000b04 DatenUebertragung |
0x00000732 Decode64 |
0x000003c6 __vector_15 |
0x0000064a SendOutData |
0x000009dc uart_putchar |
.text 0x00000bac 0x1b2 lcd.o |
0x00000cc4 LCD_Gotoxy |
0x00000c4e my_pput |
0x00000c08 _lcd_write_4bit |
0x00000bcc _short_delay |
0x00000c26 lcd_write_byte |
0x00000bdc _lcd_write_command |
0x00000c58 LCD_Init |
0x00000d48 LCD_Putchar |
0x00000d12 LCD_Write |
0x00000bac _long_delay |
.text 0x00000d5e 0x58a printf_P.o |
0x00000de0 _printf_P |
0x00000dc8 PAD_0 |
0x00000d86 PRINTP |
0x00000d5e PRINT |
0x00000db0 PAD_SP |
.text 0x000012e8 0xd6 timer0.o |
0x0000137c SetDelay |
0x0000138e CheckDelay |
0x000013a4 Delay_ms |
0x000012e8 __vector_9 |
0x00001368 Timer1_Init |
.text 0x000013be 0x136 keyboard.o |
0x000014da GetKeyboard2 |
0x000013be Keyboard_Init |
0x000013d0 GetKeyboard |
.text 0x000014f4 0x206 menu.o |
0x000014f4 Menu |
.text 0x000016fa 0x1b6 ir.o |
0x00001728 __vector_1 |
0x00001758 __vector_11 |
0x000016fa InitIR |
.text 0x000018b0 0x44 analog.o |
0x000018c8 GetAnalogWerte |
0x000018b8 ReadADC |
0x000018b0 ADC_Init |
.text 0x000018f4 0x1a C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(memchr.o) |
0x000018f4 memchr |
.text 0x0000190e 0x8e C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(fdevopen.o) |
0x0000190e fdevopen |
.text 0x0000199c 0x38 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(calloc.o) |
0x0000199c calloc |
.text 0x000019d4 0x1ec C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
0x000019d4 malloc |
0x00001b08 free |
.text 0x00001bc0 0x14 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(memset.o) |
0x00001bc0 memset |
0x00001bd4 . = ALIGN (0x2) |
*(.text.*) |
.text.libgcc 0x00001bd4 0x44 C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a(_udivmodsi4.o) |
0x00001bd4 __udivmodsi4 |
0x00001c18 . = ALIGN (0x2) |
*(.fini9) |
*(.fini8) |
*(.fini7) |
*(.fini6) |
*(.fini5) |
*(.fini4) |
*(.fini3) |
*(.fini2) |
*(.fini1) |
*(.fini0) |
0x00001c18 _etext = . |
.data 0x00800060 0x24 load address 0x00001c18 |
0x00800060 PROVIDE (__data_start, .) |
*(.data) |
.data 0x00800060 0xc main.o |
0x00800065 DisplayZeilen |
0x00800064 SlaveAdresse |
0x00800066 CntDatensaetzeProSekunde |
0x00800062 IntervallDebug |
0x00800060 IntervallDisplay |
.data 0x0080006c 0x5 uart.o |
0x0080006e UebertragungAbgeschlossen |
0x0080006c AnzahlTeilnehmer |
0x0080006d ErwarteAntwort |
.data 0x00800071 0xb menu.o |
0x00800071 Array |
.data 0x0080007c 0x2 ir.o |
0x0080007c LoescheIrCodeTimer |
.data 0x0080007e 0x6 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
0x00800080 __malloc_heap_start |
0x0080007e __malloc_heap_end |
0x00800082 __malloc_margin |
*(.gnu.linkonce.d*) |
0x00800084 . = ALIGN (0x2) |
0x00800084 _edata = . |
0x00800084 PROVIDE (__data_end, .) |
.bss 0x00800084 0x157 |
0x00800084 PROVIDE (__bss_start, .) |
*(.bss) |
.bss 0x00800084 0xe main.o |
0x00800087 DebugGetAnforderung |
0x00800088 Debug_Display_Intervall |
0x00800086 GetVersionAnforderung |
0x0080008d Sekunde |
0x00800085 SendeDummyDaten |
0x0080008e _TastTimer |
0x0080008c Minute |
0x0080008a Debug_Timer_Intervall |
0x00800084 UebertragungUnterbrochen |
0x00800090 _SekTimer |
.bss 0x00800092 0x14 uart.o |
0x0080009d SioTmp |
0x00800098 PC_DebugTimeout |
0x0080009c NeuerDatensatzEmpfangen |
0x0080009a CntCrcError |
0x00800097 TX_DigTransferKanalL |
0x00800094 DisplayBusy |
0x00800092 WaitTXD |
0x00800099 AnzahlEmpfangsBytes |
0x00800095 TX_DigTransferKanalDaten |
0x00800093 AntwortEingetroffen |
0x00800096 TX_DigTransferKanalH |
.bss 0x008000a6 0x3 timer0.o |
0x008000a6 CountMilliseconds |
.bss 0x008000a9 0x7 keyboard.o |
0x008000a9 KeyTimer |
.bss 0x008000b0 0x5 menu.o |
0x008000b0 TestInt |
.bss 0x008000b5 0x6 ir.o |
*(COMMON) |
COMMON 0x008000bb 0x34 main.o |
0x008000bb Debug_Timer |
0x008000bd Debug_Display_Timer |
0x008000bf DebugIn |
0x008000ca VersionInfo |
0x008000d4 DebugOut |
0x008000ee PollDisplay |
COMMON 0x008000ef 0xc8 uart.o |
0x008000ef SendeBuffer |
0x00800153 RxdBuffer |
COMMON 0x008001b7 0x10 menu.o |
0x008001b7 KanalVon |
0x008001bf KanalAn |
COMMON 0x008001c7 0x4 ir.o |
0x008001c7 New_IR_Code |
0x008001c8 IR_Code |
0x008001ca Decodierung_Lauft |
COMMON 0x008001cb 0x6 analog.o |
0x008001cb AnalogWerte |
COMMON 0x008001d1 0x6 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(iob.o) |
0x008001d1 __iob |
COMMON 0x008001d7 0x4 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
0x008001d7 __brkval |
0x008001d9 __flp |
0x008001db PROVIDE (__bss_end, .) |
0x00001c18 __data_load_start = LOADADDR (.data) |
0x00001c3c __data_load_end = (__data_load_start + SIZEOF (.data)) |
.noinit 0x008001db 0x0 |
0x008001db PROVIDE (__noinit_start, .) |
*(.noinit*) |
0x008001db PROVIDE (__noinit_end, .) |
0x008001db _end = . |
0x008001db PROVIDE (__heap_start, .) |
.eeprom 0x00810000 0x0 |
*(.eeprom*) |
0x00810000 __eeprom_end = . |
.stab 0x00000000 0x36c |
*(.stab) |
.stab 0x00000000 0x36c C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
.stabstr 0x00000000 0x84 |
*(.stabstr) |
.stabstr 0x00000000 0x84 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
.stab.excl |
*(.stab.excl) |
.stab.exclstr |
*(.stab.exclstr) |
.stab.index |
*(.stab.index) |
.stab.indexstr |
*(.stab.indexstr) |
.comment |
*(.comment) |
.debug |
*(.debug) |
.line |
*(.line) |
.debug_srcinfo |
*(.debug_srcinfo) |
.debug_sfnames |
*(.debug_sfnames) |
.debug_aranges 0x00000000 0xb4 |
*(.debug_aranges) |
.debug_aranges |
0x00000000 0x14 main.o |
.debug_aranges |
0x00000014 0x14 uart.o |
.debug_aranges |
0x00000028 0x14 lcd.o |
.debug_aranges |
0x0000003c 0x14 printf_P.o |
.debug_aranges |
0x00000050 0x14 timer0.o |
.debug_aranges |
0x00000064 0x14 keyboard.o |
.debug_aranges |
0x00000078 0x14 menu.o |
.debug_aranges |
0x0000008c 0x14 ir.o |
.debug_aranges |
0x000000a0 0x14 analog.o |
.debug_pubnames |
0x00000000 0x701 |
*(.debug_pubnames) |
.debug_pubnames |
0x00000000 0x1e1 main.o |
.debug_pubnames |
0x000001e1 0x240 uart.o |
.debug_pubnames |
0x00000421 0xb7 lcd.o |
.debug_pubnames |
0x000004d8 0x4a printf_P.o |
.debug_pubnames |
0x00000522 0x70 timer0.o |
.debug_pubnames |
0x00000592 0x52 keyboard.o |
.debug_pubnames |
0x000005e4 0x4a menu.o |
.debug_pubnames |
0x0000062e 0x85 ir.o |
.debug_pubnames |
0x000006b3 0x4e analog.o |
.debug_info 0x00000000 0x1a6c |
*(.debug_info) |
.debug_info 0x00000000 0x469 main.o |
.debug_info 0x00000469 0x7ba uart.o |
.debug_info 0x00000c23 0x260 lcd.o |
.debug_info 0x00000e83 0x45d printf_P.o |
.debug_info 0x000012e0 0x1d7 timer0.o |
.debug_info 0x000014b7 0x177 keyboard.o |
.debug_info 0x0000162e 0x1a7 menu.o |
.debug_info 0x000017d5 0x171 ir.o |
.debug_info 0x00001946 0x126 analog.o |
*(.gnu.linkonce.wi.*) |
.debug_abbrev 0x00000000 0x774 |
*(.debug_abbrev) |
.debug_abbrev 0x00000000 0x10c main.o |
.debug_abbrev 0x0000010c 0x178 uart.o |
.debug_abbrev 0x00000284 0xbc lcd.o |
.debug_abbrev 0x00000340 0x132 printf_P.o |
.debug_abbrev 0x00000472 0xc5 timer0.o |
.debug_abbrev 0x00000537 0x87 keyboard.o |
.debug_abbrev 0x000005be 0xb6 menu.o |
.debug_abbrev 0x00000674 0x76 ir.o |
.debug_abbrev 0x000006ea 0x8a analog.o |
.debug_line 0x00000000 0x16a3 |
*(.debug_line) |
.debug_line 0x00000000 0x2aa main.o |
.debug_line 0x000002aa 0x4c4 uart.o |
.debug_line 0x0000076e 0x279 lcd.o |
.debug_line 0x000009e7 0x4e2 printf_P.o |
.debug_line 0x00000ec9 0x180 timer0.o |
.debug_line 0x00001049 0x170 keyboard.o |
.debug_line 0x000011b9 0x19a menu.o |
.debug_line 0x00001353 0x212 ir.o |
.debug_line 0x00001565 0x13e analog.o |
.debug_frame |
*(.debug_frame) |
.debug_str 0x00000000 0x889 |
*(.debug_str) |
.debug_str 0x00000000 0x2e2 main.o |
0x371 (size before relaxing) |
.debug_str 0x000002e2 0x26b uart.o |
0x423 (size before relaxing) |
.debug_str 0x0000054d 0x9a lcd.o |
0x17b (size before relaxing) |
.debug_str 0x000005e7 0xf9 printf_P.o |
0x1bd (size before relaxing) |
.debug_str 0x000006e0 0x6b timer0.o |
0x168 (size before relaxing) |
.debug_str 0x0000074b 0x5e keyboard.o |
0x13f (size before relaxing) |
.debug_str 0x000007a9 0x40 menu.o |
0x15e (size before relaxing) |
.debug_str 0x000007e9 0x6d ir.o |
0x169 (size before relaxing) |
.debug_str 0x00000856 0x33 analog.o |
0x120 (size before relaxing) |
.debug_loc |
*(.debug_loc) |
.debug_macinfo |
*(.debug_macinfo) |
OUTPUT(main.elf elf32-avr) |
Cross Reference Table |
Symbol File |
ADC_Init analog.o |
main.o |
AddCRC uart.o |
AnalogWerte analog.o |
uart.o |
AntwortEingetroffen uart.o |
AnzahlEmpfangsBytes uart.o |
AnzahlTeilnehmer uart.o |
menu.o |
Array menu.o |
BearbeiteRxDaten uart.o |
main.o |
CheckDelay timer0.o |
keyboard.o |
main.o |
ClearIntervalle uart.o |
main.o |
CntCrcError uart.o |
menu.o |
CntDatensaetzeProSekunde main.o |
uart.o |
CountMilliseconds timer0.o |
DatenUebertragung uart.o |
main.o |
DebugGetAnforderung main.o |
DebugIn uart.o |
main.o |
DebugOut uart.o |
main.o |
Debug_Display_Intervall main.o |
Debug_Display_Timer main.o |
Debug_Timer main.o |
Debug_Timer_Intervall main.o |
Decode64 uart.o |
Decodierung_Lauft ir.o |
Delay_ms timer0.o |
main.o |
DisplayBusy uart.o |
timer0.o |
DisplayZeilen main.o |
menu.o |
uart.o |
ErwarteAntwort uart.o |
GetAnalogWerte analog.o |
main.o |
GetKeyboard keyboard.o |
main.o |
GetKeyboard2 keyboard.o |
main.o |
GetVersionAnforderung main.o |
IR_Code ir.o |
timer0.o |
uart.o |
Init main.o |
InitIR ir.o |
main.o |
IntervallDebug main.o |
IntervallDisplay main.o |
KanalAn menu.o |
KanalVon menu.o |
KeyTimer keyboard.o |
Keyboard_Init keyboard.o |
main.o |
LCD_Gotoxy lcd.o |
menu.o |
uart.o |
main.o |
LCD_Init lcd.o |
main.o |
LCD_Putchar lcd.o |
printf_P.o |
LCD_Write lcd.o |
LoescheIrCodeTimer ir.o |
timer0.o |
Menu menu.o |
main.o |
Minute main.o |
NeuerDatensatzEmpfangen uart.o |
New_IR_Code ir.o |
PAD_0 printf_P.o |
PAD_SP printf_P.o |
PC_DebugTimeout uart.o |
PRINT printf_P.o |
PRINTP printf_P.o |
PollDisplay uart.o |
main.o |
ReadADC analog.o |
RxdBuffer uart.o |
Sekunde main.o |
Sekundentakt main.o |
Sekundentakt_Init main.o |
SendIntervalle uart.o |
SendOutData uart.o |
SendeBuffer uart.o |
SendeDummyDaten main.o |
SendeRemoteTasten uart.o |
SetDelay timer0.o |
keyboard.o |
main.o |
SioTmp uart.o |
SlaveAdresse main.o |
menu.o |
uart.o |
TX_DigTransferKanalDaten uart.o |
TX_DigTransferKanalH uart.o |
TX_DigTransferKanalL uart.o |
TestInt menu.o |
Timer1_Init timer0.o |
main.o |
UART_Init uart.o |
main.o |
UebertragungAbgeschlossen uart.o |
UebertragungUnterbrochen main.o |
VersionInfo main.o |
WaitTXD uart.o |
timer0.o |
WriteProgramData uart.o |
_SekTimer main.o |
_TastTimer main.o |
__bad_interrupt C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__brkval C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
__bss_end C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a(_clear_bss.o) |
__bss_start C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a(_clear_bss.o) |
__data_end C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a(_copy_data.o) |
__data_load_start C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a(_copy_data.o) |
__data_start C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a(_copy_data.o) |
__do_clear_bss C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a(_clear_bss.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(calloc.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(iob.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(fdevopen.o) |
analog.o |
ir.o |
menu.o |
keyboard.o |
timer0.o |
printf_P.o |
lcd.o |
uart.o |
main.o |
__do_copy_data C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a(_copy_data.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(calloc.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(iob.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(fdevopen.o) |
analog.o |
ir.o |
menu.o |
keyboard.o |
timer0.o |
printf_P.o |
lcd.o |
uart.o |
main.o |
__flp C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
__heap_end C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
__heap_start C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
__init C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__iob C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(iob.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(fdevopen.o) |
__malloc_heap_end C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
__malloc_heap_start C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
__malloc_margin C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
__stack C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
main.o |
__udivmodsi4 C:/WinAVR/lib/gcc/avr/3.4.5/avr5\libgcc.a(_udivmodsi4.o) |
printf_P.o |
__vector_1 ir.o |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_10 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_11 ir.o |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_12 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_13 uart.o |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_14 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_15 uart.o |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_16 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_17 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_18 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_19 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_2 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_20 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_3 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_4 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_5 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_6 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_7 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_8 C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_9 timer0.o |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vector_default C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
__vectors C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
_lcd_write_4bit lcd.o |
_lcd_write_command lcd.o |
menu.o |
main.o |
_long_delay lcd.o |
menu.o |
main.o |
_printf_P printf_P.o |
menu.o |
uart.o |
main.o |
_short_delay lcd.o |
calloc C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(calloc.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(fdevopen.o) |
fdevopen C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(fdevopen.o) |
uart.o |
free C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
lcd_write_byte lcd.o |
main main.o |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5/crtm32.o |
malloc C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(malloc.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(calloc.o) |
memchr C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(memchr.o) |
printf_P.o |
memset C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(memset.o) |
C:/WinAVR/bin/../lib/gcc/avr/3.4.5/../../../../avr/lib/avr5\libc.a(calloc.o) |
my_pput lcd.o |
uart_putchar uart.o |
/tags/V0.14/main.sym |
---|
0,0 → 1,253 |
00000000 W __heap_end |
00000000 a __tmp_reg__ |
00000000 a __tmp_reg__ |
00000000 a __tmp_reg__ |
00000000 a __tmp_reg__ |
00000000 a __tmp_reg__ |
00000000 a __tmp_reg__ |
00000000 a __tmp_reg__ |
00000000 a __tmp_reg__ |
00000000 a __tmp_reg__ |
00000000 a __tmp_reg__ |
00000000 a __tmp_reg__ |
00000000 a __tmp_reg__ |
00000000 a __tmp_reg__ |
00000000 W __vector_default |
00000000 T __vectors |
00000001 a __zero_reg__ |
00000001 a __zero_reg__ |
00000001 a __zero_reg__ |
00000001 a __zero_reg__ |
00000001 a __zero_reg__ |
00000001 a __zero_reg__ |
00000001 a __zero_reg__ |
00000001 a __zero_reg__ |
00000001 a __zero_reg__ |
00000001 a __zero_reg__ |
00000001 a __zero_reg__ |
00000001 a __zero_reg__ |
00000001 a __zero_reg__ |
0000003d a __SP_L__ |
0000003d a __SP_L__ |
0000003d a __SP_L__ |
0000003d a __SP_L__ |
0000003d a __SP_L__ |
0000003d a __SP_L__ |
0000003d a __SP_L__ |
0000003d a __SP_L__ |
0000003d a __SP_L__ |
0000003d a __SP_L__ |
0000003d a __SP_L__ |
0000003d a __SP_L__ |
0000003d a __SP_L__ |
0000003e a __SP_H__ |
0000003e a __SP_H__ |
0000003e a __SP_H__ |
0000003e a __SP_H__ |
0000003e a __SP_H__ |
0000003e a __SP_H__ |
0000003e a __SP_H__ |
0000003e a __SP_H__ |
0000003e a __SP_H__ |
0000003e a __SP_H__ |
0000003e a __SP_H__ |
0000003e a __SP_H__ |
0000003e a __SP_H__ |
0000003f a __SREG__ |
0000003f a __SREG__ |
0000003f a __SREG__ |
0000003f a __SREG__ |
0000003f a __SREG__ |
0000003f a __SREG__ |
0000003f a __SREG__ |
0000003f a __SREG__ |
0000003f a __SREG__ |
0000003f a __SREG__ |
0000003f a __SREG__ |
0000003f a __SREG__ |
0000003f a __SREG__ |
00000054 t __c.0 |
00000054 T __ctors_end |
00000054 T __ctors_start |
00000054 T __dtors_end |
00000054 T __dtors_start |
00000069 t __c.1 |
0000007e t __c.2 |
00000093 t __c.3 |
000000a8 t __c.2 |
000000ab t __c.3 |
000000ae t __c.4 |
000000b1 t __c.5 |
000000b4 t __c.3 |
000000c2 t __c.4 |
000000d0 t __c.5 |
000000dc t __c.6 |
000000e1 t __c.7 |
000000ea t __c.8 |
000000f6 t __c.9 |
000000fe t __c.10 |
0000010a W __init |
00000116 T __do_copy_data |
00000122 t .do_copy_data_loop |
00000126 t .do_copy_data_start |
0000012c T __do_clear_bss |
00000134 t .do_clear_bss_loop |
00000136 t .do_clear_bss_start |
00000140 T __bad_interrupt |
00000140 W __vector_10 |
00000140 W __vector_12 |
00000140 W __vector_14 |
00000140 W __vector_16 |
00000140 W __vector_17 |
00000140 W __vector_18 |
00000140 W __vector_19 |
00000140 W __vector_2 |
00000140 W __vector_20 |
00000140 W __vector_3 |
00000140 W __vector_4 |
00000140 W __vector_5 |
00000140 W __vector_6 |
00000140 W __vector_7 |
00000140 W __vector_8 |
00000144 T Sekundentakt_Init |
00000156 T Sekundentakt |
000001b4 T Init |
000001ca T main |
000003c6 T __vector_15 |
00000430 T __vector_13 |
000005de T AddCRC |
0000063c T SendOutData |
00000724 T Decode64 |
000007fc T BearbeiteRxDaten |
0000085f W __stack |
0000097a T uart_putchar |
00000996 T WriteProgramData |
00000998 T UART_Init |
000009b4 T SendeRemoteTasten |
00000a14 T SendIntervalle |
00000a5c T ClearIntervalle |
00000aa2 T DatenUebertragung |
00000b92 T _long_delay |
00000bb2 T _short_delay |
00000bc2 T _lcd_write_command |
00000bee T _lcd_write_4bit |
00000c0c T lcd_write_byte |
00000c34 T my_pput |
00000c3e T LCD_Init |
00000caa T LCD_Gotoxy |
00000cf8 T LCD_Write |
00000d2e T LCD_Putchar |
00000d44 T PRINT |
00000d6c T PRINTP |
00000d96 T PAD_SP |
00000dae T PAD_0 |
00000dc6 T _printf_P |
000012ce T __vector_9 |
0000133c T Timer1_Init |
00001350 T SetDelay |
00001362 T CheckDelay |
00001378 T Delay_ms |
00001392 T Keyboard_Init |
000013a4 T GetKeyboard |
000014ae T GetKeyboard2 |
000014c8 T Menu |
000016ce T InitIR |
000016fc T __vector_1 |
0000172c T __vector_11 |
00001884 T ADC_Init |
0000188c T ReadADC |
0000189c T GetAnalogWerte |
000018c8 T memchr |
000018e2 T fdevopen |
00001970 T calloc |
000019a8 T malloc |
00001adc T free |
00001b94 T memset |
00001ba8 T __udivmodsi4 |
00001bb4 t __udivmodsi4_loop |
00001bce t __udivmodsi4_ep |
00001bec A __data_load_start |
00001bec T _etext |
00001c10 A __data_load_end |
00800060 D __data_start |
00800060 D IntervallDisplay |
00800062 D IntervallDebug |
00800064 D SlaveAdresse |
00800065 D DisplayZeilen |
00800066 D CntDatensaetzeProSekunde |
0080006c D AnzahlTeilnehmer |
0080006d D ErwarteAntwort |
0080006e D UebertragungAbgeschlossen |
0080006f d state.0 |
00800070 d KanalSlave.1 |
00800071 D Array |
0080007b d MaxMenue.1 |
0080007c D LoescheIrCodeTimer |
0080007e D __malloc_heap_end |
00800080 D __malloc_heap_start |
00800082 D __malloc_margin |
00800084 B __bss_start |
00800084 D __data_end |
00800084 D _edata |
00800084 B UebertragungUnterbrochen |
00800085 B SendeDummyDaten |
00800086 B GetVersionAnforderung |
00800087 B DebugGetAnforderung |
00800088 B Debug_Display_Intervall |
0080008a B Debug_Timer_Intervall |
0080008c B Minute |
0080008d B Sekunde |
0080008e B _TastTimer |
00800090 B _SekTimer |
00800092 B AntwortEingetroffen |
00800093 B DisplayBusy |
00800094 B TX_DigTransferKanalDaten |
00800095 B TX_DigTransferKanalH |
00800096 B TX_DigTransferKanalL |
00800097 B PC_DebugTimeout |
00800098 B AnzahlEmpfangsBytes |
00800099 B CntCrcError |
0080009b B NeuerDatensatzEmpfangen |
0080009c B SioTmp |
0080009d b ptr.11 |
0080009f b crc.6 |
008000a1 b crc1.7 |
008000a2 b crc2.8 |
008000a3 b buf_ptr.9 |
008000a4 b UartState.10 |
008000a5 B CountMilliseconds |
008000a7 b cnt_10ms.0 |
008000a8 B KeyTimer |
008000aa b taste1.0 |
008000ab b taste2.1 |
008000ac b taste3.2 |
008000ad b taste4.3 |
008000ae b taste5.4 |
008000af B TestInt |
008000b1 b arr.0 |
008000b3 b MenuePunkt.2 |
008000b4 b Shift.0 |
008000b6 b IR_Code_tmp.1 |
008000b8 b IR_Zaehler.2 |
008000b9 b IRSperrCounter.3 |
008000ba B Debug_Timer |
008000bc B Debug_Display_Timer |
008000be B DebugIn |
008000c9 B VersionInfo |
008000d3 B DebugOut |
008000ed B PollDisplay |
008000ee B SendeBuffer |
00800152 B RxdBuffer |
008001b6 B KanalVon |
008001be B KanalAn |
008001c6 B New_IR_Code |
008001c7 B IR_Code |
008001c9 B Decodierung_Lauft |
008001ca B AnalogWerte |
008001d0 B __iob |
008001d6 B __brkval |
008001d8 B __flp |
008001da B __bss_end |
008001da ? __heap_start |
008001da ? _end |
00810000 ? __eeprom_end |
/tags/V0.14/makefile |
---|
0,0 → 1,386 |
#-------------------------------------------------------------------- |
# MCU name |
MCU = atmega168 |
#------------------------------------------------------------------- |
HAUPT_VERSION = 0 |
NEBEN_VERSION = 14 |
#------------------------------------------------------------------- |
# Output format. (can be srec, ihex, binary) |
FORMAT = ihex |
# Target file name (without extension). |
TARGET = MK3Mag_MEGA168_V$(HAUPT_VERSION)_$(NEBEN_VERSION) |
# Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. |
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
OPT = s |
########################################################################################################## |
# List C source files here. (C dependencies are automatically generated.) |
SRC = main.c uart.c timer0.c analog.c twislave.c |
#printf_P.c |
########################################################################################################## |
# If there is more than one source file, append them above, or modify and |
# uncomment the following: |
#SRC += foo.c bar.c |
# You can also wrap lines by appending a backslash to the end of the line: |
#SRC += baz.c \ |
#xyzzy.c |
# List Assembler source files here. |
# Make them always end in a capital .S. Files ending in a lowercase .s |
# will not be considered source files but generated files (assembler |
# output from the compiler), and will be deleted upon "make clean"! |
# Even though the DOS/Win* filesystem matches both .s and .S the same, |
# it will preserve the spelling of the filenames, and gcc itself does |
# care about how the name is spelled on its command-line. |
ASRC = |
# List any extra directories to look for include files here. |
# Each directory must be seperated by a space. |
EXTRAINCDIRS = |
# Optional compiler flags. |
# -g: generate debugging information (for GDB, or for COFF conversion) |
# -O*: optimization level |
# -f...: tuning, see gcc manual and avr-libc documentation |
# -Wall...: warning level |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create assembler listing |
CFLAGS = -g -O$(OPT) \ |
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ |
-Wall -Wstrict-prototypes \ |
-Wa,-adhlns=$(<:.c=.lst) \ |
$(patsubst %,-I%,$(EXTRAINCDIRS)) |
# Set a "language standard" compiler flag. |
# Unremark just one line below to set the language standard to use. |
# gnu99 = C99 + GNU extensions. See GCC manual for more information. |
#CFLAGS += -std=c89 |
#CFLAGS += -std=gnu89 |
#CFLAGS += -std=c99 |
CFLAGS += -std=gnu99 |
CFLAGS += -DVERSION_HAUPTVERSION=$(HAUPT_VERSION) -DVERSION_NEBENVERSION=$(NEBEN_VERSION) |
ifeq ($(AVR_CTRL_PLATINE), 1) |
CFLAGS += -DAVR_CTRL_PLATINE=$(AVR_CTRL_PLATINE) |
endif |
# Optional assembler flags. |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create listing |
# -gstabs: have the assembler create line number information; note that |
# for use in COFF files, additional information about filenames |
# and function names needs to be present in the assembler source |
# files -- see avr-libc docs [FIXME: not yet described there] |
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
# Optional linker flags. |
# -Wl,...: tell GCC to pass this to linker. |
# -Map: create map file |
# --cref: add cross reference to map file |
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref |
# Additional libraries |
# Minimalistic printf version |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_min |
# Floating point printf version (requires -lm below) |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt |
# -lm = math library |
LDFLAGS += -lm |
# Programming support using avrdude. Settings and variables. |
# Programming hardware: alf avr910 avrisp bascom bsd |
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 |
# |
# Type: avrdude -c ? |
# to get a full listing. |
# |
AVRDUDE_PROGRAMMER = dt006 |
#AVRDUDE_PROGRAMMER = stk200 |
#AVRDUDE_PORT = com1 # programmer connected to serial device |
AVRDUDE_PORT = lpt1 # programmer connected to parallel port |
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex |
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
AVRDUDE_FLAGS = -F -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) |
# Uncomment the following if you want avrdude's erase cycle counter. |
# Note that this counter needs to be initialized first using -Yn, |
# see avrdude manual. |
#AVRDUDE_ERASE += -y |
# Uncomment the following if you do /not/ wish a verification to be |
# performed after programming the device. |
#AVRDUDE_FLAGS += -V -E noreset |
# Increase verbosity level. Please use this when submitting bug |
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> |
# to submit bug reports. |
#AVRDUDE_FLAGS += -v -v |
# --------------------------------------------------------------------------- |
# Define directories, if needed. |
DIRAVR = c:/winavr |
DIRAVRBIN = $(DIRAVR)/bin |
DIRAVRUTILS = $(DIRAVR)/utils/bin |
DIRINC = . |
DIRLIB = $(DIRAVR)/avr/lib |
# Define programs and commands. |
SHELL = sh |
CC = avr-gcc |
OBJCOPY = avr-objcopy |
OBJDUMP = avr-objdump |
SIZE = avr-size |
# Programming support using avrdude. |
AVRDUDE = avrdude |
REMOVE = rm -f |
COPY = cp |
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
ELFSIZE = $(SIZE) -A $(TARGET).elf |
# Define Messages |
# English |
MSG_ERRORS_NONE = Errors: none |
MSG_BEGIN = -------- begin -------- |
MSG_END = -------- end -------- |
MSG_SIZE_BEFORE = Size before: |
MSG_SIZE_AFTER = Size after: |
MSG_COFF = Converting to AVR COFF: |
MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
MSG_FLASH = Creating load file for Flash: |
MSG_EEPROM = Creating load file for EEPROM: |
MSG_EXTENDED_LISTING = Creating Extended Listing: |
MSG_SYMBOL_TABLE = Creating Symbol Table: |
MSG_LINKING = Linking: |
MSG_COMPILING = Compiling: |
MSG_ASSEMBLING = Assembling: |
MSG_CLEANING = Cleaning project: |
# Define all object files. |
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) |
# Define all listing files. |
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) |
# Combine all necessary flags and optional flags. |
# Add target processor to flags. |
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
# Default target. |
all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ |
$(TARGET).lss $(TARGET).sym sizeafter finished end |
# Eye candy. |
# AVR Studio 3.x does not check make's exit code but relies on |
# the following magic strings to be generated by the compile job. |
begin: |
@echo |
@echo $(MSG_BEGIN) |
finished: |
@echo $(MSG_ERRORS_NONE) |
end: |
@echo $(MSG_END) |
@echo |
# Display size of file. |
sizebefore: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi |
sizeafter: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi |
# Display compiler version information. |
gccversion : |
@$(CC) --version |
# Convert ELF to COFF for use in debugging / simulating in |
# AVR Studio or VMLAB. |
COFFCONVERT=$(OBJCOPY) --debugging \ |
--change-section-address .data-0x800000 \ |
--change-section-address .bss-0x800000 \ |
--change-section-address .noinit-0x800000 \ |
--change-section-address .eeprom-0x810000 |
coff: $(TARGET).elf |
@echo |
@echo $(MSG_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof |
extcoff: $(TARGET).elf |
@echo |
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof |
# Program the device. |
program: $(TARGET).hex $(TARGET).eep |
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
# Create final output files (.hex, .eep) from ELF output file. |
%.hex: %.elf |
@echo |
@echo $(MSG_FLASH) $@ |
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ |
%.eep: %.elf |
@echo |
@echo $(MSG_EEPROM) $@ |
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ |
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@ |
# Create extended listing file from ELF output file. |
%.lss: %.elf |
@echo |
@echo $(MSG_EXTENDED_LISTING) $@ |
$(OBJDUMP) -h -S $< > $@ |
# Create a symbol table from ELF output file. |
%.sym: %.elf |
@echo |
@echo $(MSG_SYMBOL_TABLE) $@ |
avr-nm -n $< > $@ |
# Link: create ELF output file from object files. |
.SECONDARY : $(TARGET).elf |
.PRECIOUS : $(OBJ) |
%.elf: $(OBJ) |
@echo |
@echo $(MSG_LINKING) $@ |
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) |
# Compile: create object files from C source files. |
%.o : %.c |
@echo |
@echo $(MSG_COMPILING) $< |
$(CC) -c $(ALL_CFLAGS) $< -o $@ |
# Compile: create assembler files from C source files. |
%.s : %.c |
$(CC) -S $(ALL_CFLAGS) $< -o $@ |
# Assemble: create object files from assembler source files. |
%.o : %.S |
@echo |
@echo $(MSG_ASSEMBLING) $< |
$(CC) -c $(ALL_ASFLAGS) $< -o $@ |
# Target: clean project. |
clean: begin clean_list finished end |
clean_list : |
@echo |
@echo $(MSG_CLEANING) |
# $(REMOVE) $(TARGET).hex |
# $(REMOVE) $(TARGET).eep |
# $(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).cof |
$(REMOVE) $(TARGET).elf |
$(REMOVE) $(TARGET).map |
$(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).a90 |
$(REMOVE) $(TARGET).sym |
$(REMOVE) $(TARGET).lnk |
$(REMOVE) $(TARGET).lss |
$(REMOVE) $(OBJ) |
$(REMOVE) $(LST) |
$(REMOVE) $(SRC:.c=.s) |
$(REMOVE) $(SRC:.c=.d) |
# Automatically generate C source code dependencies. |
# (Code originally taken from the GNU make user manual and modified |
# (See README.txt Credits).) |
# |
# Note that this will work with sh (bash) and sed that is shipped with WinAVR |
# (see the SHELL variable defined above). |
# This may not work with other shells or other seds. |
# |
%.d: %.c |
set -e; $(CC) -MM $(ALL_CFLAGS) $< \ |
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ |
[ -s $@ ] || rm -f $@ |
# Remove the '-' if you want to see the dependency files generated. |
-include $(SRC:.c=.d) |
# Listing of phony targets. |
.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ |
clean clean_list program |
/tags/V0.14/old_macros.h |
---|
0,0 → 1,47 |
/* |
For backwards compatibility only. |
Ingo Busker ingo@mikrocontroller.com |
*/ |
#ifndef cbi |
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) |
#endif |
#ifndef sbi |
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) |
#endif |
#ifndef inb |
#define inb(sfr) _SFR_BYTE(sfr) |
#endif |
#ifndef outb |
#define outb(sfr, val) (_SFR_BYTE(sfr) = (val)) |
#endif |
#ifndef inw |
#define inw(sfr) _SFR_WORD(sfr) |
#endif |
#ifndef outw |
#define outw(sfr, val) (_SFR_WORD(sfr) = (val)) |
#endif |
#ifndef outp |
#define outp(val, sfr) outb(sfr, val) |
#endif |
#ifndef inp |
#define inp(sfr) inb(sfr) |
#endif |
#ifndef BV |
#define BV(bit) _BV(bit) |
#endif |
#ifndef PRG_RDB |
#define PRG_RDB pgm_read_byte |
#endif |
/tags/V0.14/timer0.c |
---|
0,0 → 1,128 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
volatile unsigned int CountMilliseconds = 0; |
volatile unsigned char Timer0Overflow; |
unsigned int I2C_Timeout = 0; |
unsigned int SIO_Timeout = 0; |
enum { |
STOP = 0, |
CK = 1, |
CK8 = 2, |
CK64 = 3, |
CK256 = 4, |
CK1024 = 5, |
T0_FALLING_EDGE = 6, |
T0_RISING_EDGE = 7 |
}; |
SIGNAL(SIG_OVERFLOW0) |
{ |
static unsigned char cnt; |
static unsigned int cmps_cnt; |
TCNT0 -= 101; // reload |
Timer0Overflow++; |
if(++cmps_cnt == 380) |
{ |
PORTB |= 0x04; |
cmps_cnt = 0; |
} |
else |
if(cmps_cnt == PwmHeading) |
{ |
PORTB &= ~0x04; |
} |
if(!--cnt) |
{ |
cnt = 10; |
CountMilliseconds += 1; |
if(I2C_Timeout) I2C_Timeout--; |
if(SIO_Timeout) SIO_Timeout--; |
} |
} |
void Timer0_Init(void) |
{ |
TCCR0B = TIMER_TEILER; // Starten des Timers |
// TCNT0 = 100; // reload |
TIM0_START; |
TIMER2_INT_ENABLE; |
} |
unsigned int SetDelay(unsigned int t) |
{ |
return(CountMilliseconds + t - 1); |
} |
char CheckDelay (unsigned int t) |
{ |
return(((t - CountMilliseconds) & 0x8000) >> 8); |
} |
void Delay_ms(unsigned int w) |
{ |
unsigned int akt; |
akt = SetDelay(w); |
while (!CheckDelay(akt)); |
} |
/tags/V0.14/timer0.h |
---|
0,0 → 1,15 |
#define TIMER_TEILER CK8 |
//#define TIMER_RELOAD_VALUE 125 |
extern volatile unsigned int CountMilliseconds; |
extern volatile unsigned char Timer0Overflow; |
extern unsigned int I2C_Timeout; |
extern unsigned int SIO_Timeout; |
void Timer1_Init(void); |
void Delay_ms(unsigned int); |
unsigned int SetDelay (unsigned int t); |
char CheckDelay (unsigned int t); |
/tags/V0.14/twislave.c |
---|
0,0 → 1,201 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <avr/io.h> |
#include <util/twi.h> |
#include "main.h" |
unsigned char I2C_RxBufferSize, I2C_TxBufferSize; |
unsigned char *I2C_TxBuffer, *I2C_RxBuffer; |
unsigned char Tx_Idx=0, Rx_Idx=0, I2C_Direction; |
unsigned char I2C_Command; |
unsigned char Tx_Idx, Rx_Idx; |
struct str_I2C_Heading I2C_Heading; |
struct str_I2C_WriteNickRoll I2C_WriteNickRoll; |
struct str_I2C_Mag I2C_Mag; |
struct str_I2C_EEPROM I2C_ReadEEPROM, I2C_WriteEEPROM; |
struct str_I2C_Version I2C_Version; |
struct str_I2C_WriteCal I2C_WriteCal; |
//############################################################################ |
//I2C (TWI) Interface Init |
void InitIC2_Slave(void) |
//############################################################################ |
{ |
TWAR = I2C_SLAVE_ADDRESS; // Eigene Adresse setzen |
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWIE) | (1<<TWEA); |
I2C_Version.Hauptversion = VersionInfo.Hauptversion; |
I2C_Version.Nebenversion = VersionInfo.Nebenversion; |
I2C_Version.Comp = 1; |
} |
#define TWCR_ACK TWCR = (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(1<<TWEA)|(0<<TWSTA)|(0<<TWSTO)|(0<<TWWC) |
//############################################################################ |
//ISR, die bei einem Ereignis auf dem Bus ausgelöst wird. Im Register TWSR befindet |
//sich dann ein Statuscode, anhand dessen die Situation festgestellt werden kann. |
ISR (TWI_vect) |
//############################################################################ |
{ |
switch (TWSR & 0xF8) |
{ |
case SR_SLA_ACK: |
//TWCR |= (1<<TWINT); |
Rx_Idx = 0; |
TWCR_ACK; |
return; |
// Daten Empfangen |
case SR_PREV_ACK: |
if (Rx_Idx == 0) |
{ I2C_Command = TWDR; |
switch(I2C_Command) |
{ |
case I2C_CMD_VERSION: |
I2C_TxBuffer = (unsigned char *)&I2C_Version; |
I2C_TxBufferSize = sizeof(I2C_Version); |
I2C_RxBufferSize = 0; |
break; |
case I2C_CMD_WRITE_EEPROM: |
I2C_TxBufferSize = 0; |
I2C_RxBuffer = (unsigned char *)&I2C_WriteEEPROM; |
I2C_RxBufferSize = sizeof(I2C_WriteEEPROM); |
break; |
case I2C_CMD_WRITE_CAL: |
I2C_TxBufferSize = 0; |
I2C_RxBuffer = (unsigned char *)&I2C_WriteCal; |
I2C_RxBufferSize = sizeof(I2C_WriteCal); |
break; |
case I2C_CMD_READ_EEPROM: |
I2C_TxBuffer = (unsigned char *)&I2C_ReadEEPROM.Inhalt; |
I2C_TxBufferSize = 2; |
I2C_RxBuffer = (unsigned char *)&I2C_ReadEEPROM; |
I2C_RxBufferSize = 1; |
break; |
case I2C_CMD_READ_MAG: |
I2C_TxBuffer = (unsigned char *)&I2C_Mag; |
I2C_TxBufferSize = sizeof(I2C_Mag); |
I2C_RxBufferSize = 0; |
I2C_Mag.MagX = MagnetN; |
I2C_Mag.MagY = MagnetR; |
I2C_Mag.MagZ = MagnetZ; |
break; |
case I2C_CMD_READ_HEADING: |
I2C_TxBuffer = (unsigned char *)&I2C_Heading; |
I2C_TxBufferSize = sizeof(I2C_Heading); |
I2C_RxBuffer = (unsigned char *)&I2C_WriteNickRoll; |
I2C_RxBufferSize = sizeof(I2C_WriteNickRoll); |
I2C_Heading.Heading = Heading; |
ExternData.Winkel[NICK] = I2C_WriteNickRoll.Nick; |
ExternData.Winkel[ROLL] = I2C_WriteNickRoll.Roll; |
break; |
} |
} |
else |
{ |
if ((Rx_Idx-1) < I2C_RxBufferSize) I2C_RxBuffer[Rx_Idx-1] = TWDR; |
} |
Rx_Idx++; |
I2C_Timeout = 500; |
//TWCR |= (1<<TWINT); |
TWCR_ACK; |
return; |
// Daten Senden |
case SW_SLA_ACK: |
Tx_Idx = 0; |
if (I2C_TxBufferSize > 0) TWDR = I2C_TxBuffer[Tx_Idx++]; |
// TWCR |= (1<<TWINT) | (1<< TWEA); |
TWCR_ACK; |
return; |
// Daten Senden |
case SW_DATA_ACK: |
if (Tx_Idx < I2C_TxBufferSize) TWDR = I2C_TxBuffer[Tx_Idx++]; |
else TWDR = 0x00; |
//TWCR |= (1<<TWINT) | (1<< TWEA); |
TWCR_ACK; |
return; |
// Bus-Fehler zurücksetzen |
case TWI_BUS_ERR_2: |
TWCR |=(1<<TWSTO) | (1<<TWINT); |
// Bus-Fehler zurücksetzen |
case TWI_BUS_ERR_1: |
TWCR |=(1<<TWSTO) | (1<<TWINT); |
} |
TWCR =(1<<TWEA) | (1<<TWINT) | (1<<TWEN) | (1<<TWIE); // TWI Reset |
} |
/tags/V0.14/twislave.h |
---|
0,0 → 1,86 |
#ifndef _TWI_SLAVE_H_ |
#define _TWI_SLAVE_H_ |
#define I2C_SLAVE_ADDRESS 0x50 |
#define I2C_CMD_VERSION 0x01 |
struct str_I2C_Version |
{ |
unsigned char Hauptversion; |
unsigned char Nebenversion; |
unsigned char Comp; |
} ; |
#define I2C_CMD_WRITE_EEPROM 0x0A |
#define I2C_CMD_READ_EEPROM 0x0B |
struct str_I2C_EEPROM |
{ |
unsigned char Adresse; |
unsigned int Inhalt; |
} ; |
#define I2C_CMD_READ_MAG 0x02 |
struct str_I2C_Mag |
{ |
int MagX; |
int MagY; |
int MagZ; |
} ; |
#define I2C_CMD_READ_HEADING 0x03 |
struct str_I2C_WriteNickRoll |
{ |
int Nick; |
int Roll; |
} ; |
#define I2C_CMD_WRITE_CAL 0x04 |
struct str_I2C_WriteCal |
{ |
unsigned char CalByte; |
unsigned char Dummy1; |
unsigned char Dummy2; |
} ; |
struct str_I2C_Heading |
{ |
unsigned int Heading; |
} ; |
extern unsigned char Tx_Idx, Rx_Idx, I2C_Direction; |
extern struct str_I2C_Heading I2C_Heading; |
extern struct str_I2C_WriteNickRoll I2C_WriteNickRoll; |
extern struct str_I2C_Mag I2C_Mag; |
extern struct str_I2C_EEPROM I2C_ReadEEPROM, I2C_WriteEEPROM; |
extern struct str_I2C_Version I2C_Version; |
extern struct str_I2C_WriteCal I2C_WriteCal; |
extern void InitIC2_Slave (void); |
#define TWI_BUS_ERR_1 0x00 |
#define TWI_BUS_ERR_2 0xF8 |
// Status Slave RX Mode |
#define SR_SLA_ACK 0x60 |
#define SR_LOST_ACK 0x68 |
#define SR_GEN_CALL_ACK 0x70 |
#define GEN_LOST_ACK 0x78 |
#define SR_PREV_ACK 0x80 |
#define SR_PREV_NACK 0x88 |
#define GEN_PREV_ACK 0x90 |
#define GEN_PREV_NACK 0x98 |
#define STOP_CONDITION 0xA0 |
#define REPEATED_START 0xA0 |
// Status Slave TX mode |
#define SW_SLA_ACK 0xA8 |
#define SW_LOST_ACK 0xB0 |
#define SW_DATA_ACK 0xB8 |
#define SW_DATA_NACK 0xC0 |
#define SW_LAST_ACK 0xC8 |
#endif |
/tags/V0.14/uart.c |
---|
0,0 → 1,478 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
#include "uart.h" |
#define MAX_SENDE_BUFF 100 |
#define MAX_EMPFANGS_BUFF 100 |
unsigned volatile char SIO_Sollwert = 0; |
unsigned volatile char SioTmp = 0; |
unsigned volatile char SendeBuffer[MAX_SENDE_BUFF]; |
unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF]; |
unsigned volatile char NeuerDatensatzEmpfangen = 0; |
unsigned volatile char UebertragungAbgeschlossen = 1; |
unsigned char GetVersionAnforderung = 0,DebugTextAnforderung = 0,DebugGetAnforderung = 0, KompassAntwort = 0; |
unsigned char MeineSlaveAdresse; |
unsigned char MotorTest[4] = {0,0,0,0}; |
unsigned volatile char AnzahlEmpfangsBytes = 0; |
unsigned char PcZugriff; |
struct str_DebugOut DebugOut; |
struct str_ExternData ExternData; |
struct str_ExternControl ExternControl; |
struct str_VersionInfo VersionInfo; |
int Debug_Timer; |
const unsigned char ANALOG_TEXT[32][16] = |
{ |
//1234567890123456 |
"Magnet N ", //0 |
"Magnet R ", |
"Magnet Z ", |
"Raw N ", |
"Raw R ", |
"Raw Z ", //5 |
"Lage N ", |
"Lage R ", |
"Xmin ", |
"Xmax ", |
"Ymin ", //10 |
"Ymax ", |
"Zmin ", |
"ZMax ", |
"Calstate ", |
"Kompass ", //15 |
"User0 ", |
"User1 ", |
"Analog18 ", |
"Analog19 ", |
"Analog20 ", //20 |
"Analog21 ", |
"Analog22 ", |
"Analog23 ", |
"Analog24 ", |
"Analog25 ", //25 |
"Analog26 ", |
"Analog27 ", |
"Analog28 ", |
"Analog29 ", |
"Analog30 ", //30 |
"Analog31 " |
}; |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//++ Sende-Part der Datenübertragung |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
SIGNAL(INT_VEC_TX) |
{ |
static unsigned int ptr = 0; |
unsigned char tmp_tx; |
if(!UebertragungAbgeschlossen) |
{ |
ptr++; // die [0] wurde schon gesendet |
tmp_tx = SendeBuffer[ptr]; |
if((tmp_tx == '\r') || (ptr == MAX_SENDE_BUFF)) |
{ |
ptr = 0; |
UebertragungAbgeschlossen = 1; |
} |
UDR = tmp_tx; |
} |
else ptr = 0; |
} |
void SendUart(void) |
{ |
static unsigned int ptr = 0; |
unsigned char tmp_tx; |
if(!(USR & 0x40)) return; |
if(!UebertragungAbgeschlossen) |
{ |
ptr++; // die [0] wurde schon gesendet |
tmp_tx = SendeBuffer[ptr]; |
if((tmp_tx == '\r') || (ptr == MAX_SENDE_BUFF)) |
{ |
ptr = 0; |
UebertragungAbgeschlossen = 1; |
} |
USR |= (1<TXC0); |
UDR = tmp_tx; |
} |
else ptr = 0; |
} |
// -------------------------------------------------------------------------- |
void Decode64(unsigned char *ptrOut, unsigned char len, unsigned char ptrIn,unsigned char max) // Wohin mit den Daten; Wie lang; Wo im RxdBuffer |
{ |
unsigned char a,b,c,d; |
unsigned char ptr = 0; |
unsigned char x,y,z; |
while(len) |
{ |
a = RxdBuffer[ptrIn++] - '='; |
b = RxdBuffer[ptrIn++] - '='; |
c = RxdBuffer[ptrIn++] - '='; |
d = RxdBuffer[ptrIn++] - '='; |
if(ptrIn > max - 2) break; // nicht mehr Daten verarbeiten, als empfangen wurden |
x = (a << 2) | (b >> 4); |
y = ((b & 0x0f) << 4) | (c >> 2); |
z = ((c & 0x03) << 6) | d; |
if(len--) ptrOut[ptr++] = x; else break; |
if(len--) ptrOut[ptr++] = y; else break; |
if(len--) ptrOut[ptr++] = z; else break; |
} |
} |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//++ Empfangs-Part der Datenübertragung |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
SIGNAL(INT_VEC_RX) |
{ |
static unsigned int crc; |
static unsigned char crc1,crc2,buf_ptr; |
static unsigned char UartState = 0; |
unsigned char CrcOkay = 0; |
SioTmp = UDR; |
if(buf_ptr >= MAX_EMPFANGS_BUFF) UartState = 0; |
if(SioTmp == '\r' && UartState == 2) |
{ |
UartState = 0; |
crc -= RxdBuffer[buf_ptr-2]; |
crc -= RxdBuffer[buf_ptr-1]; |
crc %= 4096; |
crc1 = '=' + crc / 64; |
crc2 = '=' + crc % 64; |
CrcOkay = 0; |
if((crc1 == RxdBuffer[buf_ptr-2]) && (crc2 == RxdBuffer[buf_ptr-1])) CrcOkay = 1; else { CrcOkay = 0; }; |
if(CrcOkay) // Datensatz schon verarbeitet |
{ |
NeuerDatensatzEmpfangen = 1; |
AnzahlEmpfangsBytes = buf_ptr; |
RxdBuffer[buf_ptr] = '\r'; |
if((RxdBuffer[2] == 'R')) wdt_enable(WDTO_250MS); // Reset-Commando |
// uart_putchar(RxdBuffer[2]); |
} |
} |
else |
switch(UartState) |
{ |
case 0: |
if(SioTmp == '#' && !NeuerDatensatzEmpfangen) UartState = 1; // Startzeichen und Daten schon verarbeitet |
buf_ptr = 0; |
RxdBuffer[buf_ptr++] = SioTmp; |
crc = SioTmp; |
break; |
case 1: // Adresse auswerten |
UartState++; |
RxdBuffer[buf_ptr++] = SioTmp; |
crc += SioTmp; |
break; |
case 2: // Eingangsdaten sammeln |
RxdBuffer[buf_ptr] = SioTmp; |
if(buf_ptr < MAX_EMPFANGS_BUFF) buf_ptr++; |
else UartState = 0; |
crc += SioTmp; |
break; |
default: |
UartState = 0; |
break; |
} |
}; |
// -------------------------------------------------------------------------- |
void AddCRC(unsigned int wieviele) |
{ |
unsigned int tmpCRC = 0,i; |
for(i = 0; i < wieviele;i++) |
{ |
tmpCRC += SendeBuffer[i]; |
} |
tmpCRC %= 4096; |
SendeBuffer[i++] = '=' + tmpCRC / 64; |
SendeBuffer[i++] = '=' + tmpCRC % 64; |
SendeBuffer[i++] = '\r'; |
UebertragungAbgeschlossen = 0; |
UDR = SendeBuffer[0]; |
} |
// -------------------------------------------------------------------------- |
void SendOutData(unsigned char cmd,unsigned char modul, unsigned char *snd, unsigned char len) |
{ |
unsigned int pt = 0; |
unsigned char a,b,c; |
unsigned char ptr = 0; |
SendeBuffer[pt++] = '#'; // Startzeichen |
SendeBuffer[pt++] = modul; // Adresse (a=0; b=1,...) |
SendeBuffer[pt++] = cmd; // Commando |
while(len) |
{ |
if(len) { a = snd[ptr++]; len--;} else a = 0; |
if(len) { b = snd[ptr++]; len--;} else b = 0; |
if(len) { c = snd[ptr++]; len--;} else c = 0; |
SendeBuffer[pt++] = '=' + (a >> 2); |
SendeBuffer[pt++] = '=' + (((a & 0x03) << 4) | ((b & 0xf0) >> 4)); |
SendeBuffer[pt++] = '=' + (((b & 0x0f) << 2) | ((c & 0xc0) >> 6)); |
SendeBuffer[pt++] = '=' + ( c & 0x3f); |
} |
AddCRC(pt); |
} |
//############################################################################ |
//Routine für die Serielle Ausgabe |
int uart_putchar (char c) |
//############################################################################ |
{ |
if(!(UCR & (1 << TXEN))) return (0); |
if (c == '\n') |
uart_putchar('\r'); |
//Warten solange bis Zeichen gesendet wurde |
loop_until_bit_is_set(USR, UDRE); |
//Ausgabe des Zeichens |
UDR = c; |
return (0); |
} |
// -------------------------------------------------------------------------- |
void WriteProgramData(unsigned int pos, unsigned char wert) |
{ |
} |
//############################################################################ |
//INstallation der Seriellen Schnittstelle |
void UART_Init (void) |
//############################################################################ |
{ |
//Enable TXEN im Register UCR TX-Data Enable & RX Enable |
UCR=(1 << TXEN) | (1 << RXEN); |
// UART Double Speed (U2X) |
USR |= (1<<U2X); |
// RX-Interrupt Freigabe |
UCSRB |= (1<<RXCIE); // serieller Empfangsinterrupt |
// TX-Interrupt Freigabe |
UCSRB |= (1<<TXCIE); |
//Teiler wird gesetzt |
UBRR= (SYSCLK / (BAUD_RATE * 8L) -1 ); |
//öffnet einen Kanal für printf (STDOUT) |
// fdevopen (uart_putchar, NULL); |
Debug_Timer = SetDelay(200); |
// Version beim Start ausgeben (nicht schön, aber geht... ) |
uart_putchar ('\n');uart_putchar ('C');uart_putchar ('P');uart_putchar (':'); |
uart_putchar ('V');uart_putchar (0x30 + VERSION_HAUPTVERSION);uart_putchar ('.');uart_putchar (0x30 + VERSION_NEBENVERSION/10); uart_putchar (0x30 + VERSION_NEBENVERSION%10); |
uart_putchar ('\n'); |
} |
void BearbeiteRxDaten(void) |
{ |
if(!NeuerDatensatzEmpfangen) return; |
// unsigned int tmp_int_arr1[1]; |
// unsigned int tmp_int_arr2[2]; |
// unsigned int tmp_int_arr3[3]; |
unsigned char tmp_char_arr2[2]; |
// unsigned char tmp_char_arr3[3]; |
// unsigned char tmp_char_arr4[4]; |
//if(!MotorenEin) |
PcZugriff = 255; |
switch(RxdBuffer[2]) |
{ |
case 'w':// Lagewinkel |
Decode64((unsigned char *) &ExternData,sizeof(ExternData),3,AnzahlEmpfangsBytes); |
DebugOut.Analog[15]++; |
KompassAntwort = 1; |
break; |
case 'c': |
case 'b': |
Decode64((unsigned char *) &ExternControl,sizeof(ExternControl),3,AnzahlEmpfangsBytes); |
ExternData.Winkel[0] = ExternControl.Par1; |
ExternData.Winkel[1] = ExternControl.Par2; |
break; |
case 'v': // Version-Anforderung und Ausbaustufe |
GetVersionAnforderung = 1; |
PC_Connected = 255; |
break; |
case 'a':// Texte der Analogwerte |
Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes); |
DebugTextAnforderung = tmp_char_arr2[0]; |
PC_Connected = 255; |
break; |
case 'g':// "Get"-Anforderung für Debug-Daten |
// Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
PC_Connected = 255; |
DebugGetAnforderung = 1; |
break; |
case 'h':// x-1 Displayzeilen |
PC_Connected = 255; |
break; |
/* |
case 'b': |
Decode64((unsigned char *) &ExternControl,sizeof(ExternControl),3,AnzahlEmpfangsBytes); |
RemoteTasten |= ExternControl.RemoteTasten; |
ConfirmFrame = ExternControl.Frame; |
break; |
case 'c': |
Decode64((unsigned char *) &ExternControl,sizeof(ExternControl),3,AnzahlEmpfangsBytes); |
RemoteTasten |= ExternControl.RemoteTasten; |
ConfirmFrame = ExternControl.Frame; |
DebugDataAnforderung = 1; |
break; |
case 'h':// x-1 Displayzeilen |
Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes); |
RemoteTasten |= tmp_char_arr2[0]; |
if(tmp_char_arr2[1] == 255) NurKanalAnforderung = 1; else NurKanalAnforderung = 0; // keine Displaydaten |
DebugDisplayAnforderung = 1; |
break; |
case 't':// Motortest |
Decode64((unsigned char *) &MotorTest[0],sizeof(MotorTest),3,AnzahlEmpfangsBytes); |
break; |
case 'k':// Keys von DubWise |
Decode64((unsigned char *) &DubWiseKeys[0],sizeof(DubWiseKeys),3,AnzahlEmpfangsBytes); |
ConfirmFrame = DubWiseKeys[3]; |
break; |
case 'q':// "Get"-Anforderung für Settings |
// Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes); |
if(tmp_char_arr2[0] != 0xff) |
{ |
if(tmp_char_arr2[0] > 5) tmp_char_arr2[0] = 5; |
ReadParameterSet(tmp_char_arr2[0], (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
SendOutData('L' + tmp_char_arr2[0] -1,MeineSlaveAdresse,(unsigned char *) &EE_Parameter.Kanalbelegung[0],STRUCT_PARAM_LAENGE); |
} |
else |
SendOutData('L' + GetActiveParamSetNumber()-1,MeineSlaveAdresse,(unsigned char *) &EE_Parameter.Kanalbelegung[0],STRUCT_PARAM_LAENGE); |
break; |
case 'l': |
case 'm': |
case 'n': |
case 'o': |
case 'p': // Parametersatz speichern |
Decode64((unsigned char *) &EE_Parameter.Kanalbelegung[0],STRUCT_PARAM_LAENGE,3,AnzahlEmpfangsBytes); |
WriteParameterSet(RxdBuffer[2] - 'l' + 1, (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], RxdBuffer[2] - 'l' + 1); // aktiven Datensatz merken |
Umschlag180Nick = (long) EE_Parameter.WinkelUmschlagNick * 2500L; |
Umschlag180Roll = (long) EE_Parameter.WinkelUmschlagRoll * 2500L; |
Piep(GetActiveParamSetNumber()); |
break; |
*/ |
} |
// DebugOut.AnzahlZyklen = Debug_Timer_Intervall; |
NeuerDatensatzEmpfangen = 0; |
} |
//--------------------------------------------------------------------------------------------- |
void DatenUebertragung(void) |
{ |
if((CheckDelay(Debug_Timer) && UebertragungAbgeschlossen)) // im Singlestep-Betrieb in jedem Schtitt senden |
{ |
SetDebugValues(); |
SendOutData('D',MeineSlaveAdresse,(unsigned char *) &DebugOut,sizeof(DebugOut)); |
Debug_Timer = SetDelay(250); // Sendeintervall |
} |
if(GetVersionAnforderung && UebertragungAbgeschlossen) |
{ |
SendOutData('V',MeineSlaveAdresse,(unsigned char *) &VersionInfo,sizeof(VersionInfo)); |
GetVersionAnforderung = 0; |
} |
if(DebugTextAnforderung != 255) // Texte für die Analogdaten |
{ |
SendOutData('A',DebugTextAnforderung + '0',(unsigned char *) ANALOG_TEXT[DebugTextAnforderung],16); |
DebugTextAnforderung = 255; |
} |
if(DebugGetAnforderung && UebertragungAbgeschlossen) // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
{ |
SendOutData('G',MeineSlaveAdresse,(unsigned char *) &ExternControl,sizeof(ExternControl)); |
DebugGetAnforderung = 0; |
} |
if(KompassAntwort && UebertragungAbgeschlossen) // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
{ |
SendOutData('K',MeineSlaveAdresse,(unsigned char *) &I2C_Heading,sizeof(I2C_Heading)); |
KompassAntwort = 0; |
} |
} |
/tags/V0.14/uart.h |
---|
0,0 → 1,135 |
#ifndef _UART_H |
#define _UART_H |
extern unsigned volatile char SIO_Sollwert; |
extern unsigned volatile char UebertragungAbgeschlossen; |
extern unsigned volatile char PC_DebugTimeout; |
extern unsigned char MeineSlaveAdresse; |
extern int Debug_Timer; |
extern void UART_Init (void); |
extern int uart_putchar (char c); |
extern void boot_program_page (uint32_t page, uint8_t *buf); |
extern void SendUart(void); |
void DatenUebertragung(void); |
struct str_DebugOut |
{ |
unsigned char Digital[2]; |
unsigned int Analog[32]; // Debugwerte |
}; |
struct str_ExternData |
{ |
signed int Winkel[2]; // in 0,1 degree |
unsigned char UserParameter[2]; |
unsigned char CalState; |
unsigned char Orientation; |
}; |
extern struct str_ExternData ExternData; |
#define NICK 0 |
#define ROLL 1 |
struct str_ExternControl |
{ |
unsigned char Digital[2]; |
unsigned char RemoteTasten; |
signed char Nick; |
signed char Roll; |
signed char Gier; |
unsigned char Gas; |
signed char Hight; |
unsigned char Par1; |
unsigned char Par2; |
unsigned char Par3; |
}; |
extern struct str_ExternControl ExternControl; |
struct str_VersionInfo |
{ |
unsigned char Hauptversion; |
unsigned char Nebenversion; |
unsigned char PCKompatibel; |
unsigned char Rserved[7]; |
}; |
extern struct str_VersionInfo VersionInfo; |
extern struct str_DebugOut DebugOut; |
extern struct str_DebugOut DebugOut; |
//Die Baud_Rate der Seriellen Schnittstelle |
//#define BAUD_RATE 9600 //Baud Rate für die Serielle Schnittstelle |
//#define BAUD_RATE 14400 //Baud Rate für die Serielle Schnittstelle |
//#define BAUD_RATE 28800 //Baud Rate für die Serielle Schnittstelle |
#if X3D_SIO == 1 |
#define BAUD_RATE 38400 //Baud Rate für die Serielle Schnittstelle |
#else |
#define BAUD_RATE 57600 //Baud Rate für die Serielle Schnittstelle |
#endif |
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird |
#if defined (__AVR_ATmega128__) |
# define USR UCSR0A |
# define UCR UCSR0B |
# define UDR UDR0 |
# define UBRR UBRR0L |
# define EICR EICRB |
#endif |
#if defined (__AVR_ATmega8__) |
# define USR UCSRA |
# define UCR UCSRB |
# define UBRR UBRRL |
# define EICR EICRB |
# define INT_VEC_RX SIG_UART_RECV |
# define INT_VEC_TX SIG_UART_TRANS |
#endif |
#if defined (__AVR_ATmega168__) |
# define USR UCSR0A |
# define UCR UCSR0B |
# define UDR UDR0 |
# define UBRR UBRR0L |
# define EICR EICR0B |
# define TXEN TXEN0 |
# define RXEN RXEN0 |
# define RXCIE RXCIE0 |
# define TXCIE TXCIE0 |
# define U2X U2X0 |
# define UCSRB UCSR0B |
# define UDRE UDRE0 |
# define INT_VEC_RX SIG_USART_RECV |
# define INT_VEC_TX SIG_USART_TRANS |
#endif |
#if defined (__AVR_ATmega32__) |
# define USR UCSRA |
# define UCR UCSRB |
# define UBRR UBRRL |
# define EICR EICRB |
# define INT_VEC_RX SIG_UART_RECV |
# define INT_VEC_TX SIG_UART_TRANS |
#endif |
#if defined (__AVR_ATmega644__) |
# define USR UCSR0A |
# define UCR UCSR0B |
# define UDR UDR0 |
# define UBRR UBRR0L |
# define EICR EICR0B |
# define TXEN TXEN0 |
# define RXEN RXEN0 |
# define RXCIE RXCIE0 |
# define TXCIE TXCIE0 |
# define U2X U2X0 |
# define UCSRB UCSR0B |
# define UDRE UDRE0 |
# define INT_VEC_RX SIG_USART_RECV |
# define INT_VEC_TX SIG_USART_TRANS |
#endif |
#endif //_UART_H |
/tags/V0.14 |
---|
Property changes: |
Added: tsvn:logminsize |
+8 |
\ No newline at end of property |
/tags/V0.21b/Compass.pnproj |
---|
0,0 → 1,0 |
<Project name="avr_ctrl"><File path="uart.h"></File><File path="main.c"></File><File path="main.h"></File><File path="makefile"></File><File path="uart.c"></File><File path="timer0.c"></File><File path="timer0.h"></File><File path="analog.h"></File><File path="analog.c"></File><File path="twislave.c"></File><File path="twislave.h"></File></Project> |
/tags/V0.21b/Compassl.pnps |
---|
0,0 → 1,0 |
<pd><ViewState><e p="avr_ctrl" x="true"></e></ViewState></pd> |
/tags/V0.21b/Hex-Files/BootLoader_MEGA168_8MHZ_V0.2.hex |
---|
0,0 → 1,61 |
:1038000011241FBECFEFD4E0DEBFCDBF11E0A0E09A |
:10381000B1E0EEEAFBE302C005900D92A030B107E3 |
:10382000D9F711E0A0E0B1E001C01D92A238B107C4 |
:10383000E1F70C943B1C0C941D1C0895982F80916B |
:10384000C00085FFFCCF9093C60008958091C00012 |
:103850008823E4F78091C600992708958DE40E949B |
:103860001E1C8BE40E941E1C82E40E941E1C8CE421 |
:103870000E941E1C0895CFEFD4E0DEBFCDBFE0E074 |
:10388000F0E004917F01992494BE98E10FB6F8947A |
:1038900090936000109260000FBE9092C50080E18E |
:1038A0008093C4008091C00082608093C000909398 |
:1038B000C10086E08093C200EF01192D8091C00005 |
:1038C00087FF0DC0113031F48091C6008A3A89F12A |
:1038D00010E005C08091C6008B3109F411E0CE01E3 |
:1038E00021968436910500F10F3F41F0002331F01D |
:1038F000E0910001F0910101099516C08AE00E9453 |
:103900001E1C8DE00E941E1C86E50E941E1C80E38A |
:103910000E941E1C8EE20E941E1C82E30E941E1C3E |
:103920008AE30E941E1C05C080E29EE40197F1F725 |
:10393000C5CF0E942E1C0E94261C813611F489E5F9 |
:1039400033C1813471F40E94261CE82EFF24FE2C22 |
:10395000EE240E94261C9927E82AF92AF694E79477 |
:10396000F1C0823641F489E50E941E1C80E00E946D |
:103970001E1C80E819C1823409F075C00E94261C03 |
:103980000E94261CD82E0E94261C082FB2E0AB2EC7 |
:10399000B1E0BB2E10E0E5010894A11CB11C1D157F |
:1039A00018F40E94261C01C08FEF88831F5F17FF49 |
:1039B000F2CF38E7931609F0D4C0063409F03DC0C1 |
:1039C0008FEFE81687E3F80608F033C0CD2DA70186 |
:1039D00066277727440F551F661F771F6A017B01F3 |
:1039E000A2E0B1E011E08D9199272D913327322F7C |
:1039F0002227822B932B0C01FA0110935700E89594 |
:103A000011244E5F5F4F6F4F7F4FC25061F785E0CB |
:103A1000F60180935700E89507B600FCFDCF81E1E1 |
:103A200080935700E89576956795579547957A0165 |
:103A300089C080E00E941E1C85C0053409F082C048 |
:103A4000F7012D2DA2E0B1E0E1BD8F2F992782BDB6 |
:103A50008D9180BD3196FA9AF99AF999FECF21504D |
:103A600099F77F016FC0873609F03DC00E94261C80 |
:103A70000E94261CC82F0E94261C863419F5C701F7 |
:103A8000AA27BB276C017D01CC0CDD1CEE1CFF1CA2 |
:103A9000F60105911491802F0E941E1C812F9927F9 |
:103AA0000E941E1C82E090E0A0E0B0E0C80ED91E8B |
:103AB000EA1EFB1EC25061F7F694E794D794C794B0 |
:103AC000760139CF853409F036CFE1BC8F2D9927A7 |
:103AD00082BDF89A0894E11CF11C80B50E941E1C5E |
:103AE000C15099F728CF853601F598E7991651F519 |
:103AF00080E090E0A0E0B0E023E0FC0120935700DC |
:103B0000E89507B600FCFDCF80589F4FAF4FBF4FE1 |
:103B10008F3F37E3930730E0A30730E0B30768F344 |
:103B200081E180935700E8950DC0853469F488E100 |
:103B300090E02CE00FB6F894A895809360000FBE3B |
:103B4000209360008DE030C08035E1F38C34D1F3F8 |
:103B5000803711F483E528C0843729F488E70E9470 |
:103B60001E1C80E021C0843521F40E94261C982E62 |
:103B7000E9CF8B3109F4DDCE8A3A09F4DACE863505 |
:103B800029F480E30E941E1C82E30EC0833741F4B7 |
:103B900086E00E941E1C84E90E941E1C8EE104C067 |
:0E3BA0008B3109F4C8CE8FE30E941E1CC4CEE8 |
:0400000300003800C1 |
:00000001FF |
/tags/V0.21b/Hex-Files/MK3Mag_MEGA168_V0_21b_SVN48.hex |
---|
0,0 → 1,604 |
:100000000C946B000C9486000C9486000C94860073 |
:100010000C9486000C9486000C9486000C94860048 |
:100020000C9486000C9486000C9486000C94860038 |
:100030000C9486000C9486000C9486000C94860028 |
:100040000C94090C0C9486000C9431080C948600D6 |
:100050000C94FB070C9486000C9486000C9486008C |
:100060000C94120D0C94860007BAA57A2C3BDA90FA |
:10007000C5BC8BFC663CFD10F8BD4D83923DB63A85 |
:100080009EBE5BBFCA3FC90FDA000829573F9F2DAC |
:1000900049CBA5310F76C73493F27E37D00D013AA4 |
:1000A000B60B613D2AAAAB3F0000003F8000000074 |
:1000B000083B3BD74ABC846E023D2FC1FEBD9A313E |
:1000C000743DDA3D83BE117FC73E4CBBE5BEAAAA94 |
:1000D0006C3F8000000011241FBECFEFD4E0DEBFD4 |
:1000E000CDBF13E0A0E0B1E0E2E8F3E202C005908A |
:1000F0000D92A431B107D9F714E0A4E1B3E001C037 |
:100100001D92A738B107E1F70C946A060C94000021 |
:10011000CF93DF9340917D0350917E0380915E03E6 |
:1001200090915F03481B590B5093860340938503BE |
:10013000809162039091630320915C0330915D0391 |
:10014000821B930B909361038093600380918103E2 |
:10015000909182032091830330918403821B930B3F |
:100160009093800380937F03209164033091650313 |
:1001700021153105F9F08091660390916703481BC2 |
:10018000590BCA01AA2797FDA095BA2F4AE0880FFC |
:10019000991FAA1FBB1F4A95D1F7442737FD4095E9 |
:1001A000542FBC01CD010E94661130932903209386 |
:1001B000280304C030932903209328034091680347 |
:1001C000509169034115510509F44AC080916003BB |
:1001D0009091610320916A0330916B03821B930B12 |
:1001E000AA2797FDA095BA2F3AE0880F991FAA1F5A |
:1001F000BB1F3A95D1F7EA01EE27D7FDE095FE2F18 |
:100200009E01AF01BC01CD010E946611309327030E |
:100210002093260380917F039091800320916E03A9 |
:1002200030916F03821B930BAA2797FDA095BA2FDD |
:100230002AE0880F991FAA1FBB1F2A95D1F720918A |
:100240006C0330916D03442737FD4095542FBC015A |
:10025000CD010E946611309325032093240308C02A |
:100260005093270340932603509325034093240380 |
:1002700080915103882309F4B9C040912203509121 |
:1002800023038091720390917303481B590B509381 |
:100290001D0340931C038091200390912103209122 |
:1002A000760330917703821B930B90931B0380930B |
:1002B0001A0380917A0390917B0320911E03309161 |
:1002C0001F03821B930B90931903809318034938E3 |
:1002D00051051CF080EE9CEF3CC0EFEF48375E0705 |
:1002E0001CF480E293E035C0CA01AA2797FDA095CF |
:1002F000BA2FBC01CD010E94850FDC01CB0120E0AB |
:1003000030E04AE053E4BC01CD010E94220FDC0141 |
:10031000CB01BC01CD010E94AF0EDC01CB0120E07E |
:1003200030E041EE54ECBC01CD010E947110DC01C3 |
:10033000CB012BED3FE049E450E4BC01CD010E942C |
:10034000220FDC01CB01BC01CD010E94680FDC0152 |
:10035000CB01909317038093160380911A03909119 |
:100360001B03893891051CF080E293E03BC0FFEF4E |
:1003700088379F071CF480EE9CEF34C0AA2797FDB6 |
:10038000A095BA2FBC01CD010E94850FDC01CB01E5 |
:1003900020E030E04AE053E4BC01CD010E94220F8E |
:1003A000DC01CB01BC01CD010E94AF0EDC01CB0111 |
:1003B00020E030E041EE54E4BC01CD010E94711018 |
:1003C000DC01CB012BED3FE049E450E4BC01CD0161 |
:1003D0000E94220FDC01CB01BC01CD010E94680FFD |
:1003E000DC01CB019093150380931403DF91CF912F |
:1003F00008952F923F924F925F926F927F928F92C9 |
:100400009F92AF92BF92CF92DF92EF92FF920F93A3 |
:100410001F93CF93DF93CDB7DEB724970FB6F89431 |
:10042000DEBF0FBECDBF0F2EF0E02F2EF0E03F2E2F |
:10043000F0E04F2EF0E05F2EF02D82017101298255 |
:100440003A824B825C8280912A0390912B030E9416 |
:100450006C0C882391F080917C03813029F08BB162 |
:1004600090E889278BB901C05F9A86E990E00E94E5 |
:10047000630C90932B0380932A03809102019927A8 |
:10048000009719F00197A1F042C080912803909144 |
:100490002903AA2797FDA095BA2FBC01CD010E9480 |
:1004A000850F7B018C01809126039091270315C055 |
:1004B0008091260390912703AA2797FDA095BA2F34 |
:1004C000BC01CD010E94850F7B018C018091280326 |
:1004D00090912903909581959F4FAA2797FDA0950C |
:1004E000BA2FBC01CD010E94850F1B012C01809108 |
:1004F000240390912503AA2797FDA095BA2FBC014C |
:10050000CD010E94850F69837A838B839C838091C0 |
:100510000301992781309105A1F0823091051CF4E7 |
:10052000892B21F022C00297B9F01FC0F894809166 |
:100530006D0490916E0480906F0490907004789494 |
:1005400017C0F8948091BA039091BB038090BC03CC |
:100550009090BD0378940CC080911603909117037E |
:10056000809014039090150303C088249924C4013B |
:10057000AA2797FDA095BA2FBC01CD010E94850F37 |
:10058000DC01CB012BED3FE049E450E4BC01CD019F |
:100590000E947110DC01CB0120E030E041EE54E418 |
:1005A000BC01CD010E94220F5B016C01C401AA278E |
:1005B00097FDA095BA2FBC01CD010E94850FDC01EB |
:1005C000CB012BED3FE049E450E4BC01CD010E949A |
:1005D0007110DC01CB0120E030E041EE54E4BC01BD |
:1005E000CD010E94220F3B014C01C601B5010E94C2 |
:1005F0001C0FDC01CB019C01AD01C801B7010E94B9 |
:1006000071107B018C01C601B5010E94B910DC019B |
:10061000CB019C01AD0169817A818B819C810E9413 |
:100620007110DC01CB019C01AD01C801B7010E9432 |
:100630006C0E5B016C01C401B3010E941C0FDC0154 |
:10064000CB019C01AD01C201B1010E9471107B017F |
:100650008C01C401B3010E94B910DC01CB019C01E3 |
:10066000AD0169817A818B819C810E947110DC01CE |
:10067000CB019C01AD01C801B7010E946D0E7B0149 |
:100680008C01C601B5010E94680FDC01CB0190937B |
:10069000FB038093FA03C801B7010E94680FDC01D5 |
:1006A000CB019093FD038093FC03A6019501C80143 |
:1006B000B7010E94E90EDC01CB0120E030E044E309 |
:1006C00053E4BC01CD010E947110DC01CB012BED84 |
:1006D0003FE049E450E4BC01CD010E94220FDC015F |
:1006E000CB01BC01CD010E94680FDC01CB019C0154 |
:1006F00097FF04C0309521953F4F05C088E691E0F3 |
:10070000821B930B9C0180917C03813011F02FEFB1 |
:100710003FEFF894C90188599E4F815D924028F4BB |
:10072000309301012093000106C08FEF9FEF90935B |
:10073000010180930001789424960FB6F894DEBFEF |
:100740000FBECDBFDF91CF911F910F91FF90EF9022 |
:10075000DF90CF90BF90AF909F908F907F906F90E1 |
:100760005F904F903F902F900895CF9380916A04AF |
:10077000882311F0C82F02C0C091C003C63010F00A |
:10078000C0E038C0CC23B1F180912A0390912B03B3 |
:100790000E946C0C882321F480912C03C81789F1E6 |
:1007A0004091390380913A0340FF03C0882329F424 |
:1007B00002C0882311F05F9801C05F9A242F33276D |
:1007C0002F5F3F4F8C2F9927880F991F28173907C4 |
:1007D0002CF0109239038CED95E005C04F5F4093EB |
:1007E000390384E690E00E94630C90932B0380937E |
:1007F0002A0307C080913A03882311F05F9A01C051 |
:100800005F988C2F99278330910509F409C18430B2 |
:1008100091053CF48130910561F0029709F43EC0E6 |
:1008200001C18430910509F46EC0059709F489C0AF |
:10083000F9C020E137E230932E0320932D0380EF9F |
:1008400098ED9093300380932F03309332032093DD |
:100850003103909334038093330330933603209312 |
:10086000350390933803809337038091220390914E |
:1008700023039093730380937203809120039091DC |
:100880002103909377038093760380911E039091C8 |
:100890001F0390937B0380937A03C2C0209185034A |
:1008A0003091860380912D0390912E0328173907EC |
:1008B00024F430932E0320932D0380912F039091E5 |
:1008C00030038217930724F43093300320932F03CF |
:1008D0002091600330916103809131039091320344 |
:1008E0002817390724F43093320320933103809181 |
:1008F00033039091340382179307FCF4309334034D |
:10090000209333031AC020917F033091800380919C |
:100910003503909136032817390724F430933603B2 |
:100920002093350380913703909138038217930702 |
:1009300024F4309338032093370381E080933A0303 |
:1009400071C080912C03C81709F46AC0E4E6F3E093 |
:1009500020912F033091300380912D0390912E032D |
:10096000D901A81BB90BB0936503A0936403820F50 |
:10097000931F97FD019695958795909367038093B4 |
:1009800066032091330330913403809131039091B9 |
:100990003203B901681B790B709369036093680394 |
:1009A000820F931F97FD01969595879590936B0302 |
:1009B00080936A0320913703309138038091350387 |
:1009C00090913603A901481B590B50936D03409336 |
:1009D0006C03820F931F97FD0196959587959093D1 |
:1009E0006F0380936E03A739B105D4F067397105A1 |
:1009F000BCF047395105A4F081E080937C035F98F7 |
:100A0000A0E0B0E089E1182E0E94A81180ED97E0E7 |
:100A10000E94630C90932B0380932A031092390356 |
:100A200010923A03C0932C03CF910895809128032C |
:100A3000909129039093C5038093C403809126036A |
:100A4000909127039093C7038093C603809124035A |
:100A5000909125039093C9038093C80380918503E7 |
:100A6000909186039093CB038093CA038091600397 |
:100A7000909161039093CD038093CC0380917F0389 |
:100A8000909180039093CF038093CE032091030134 |
:100A9000822F992781309105A9F0823091051CF4AD |
:100AA000892BE9F02CC0029751F5809116039091A3 |
:100AB00017039093D1038093D003809114039091F6 |
:100AC000150319C08091BA039091BB039093D10391 |
:100AD0008093D0038091BC039091BD030CC08091A2 |
:100AE0006D0490916E049093D1038093D003809114 |
:100AF0006F04909170049093D3038093D2038091FC |
:100B00006603909167039093D5038093D4038091FB |
:100B10006403909165039093D7038093D6038091EB |
:100B20006A0390916B039093D9038093D8038091CB |
:100B30006803909169039093DB038093DA038091BB |
:100B40006E0390916F039093DD038093DC0380919B |
:100B50006C0390916D039093DF038093DE0380918B |
:100B60006A04882311F48091C00399279093E103CC |
:100B70008093E00380910001909101019093E30341 |
:100B80008093E2038091BE0399279093E5038093BD |
:100B9000E4038091BF0399279093E7038093E603D2 |
:100BA00080911C0390911D039093E9038093E803C7 |
:100BB00080911A0390911B039093EB038093EA03B7 |
:100BC00080911803909119039093ED038093EC03A7 |
:100BD00080912203909123039093EF038093EE037F |
:100BE00080912003909121039093F1038093F0036F |
:100BF00080911E0390911F039093F3038093F2035F |
:100C000080917203909173039093F5038093F403A2 |
:100C100080917603909177039093F7038093F60386 |
:100C200080917A0390917B039093F9038093F8036A |
:100C3000822F99279093FF038093FE03089580915C |
:100C400051038823D1F182E00E94840C2091220379 |
:100C500030912303280F391F37FF02C02F5F3F4F0A |
:100C600035952795309323032093220383E00E9438 |
:100C7000840C2091200330912103280F391F37FF66 |
:100C800002C02F5F3F4F3595279530932103209366 |
:100C9000200386E00E94840C20911E0330911F03E4 |
:100CA000280F391F37FF02C02F5F3F4F359527951B |
:100CB00030931F0320931E03089510922303109274 |
:100CC0002203109221031092200310921F0310920E |
:100CD0001E030895CFEFD4E0DEBFCDBF3E98469A05 |
:100CE0000E94690E0E94F30B0E9435070E94990C26 |
:100CF0000E94D50C789480915103882321F084E0E0 |
:100D000091E00E94DA0B5F9A88EC90E00E94630CFD |
:100D100090932B0380932A03E4E6F3E0A0E0B0E095 |
:100D200089E1182E0E94A3111092C00310926A0448 |
:100D30008BB18F798BB982E090E00E94770C80E0D4 |
:100D40000E94840C90937E0380937D0381E00E9437 |
:100D5000840C909581959F4F90938203809381039B |
:100D600087E00E94840C90936303809362030E9447 |
:100D70001F0681E090E00E94770C8BB180668BB9F2 |
:100D800082E090E00E94770C80E00E94840C9093B7 |
:100D90005F0380935E0381E00E94840C90958195AF |
:100DA0009F4F909384038093830387E00E94840C79 |
:100DB00090935D0380935C030E941F0681E090E0A6 |
:100DC0000E94770C0E9488008091C003882321F440 |
:100DD00080916A04882319F00E94B50302C00E9422 |
:100DE000F9010E942A0A80915203882319F0815048 |
:100DF0008093520380913B03882319F081508093A4 |
:100E00003B0380913B03882351F480915203882354 |
:100E100031F482E08093030181E0809302018091AC |
:100E20003C03882351F00E94DD070E94C90A80918B |
:100E30003C03815080933C037BCF0E94EA0778CF2C |
:100E4000CF93C82F8091C10083FF0BC0CA3019F423 |
:100E50008DE00E9420078091C00085FFFCCFC093E9 |
:100E6000C60080E090E0CF9108951F93CF93CFB755 |
:100E700020E130E0F8948091C1008F778093C10029 |
:100E80008091C1008F7B8093C10050985898519AEF |
:100E90005998832F99278093C5002093C40080918F |
:100EA000C00082608093C0008091C2008F778093E1 |
:100EB000C2008091C2008F7B8093C2008091C200EB |
:100EC0008F7D8093C2008091C2008F7E8093C2008C |
:100ED0008091C200877F8093C2008091C1008B7F88 |
:100EE0008093C1008091C20084608093C200809191 |
:100EF000C20082608093C2008091C10080618093B3 |
:100F0000C1008091C10088608093C1008091C000C1 |
:100F100087FF03C08091C600F9CF8091C10080682F |
:100F20008093C1008091C10080648093C100809152 |
:100F30001103909112030E94630C909369048093B3 |
:100F400068041092440310924203109241031092DD |
:100F5000400391E0909313031092A50385E18093E1 |
:100F6000A6039093A9031AE01093A7031092A80375 |
:100F7000812F0E94200783E40E94200780E50E94C1 |
:100F800020078AE30E94200786E50E94200780E36D |
:100F90000E9420078EE20E94200782E30E94200721 |
:100FA00081E30E94200782E60E942007812F0E9491 |
:100FB0002007CFBFCF911F910895519A59988091E2 |
:100FC000C10088608093C1008091C10080648093DB |
:100FD000C1000895809113038823E1F38091C1003B |
:100FE0008F7B8093C1008091C100877F8093C10077 |
:100FF0005198599808951F920F920FB60F9211248D |
:101000008F939F93EF93FF93809113038823E1F4D1 |
:1010100080914503909146030196909346038093F7 |
:101020004503FC01EC5FFB4FE081ED3019F08436A5 |
:10103000910539F4109246031092450381E08093A4 |
:101040001303E093C60004C01092460310924503B8 |
:10105000FF91EF919F918F910F900FBE0F901F9076 |
:1010600018951F920F920FB60F9211242F933F9352 |
:101070004F935F938F939F93AF93BF93CF93DF93E0 |
:10108000EF93FF935091C60080914403882309F0A9 |
:101090006EC040914903442371F4533279F4509364 |
:1010A000870381E08093490383E290E090934803B3 |
:1010B000809347035CC04E3108F055C02091470330 |
:1010C00030914803E42FFF275D3069F0E957FC4F6A |
:1010D00050834F5F40934903250F311D30934803E0 |
:1010E0002093470344C0DF01A957BC4FFD0132974D |
:1010F0008081281B3109ED0121978881281B310946 |
:10110000C9019F709093480380934703689415F832 |
:10111000969587951694E1F7982F935C2F7330700E |
:10112000235C80819817D1F488812817B9F45C93E7 |
:101130004F5F4093430381E0809344038091890390 |
:10114000823571F488E190E02CE00FB6F894A89510 |
:10115000809360000FBE2093600002C01092440391 |
:101160001092490304C08093490380934403FF9184 |
:10117000EF91DF91CF91BF91AF919F918F915F914F |
:101180004F913F912F910F900FBE0F901F90189588 |
:10119000AC01A0E0B0E09D01A817B90748F4E4E075 |
:1011A000F4E08191280F311D1196A417B507C8F3FB |
:1011B0003F70FD01EC5FFB4FC90176E09695879586 |
:1011C0007A95E1F7835C80831196FD01EC5FFB4F1C |
:1011D0002F733070822F835C8083AB5FBB4F8DE0B9 |
:1011E0008C9310921303809104048093C600089599 |
:1011F000BF92CF92DF92EF92FF920F931F93CF9304 |
:10120000DF93CDB7DEB72C859D850E85BB2483E2A9 |
:10121000809304049F59909305042093060433E0BF |
:10122000E32EF12C002309F49EC0CF84D888BE01A0 |
:101230006D5E7F4FA989BA890150109709F493C058 |
:101240001097B9F0F601EB0DF11DB3949081119751 |
:1012500091F4002349F1FB016E5F7F4FDB01C080F9 |
:10126000D1806E5F7F4F0D90BC91A02DBB240150AB |
:1012700002C090E019C01097B9F0F601EB0DF11D16 |
:10128000B3944081119791F4002341F1FB016E5F0B |
:101290007F4FDB01C080D1806E5F7F4F0D90BC918E |
:1012A000A02DBB24015002C040E018C01097B1F03F |
:1012B000F601EB0DF11DB3941081119781F4002319 |
:1012C00071F0FB013296DB01CD90DC90BF016E5FC7 |
:1012D0007F4FA081B181BB24015001C010E0F70114 |
:1012E000EC5FFB4F892F86958695835C80830894FD |
:1012F000E11CF11CF701EC5FFB4F892F99278370EC |
:10130000907024E0880F991F2A95E1F755279A01DC |
:1013100094E0369527959A95E1F7822B835C80833C |
:101320000894E11CF11CF701EC5FFB4F4F7050700B |
:10133000440F551F440F551F812F992726E096957E |
:1013400087952A95E1F7842B835C80830894E11CC0 |
:10135000F11CF701EC5FFB4F1F73135C10830894C3 |
:10136000E11CF11C6ACFC7010E94C808DF91CF9130 |
:101370001F910F91FF90EF90DF90CF90BF90089555 |
:10138000A3E07A2F409143034650442309F458C008 |
:10139000E72FFF27E957FC4F80818D537F5FE72FB1 |
:1013A000FF27E957FC4F20812D537F5FE72FFF2751 |
:1013B000E957FC4F30813D537F5FE72FFF27E95707 |
:1013C000FC4F60816D537F5F9927880F991F880FAD |
:1013D000991F522F52955F70582B822F99278F702B |
:1013E0009070F4E0880F991FFA95E1F7232F269566 |
:1013F0002695282B832F992783709070E6E0880F1D |
:10140000991FEA95E1F7682B41504F3FC9F0EA2F49 |
:10141000FF27E957FC4F5083AF5F41504F3F81F0AA |
:10142000EA2FFF27E957FC4F2083AF5F41504F3F22 |
:1014300039F0EA2FFF27E957FC4F6083AF5FA5CF54 |
:101440008AE893E09093420380934103A350A093D2 |
:101450004003089580914403882309F499C00E94B1 |
:10146000C00980918803843619F5809189039927F2 |
:101470008B36910519F087379105D1F4AAEBB3E0CB |
:10148000E0914103F091420388E001900D92815078 |
:10149000E1F780913F03886080933F0381E0809370 |
:1014A00003018091C103809302018FEF80933B037E |
:1014B00080918903992784369105C1F1853691057C |
:1014C00044F48136910509F448C08236910589F0CB |
:1014D00057C08836910509F450C0893691052CF41F |
:1014E0008736910509F444C04BC08637910589F1D0 |
:1014F00047C0AFEAB3E0E0914103F09142039BE0C3 |
:1015000001900D929150E1F78091B10381FF09C0E4 |
:101510008091C0038F5F8093C003863011F4909355 |
:10152000C0038091B80380933D0327C0E09141033D |
:10153000F091420390818AE0989FC001112490931A |
:10154000120380931103892BC1F080913F038260C5 |
:1015500012C080913F0381600EC0E0914103F09181 |
:101560004203808180933E0380913F03846003C0E7 |
:1015700080913F03806180933F038FEF80933C0312 |
:1015800010924203109241031092400310924403C0 |
:1015900008958091C10083FF0CC1809113038823BB |
:1015A00009F407C180913F0382FF34C08091130387 |
:1015B000882381F180E190E09F938F9380913E0397 |
:1015C000992724E0880F991F2A95E1F78F5E9E4F97 |
:1015D0009F938F9381E090E09F938F938EE393E0AE |
:1015E0009F938F9382E08F9383E08F9381E48F9317 |
:1015F0000E94F8088FEF80933E0380913F038B7F1A |
:1016000080933F038DB79EB70B960FB6F8949EBF9D |
:101610000FBE8DBF80913D038823F1F080911303AD |
:101620008823D1F081E090E09F938F938DE393E046 |
:101630009F938F9381E08F9383E08F9382E48F93C6 |
:101640000E94F80810923D038DB79EB707960FB61B |
:10165000F8949EBF0FBE8DBF80911103909112032D |
:10166000892B41F080916804909169040E946C0C70 |
:10167000882321F480913F0381FF2DC080911303C3 |
:10168000882349F10E94160582E490E09F938F938E |
:1016900082EC93E09F938F9381E08F9383E08F930D |
:1016A00084E48F930E94F8088091110390911203B3 |
:1016B0000E94630C909369048093680480913F03B7 |
:1016C0008D7F80933F038DB79EB707960FB6F89432 |
:1016D0009EBF0FBE8DBF80913F0384FF21C08091CC |
:1016E00013038823E9F08BE090E09F938F938FEAB8 |
:1016F00093E09F938F9381E08F9383E08F9387E4B0 |
:101700008F930E94F80880913F038F7E80933F0360 |
:101710008DB79EB707960FB6F8949EBF0FBE8DBFCC |
:1017200080913F0383FF20C0809113038823E1F061 |
:1017300082E090E09F938F9381E794E09F938F9353 |
:1017400081E08F938F938BE48F930E94F8088091B0 |
:101750003F03877F80933F038DB79EB707960FB6F1 |
:10176000F8949EBF0FBE8DBF80913F0380FF21C0C4 |
:10177000809113038823E9F08AE090E09F938F9390 |
:1017800085EA93E09F938F9381E08F9383E08F931B |
:1017900086E58F930E94F80880913F038E7F8093A7 |
:1017A0003F038DB79EB707960FB6F8949EBF0FBE46 |
:1017B0008DBF08951F93CF93DF93EC0110E08881D4 |
:1017C000882369F0FE01E10FF11D1F5F80810E94F7 |
:1017D0002007FE01E10FF11D8081882399F7DF9139 |
:1017E000CF911F910895229A2A9884B58C7084BD58 |
:1017F00085B5837385BD82E085BD16BC80916E0082 |
:10180000897F80936E0080916E00816080936E006E |
:1018100008951F920F920FB60F9211242F933F93AA |
:101820004F938F939F9386B5855686BD2091000177 |
:101830003091010137FF02C02A980EC080914F03FA |
:101840009091500301969093500380934F0341E091 |
:101850008C37940730F02A9A1092500310924F035D |
:1018600006C0265F3F4F8217930708F02A988091A1 |
:101870004E03815080934E038823D9F48AE08093ED |
:101880004E0380914C0390914D03019690934D032C |
:1018900080934C0380914A0390914B03892B49F02C |
:1018A00080914A0390914B03019790934B0380934F |
:1018B0004A039F918F914F913F912F910F900FBEAF |
:1018C0000F901F90189520914C0330914D03280FD5 |
:1018D000391FC9010197089520914C0330914D03A0 |
:1018E000821B930B892F990F990B80780895CF93C2 |
:1018F000DF930E94630CEC01CE010E946C0C8823E4 |
:10190000D9F3DF91CF91089580937C0080917A0084 |
:10191000806180937A0080917A00806480937A005D |
:1019200080917A0084FFFCCF8091780090917900BB |
:10193000089587B1807F87B988B1807F88B98AB1DF |
:1019400080668AB98BB18F798BB910927C008091B7 |
:101950007A00877980937A0080917A0087698093F2 |
:101960007A0010927C0080917A00806480937A00E3 |
:1019700088B18C6088B980E29EE40197F1F782E03B |
:101980000E94840C895E934048F083E00E94840C9E |
:10199000895E934018F01092510303C081E0809358 |
:1019A000510388B1837F88B908959FB7F89484B1B3 |
:1019B0008F7C84B985B1806385B987B18F7C87B905 |
:1019C00088B18F7C88B910925803109257031092F7 |
:1019D000540310925903109256031092550310921B |
:1019E000530310925A038091BC008F7D8093BC00FA |
:1019F0008091BC0085648093BC0080E58093BA0030 |
:101A00008091BC00856D8093BC001092730485E1C9 |
:101A10008093740481E08093750482E0809376045F |
:101A20009FBF08951F920F920FB60F9211242F930C |
:101A30003F938F939F93AF93BF93EF93FF938091C7 |
:101A4000B9009927887F907080389105A9F0813876 |
:101A500091053CF4009709F42AC18036910551F0B4 |
:101A600028C1883A910509F4E9C0883B910509F439 |
:101A7000F5C01FC18FEFDFC03091BB002091530331 |
:101A80002F3F09F08CC0832F99278230910569F18F |
:101A9000833091051CF4019741F070C083309105AB |
:101AA00009F44BC0049789F069C083E794E09093F0 |
:101AB00058038093570384E0809359031092560390 |
:101AC0001092550310925A0365C08AE694E09093F1 |
:101AD00058038093570323E02093590390935603B0 |
:101AE0008093550320935A0355C081E894E0909366 |
:101AF00058038093570386E080935903109256034E |
:101B00001092550310925A03809128039091290353 |
:101B100090938204809381048091260390912703FF |
:101B200090938404809383048091240390912503EF |
:101B300090938604809385042DC081E794E0909370 |
:101B400058038093570382E0809359038DE694E015 |
:101B5000909356038093550384E080935A038091B9 |
:101B6000000190910101909372048093710410928E |
:101B7000030110920201209352030CC010925603ED |
:101B80001092550310925A03109258031092570363 |
:101B9000109259031092530330935B038AC09091C3 |
:101BA000530380915A03981768F480915303E82FE8 |
:101BB000FF27E958FB4F308380915B03830F8093AD |
:101BC0005B0336C09091530380915A03981781F5B7 |
:101BD00080915B03831719F580915503909156030B |
:101BE000892B99F030E080915A03381770F4E32F75 |
:101BF000FF27A0915503B0915603AE0FBF1FE958C0 |
:101C0000FB4F80818C933F5FEECF809102049091D7 |
:101C100003040196909303048093020409C0809109 |
:101C200000049091010401969093010480930004B4 |
:101C3000809153038F5F809353033BC010925403F2 |
:101C400010925B03E0915703F0915803309721F015 |
:101C500080915903823070F430E011C0E091570355 |
:101C6000F0915803309789F0909154038091590373 |
:101C7000981758F480915403E80FF11D308180913A |
:101C80005B03830F80935B030AC0909154038091A0 |
:101C90005903981719F430915B0301C030E080912B |
:101CA00054038F5F809354033093BB0002C085EDD3 |
:101CB00001C085EC8093BC00FF91EF91BF91AF9183 |
:101CC0009F918F913F912F910F900FBE0F901F907A |
:101CD0001895579A5F9808955058192EA4D101D09D |
:101CE00054C1BA176207730784079507B1F188F4E6 |
:101CF0000EF410940B2EBA2FA02D062E622F202D3D |
:101D0000072E732F302D082E842F402D092E952F4E |
:101D1000502DFF275523B9F0591B49F0573E98F035 |
:101D2000469537952795A795F0405395C9F776F0D6 |
:101D3000BA0F621F731F841F30F4879577956795DC |
:101D4000B795F040939517FA0F2E0895BF1BBB2748 |
:101D5000BA0B620B730B840BF6CFDEF690C1AA2789 |
:101D600097FDA160AF939F775FE340E86130710515 |
:101D70008407950720F00E94DD0FAF9108959F938F |
:101D80008F937F936F93E8E6F0E00E94E00F2F912E |
:101D90003F914F915F919F938F937F936F939FE3B9 |
:101DA00080E87727662750680E946D0E0E94CC104D |
:101DB0002F913F914F915F910E9471105FE349EC29 |
:101DC0003FE02BED90680E946D0EAF91A0FD9068F2 |
:101DD0000895552319F0992351F018C09923A1F0C3 |
:101DE00097FB6BED7FE089EC9FE397F9089555230E |
:101DF00059F02AF46BED7FE089E490E408956627BA |
:101E000077278827992708950C94DD0F1F931127B2 |
:101E100097FD116057FD12600E94220F0E940E1163 |
:101E200011FF08C02BED3FE049E450E410FD50687D |
:101E30000E946D0E1F91089550E449EC3FE02BED98 |
:101E40006ED080C0F0D001D0A0C0552359F09923A6 |
:101E500069F09F575F57951B33F442F4903811F4A3 |
:101E6000915805C0AAC091589F3F09F408C1BB27EB |
:101E7000112462177307840730F4660F771F881FD9 |
:101E8000BB1F915098F311D00F920FD00F920DD02D |
:101E9000A0E82617370748071B0609F0A048BA2F05 |
:101EA000602D7F918F9100240895A0E8002462178F |
:101EB00073078407B10528F0621B730B840BB1090B |
:101EC0000A2A660F771F881FBB1FA69581F7089502 |
:101ED00097FBB5D09F3738F0FEE9F91B982F872F75 |
:101EE000762F6B2F05C0C8C0969587957795679517 |
:101EF000F150D0F73EF490958095709561957F4FA5 |
:101F00008F4F9F4F0895E89403C097FB0EF4F3DFC3 |
:101F1000B62F672F782F892F9EE9002436C05F7770 |
:101F2000552319F444230AF048C02F933F934F934D |
:101F30005F9388DF55274427A4D05F914F913F914D |
:101F40002F91CFC01F939F7750EC49E43FE02BEDDA |
:101F5000C4DE10E89F775FE349EC3FE02BED6217AA |
:101F600073078407950720F050EC49E4B6DE11278B |
:101F700051D19068EAE8F0E023D091271F910895AD |
:101F80009A95BB0F661F771F881F11249923A1F014 |
:101F90008823B2F79F3F59F0BB0F48F421F400208B |
:101FA00011F460FF04C06F5F7F4F8F4F9F4F881FFA |
:101FB0009795879597F908955FC09FEF80EC0895F6 |
:101FC000FF92EF92DF92CF92BF926B017C01B590AE |
:101FD00016D0B590BB2069F09F938F937F936F933A |
:101FE000B601C7010CD02F913F914F915F910E9494 |
:101FF000220FBF90CF90DF90EF90FF9008953DD1DA |
:1020000002C09601A701EF93FF930E947110FF9108 |
:10201000EF9133D1EF93FF930E946D0EFF91EF91FB |
:10202000BA9479F70895052E092607FA440F551F2B |
:102030005F3F79F0AA27A51708F051E04795880F70 |
:10204000991F9F3F31F0BB27B91708F091E08795A2 |
:1020500008959F919F911124B0CF97FB880F991FEE |
:102060009F3F31F0BB27B91708F091E0879508959D |
:102070009F919F911124A1CF6627772788279927C1 |
:102080000895EBDFCF93DF93D52FC42F5527442737 |
:10209000332722279923D9F09F37C8F0F92F75DF0E |
:1020A000592F482F372F262FF63968F411DF2DDFEF |
:1020B000C030CD0721F06993799389939993905813 |
:1020C000DF91CF910ACE9927882777276627C030DE |
:1020D000CD0721F02993399349935993DF91CF91FB |
:1020E00054CFA1DF01D051CF992339F0552329F0E6 |
:1020F0009F575F57950F13F49AF1C1CF91589F3FA7 |
:10210000E1F3629FA12D0F92BB27639FA00DB11D2C |
:10211000EE27729FA00DB11DEE1FAF93AA27649FFB |
:10212000B00DE11D739FB00DE11DAA1F6627829FB0 |
:10213000B00DE11DA61F5527749FE00DA11D551F71 |
:10214000839FE00DA11D561F849FA00D511D852F5B |
:102150007A2F6E2F1F900F9088231AF4939539F4DD |
:102160002CCF000C111CBB1F661F771F881F012876 |
:1021700008959F939F77993358F050E449EC3FE0DE |
:102180002BEDCDDE5FEB49EC3FE02BEDA6DDDADE9B |
:102190005F9150789527089597FD0FCF992309F403 |
:1021A0000895482F5ADFF92FFF57F5959F1B9F1B66 |
:1021B000FF93EBDEFF92EF92DF92CF92BF92AF924E |
:1021C0009F928F926B017C014058479533272227BD |
:1021D00040685FE3B601C70149015A010E94220F1E |
:1021E0009401A5010E946D0E4FEF5FEF53D09B014C |
:1021F000AC0182169306A406B50661F78F909F90F6 |
:10220000AF90BF90CF90DF90EF90FF905F9125DF70 |
:10221000950FBBCE9B01AC010C9471101F930F93D3 |
:102220000027192F10789F775FE340E86130710530 |
:102230008407950718F000680E944211912B6F9354 |
:102240007F938F939F930E940A11E0EBF0E0B8DE3A |
:102250005F914F913F912F910E947110002351F097 |
:102260002BED3FE049EC5FE300E8902717FD506855 |
:102270000E946D0E0F911F910895559145913591D2 |
:10228000259108959B01AC019FE380E8772766279D |
:102290000C94220FE2DE992359F0AA27940FA51F70 |
:1022A00043F032F04FEF50E09417A50714F46DCED1 |
:1022B000E3CE0EF006C000C09FEF80E870E060E063 |
:1022C00008959FE780E870E060E0089597FB092E8D |
:1022D00005260ED057FD04D014D00AD0001C38F4C7 |
:1022E00050954095309521953F4F4F4F5F4F089542 |
:1022F000F6F790958095709561957F4F8F4F9F4F22 |
:102300000895A1E21A2EAA1BBB1BFD010DC0AA1F36 |
:10231000BB1FEE1FFF1FA217B307E407F50720F04E |
:10232000A21BB30BE40BF50B661F771F881F991FC9 |
:102330001A9469F760957095809590959B01AC0112 |
:10234000BD01CF01089509D001921A94E1F70895D3 |
:1023500001900BD01A94E1F70895F999FECFB2BD20 |
:10236000A1BDF89A119600B40895F999FECFB2BDB7 |
:10237000A1BD00BC11960FB6F894FA9AF99A0FBE57 |
:022380000895BE |
:10238200FFFF01024143432070726573656E740A58 |
:10239200004D61676E657420582020202020202087 |
:1023A200204D61676E657420592020202020202056 |
:1023B200204D61676E6574205A2020202020202045 |
:1023C200205261774D61676E65742058202020206D |
:1023D200205261774D61676E65742059202020205C |
:1023E200205261774D61676E6574205A202020204B |
:1023F200204174746974756465204E69636B202092 |
:1024020020417474697475646520526F6C6C20206D |
:10241200204D61676E65742058204F66667365743F |
:10242200204D61676E657420582052616E67652089 |
:10243200204D61676E65742059204F66667365741E |
:10244200204D61676E657420592052616E67652068 |
:10245200204D61676E6574205A204F6666736574FD |
:10246200204D61676E6574205A2052616E67652047 |
:102472002043616C73746174652020202020202029 |
:102482002048656164696E6720202020202020207A |
:10249200205573657230202020202020202020200B |
:1024A20020557365723120202020202020202020FA |
:1024B200204163632058202020202020202020203B |
:1024C200204163632059202020202020202020202A |
:1024D20020416363205A2020202020202020202019 |
:1024E2002052617741636320582020202020202041 |
:1024F2002052617741636320592020202020202030 |
:1025020020526177416363205A202020202020201E |
:10251200204163632058204F666673657420202033 |
:10252200204163632059204F666673657420202022 |
:1025320020416363205A204F666673657420202011 |
:1025420020416E616C6F67323720202020202020CE |
:1025520020416E616C6F67323820202020202020BD |
:1025620020416E616C6F67323920202020202020AC |
:1025720020493243204572726F7220202020202091 |
:1025820020493243204F6B617920202020202020D7 |
:0425920020F401012F |
:00000001FF |
/tags/V0.21b/License.txt |
---|
0,0 → 1,59 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
/tags/V0.21b/analog.c |
---|
0,0 → 1,120 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <util/delay.h> |
#include "analog.h" |
uint8_t AccPresent = 0; |
void ADC_Init(void) |
{ |
// The analog inputs have a VREF of 5V and a resolution of 10 bit (0...1024 counts) |
// i.e. 4.88mV/Count |
// set PortC 0,1,2,3 as input |
DDRC &= ~((1<<DDC3)|(1<<DDC2)|(1<<DDC1)|(1<<DDC0)); |
// set PortC 0,1,2,3 as tri state |
PORTC &= ~((1<<PORTC3)|(1<<PORTC2)|(1<<PORTC1)|(1<<PORTC0)); |
// port PD5 and PD6 control the current direction of the test coils of the sensors |
DDRD |= ((1<<DDD5)|(1<<DDD6)); |
FLIP_LOW; |
// disable internal reference voltage and right adjust bits in ADCW |
ADMUX = 0x00; |
// clear start conversion bit (ADSC = 0) |
// disable ADC Auto Trigger Enable (ADATE = 0) |
// disable interrupt (ADIE = 0) |
ADCSRA &= ~((1<<ADSC)|(1<<ADATE)|(1<<ADIE)); |
// Enable ADC (ADEN = 1) with SYSCLK/128 (ADPS2 = 1, ADPS1 = 1, ADPS0 = 1) and clear ready flag (ADIF = 1) |
ADCSRA |= ((1<<ADEN)|(1<<ADIF)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0)); |
ADMUX = 0x00; // select ADC0 |
ADCSRA |= (1<<ADSC); // start conversion |
// Check if acceleration sensor is present |
// The output of the LIS3L02AL (MK3MAG V1.0) and the LIS344ALH (MK3MAG V1.1) is Vdd/5 +/- 10% per 1g. |
// The Vdd is 3.0V at this board therefore the sensitivity is 0.6V/g +/-10% that corresponds to 123 counts. |
// The offsets at 0g is VDD/2 (1.5V) that is 307 counts. |
// that yields to an ADC range of 184 to 430 counts. |
// pullup PC2(AccX) and PC3 (AccY) |
PORTC |= ((1<<PORTC3)|(1<<PORTC2)); |
_delay_ms(10.0); |
// if ADC2 and ADC 3 is larger than 1000 counts (4.88V) no load is at the pins |
if((ADC_GetValue(ADC2) > 1000) && (ADC_GetValue(ADC3) > 1000)) AccPresent = 0; |
else AccPresent = 1; |
// set port back to tristate |
PORTC &= ~((1<<PORTC3)|(1<<PORTC2)); |
} |
uint16_t ADC_GetValue(ADChannel_t channel) |
{ |
uint16_t value = 0; |
ADMUX = channel; // set muxer bits |
ADCSRA |= (1<<ADIF); // clear ready-flag |
ADCSRA |= (1<<ADSC); // start conversion |
while (((ADCSRA & (1<<ADIF)) == 0)); // wait for end of conversion |
value = ADCW; // read adc result |
return(value); |
} |
/tags/V0.21b/analog.h |
---|
0,0 → 1,39 |
#ifndef _ANALOG_H_ |
#define _ANALOG_H_ |
#include <inttypes.h> |
#include <avr/io.h> |
#define FLIP_HIGH PORTD |= ((1<<PORTD5)|(1<<PORTD6)) |
#define FLIP_LOW PORTD &= ~((1<<PORTD5)|(1<<PORTD6)) |
typedef enum |
{ |
ADC0 = 0, |
ADC1 = 1, |
ADC2 = 2, |
ADC3 = 3, |
ADC4 = 4, |
ADC5 = 5, |
ADC6 = 6, |
ADC7 = 7, |
REF1V1 = 14, |
AGND = 15 |
} ADChannel_t; |
#define MAG_X ADC0 |
#define MAG_Y ADC1 |
#define MAG_Z ADC7 |
#define ACC_X ADC2 |
#define ACC_Y ADC3 |
#define ACC_Z ADC6 |
extern uint8_t AccPresent; |
void ADC_Init(void); |
uint16_t ADC_GetValue(ADChannel_t channel); |
#endif // _ANALOG_H_ |
/tags/V0.21b/led.c |
---|
0,0 → 1,70 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "led.h" |
void LED_Init(void) |
{ |
// Set PD7 as output |
DDRD |= (1<<DDD7); |
// set port pon to GND |
PORTD &= ~((1<<PORTD7)); |
} |
/tags/V0.21b/led.h |
---|
0,0 → 1,12 |
#ifndef _LED_H_ |
#define _LED_H_ |
#include <avr/io.h> |
#define LED_GRN_ON PORTD |= (1<<PORTD7) |
#define LED_GRN_OFF PORTD &= ~(1<<PORTD7) |
#define LED_GRN_TOGGLE PORTD ^= (1<<PORTD7) |
void LED_Init(void); |
#endif //_LED_H_ |
/tags/V0.21b/main.c |
---|
0,0 → 1,495 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <avr/interrupt.h> |
#include <math.h> |
#include <stdlib.h> |
#include <stdio.h> |
#include "main.h" |
#include "timer0.h" |
#include "twislave.h" |
#include "led.h" |
#include "analog.h" |
#include "uart.h" |
#define CALIBRATION_VERSION 1 |
AttitudeSource_t AttitudeSource = ATTITUDE_SOURCE_ACC; |
Orientation_t Orientation = ORIENTATION_FC; |
uint16_t Led_Timer = 0; |
typedef struct |
{ |
int16_t Range; |
int16_t Offset; |
} Scaling_t; |
typedef struct |
{ |
Scaling_t MagX; |
Scaling_t MagY; |
Scaling_t MagZ; |
Scaling_t AccX; |
Scaling_t AccY; |
Scaling_t AccZ; |
unsigned char Version; |
} Calibration_t; |
Calibration_t eeCalibration EEMEM; // calibration data in EEProm |
Calibration_t Calibration; // calibration data in RAM |
// magnet sensor variable |
int16_t RawMagnet1a, RawMagnet1b; // raw magnet sensor data |
int16_t RawMagnet2a, RawMagnet2b; |
int16_t RawMagnet3a, RawMagnet3b; |
int16_t UncalMagX, UncalMagY, UncalMagZ; // sensor signal difference without Scaling |
int16_t MagX = 0, MagY = 0, MagZ = 0; // rescaled magnetic field readings |
// acceleration sensor variables |
int16_t RawAccX = 0, RawAccY = 0, RawAccZ = 0; // raw acceleration readings |
int16_t AccX = 0, AccY = 0, AccZ = 0; // rescaled acceleration readings |
int16_t AccAttitudeNick = 0, AccAttitudeRoll = 0; // nick and roll angle from acc |
int16_t Heading = -1; // the current compass heading in deg |
void CalcFields(void) |
{ |
UncalMagX = (RawMagnet1a - RawMagnet1b); |
UncalMagY = (RawMagnet3a - RawMagnet3b); |
UncalMagZ = (RawMagnet2a - RawMagnet2b); |
if(Calibration.MagX.Range != 0) MagX = (1024L * (int32_t)(UncalMagX - Calibration.MagX.Offset)) / (Calibration.MagX.Range); |
else MagX = 0; |
if(Calibration.MagY.Range != 0) MagY = (1024L * (int32_t)(UncalMagY - Calibration.MagY.Offset)) / (Calibration.MagY.Range); |
else MagY = 0; |
if(Calibration.MagY.Range != 0) MagZ = (1024L * (int32_t)(UncalMagZ - Calibration.MagZ.Offset)) / (Calibration.MagZ.Range); |
else MagZ = 0; |
if(AccPresent) |
{ |
AccX = (RawAccX - Calibration.AccX.Offset); |
AccY = (RawAccY - Calibration.AccY.Offset); |
AccZ = (Calibration.AccZ.Offset - RawAccZ); |
#if (BOARD == 10) // the hardware 1.0 has the LIS3L02AL |
// acc mode assumes orientation like FC |
if(AccX > 136) AccAttitudeNick = -800; |
else |
if(AccX < -136) AccAttitudeNick = 800; |
else AccAttitudeNick = (int16_t)(-1800.0 * asin((double) AccX / 138.0) / M_PI); |
if(AccY > 136) AccAttitudeRoll = 800; |
else |
if(AccY < -136) AccAttitudeRoll = -800; |
else AccAttitudeRoll = (int16_t)( 1800.0 * asin((double) AccY / 138.0) / M_PI); |
#else // the hardware 1.1 has the LIS344ALH with a different axis definition (X -> -Y, Y -> X, Z -> Z) |
// acc mode assumes orientation like FC |
if(AccY > 136) AccAttitudeNick = 800; |
else |
if(AccY < -136) AccAttitudeNick = -800; |
else AccAttitudeNick = (int16_t)( 1800.0 * asin((double) AccY / 138.0) / M_PI); |
if(AccX > 136) AccAttitudeRoll = 800; |
else |
if(AccX < -136) AccAttitudeRoll = -800; |
else AccAttitudeRoll = (int16_t)( 1800.0 * asin((double) AccX / 138.0) / M_PI); |
#endif |
} |
} |
void CalcHeading(void) |
{ |
double nick_rad, roll_rad, Hx, Hy, Cx = 0.0, Cy = 0.0, Cz = 0.0; |
int16_t nick, roll; |
int16_t heading = -1; |
// blink code for normal operation |
if(CheckDelay(Led_Timer)) |
{ |
if(Calibration.Version != CALIBRATION_VERSION) LED_GRN_TOGGLE; |
else LED_GRN_ON; |
Led_Timer = SetDelay(150); |
} |
switch(Orientation) |
{ |
case ORIENTATION_NC: |
Cx = MagX; |
Cy = MagY; |
Cz = MagZ; |
break; |
case ORIENTATION_FC: |
// rotation of 90 deg compared to NC setup |
Cx = MagY; |
Cy = -MagX; |
Cz = MagZ; |
break; |
} |
// calculate nick and roll angle in rad |
switch(AttitudeSource) |
{ |
case ATTITUDE_SOURCE_I2C: |
cli(); // stop interrupts |
nick = I2C_WriteAttitude.Nick; |
roll = I2C_WriteAttitude.Roll; |
sei(); // start interrupts |
break; |
case ATTITUDE_SOURCE_UART: |
cli(); // stop interrupts |
nick = ExternData.Attitude[NICK]; |
roll = ExternData.Attitude[ROLL]; |
sei(); // start interrupts |
break; |
case ATTITUDE_SOURCE_ACC: |
nick = AccAttitudeNick; |
roll = AccAttitudeRoll; |
break; |
default: |
nick = 0; |
roll = 0; |
break; |
} |
nick_rad = ((double)nick) * M_PI / (double)(1800.0); |
roll_rad = ((double)roll) * M_PI / (double)(1800.0); |
// calculate attitude correction |
Hx = Cx * cos(nick_rad) - Cz * sin(nick_rad); |
Hy = Cy * cos(roll_rad) + Cz * sin(roll_rad); |
DebugOut.Analog[27] = (int16_t)Hx; |
DebugOut.Analog[28] = (int16_t)Hy; |
// calculate Heading |
heading = (int16_t)((180.0 * atan2(Hy, Hx)) / M_PI); |
// atan2 returns angular range from -180 deg to 180 deg in counter clockwise notation |
// but the compass course is defined in a range from 0 deg to 360 deg clockwise notation. |
if (heading < 0) heading = -heading; |
else heading = 360 - heading; |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
if(Calibration.Version != CALIBRATION_VERSION) heading = -1; // Version of the calibration Data does not match |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
cli(); // stop interrupts |
if(abs(heading) < 361) Heading = heading; |
else (Heading = -1); |
sei(); // start interrupts |
} |
void Calibrate(void) |
{ |
uint8_t cal; |
static uint8_t calold = 0; |
static int16_t Xmin = 0, Xmax = 0, Ymin = 0, Ymax = 0, Zmin = 0, Zmax = 0; |
static uint8_t blinkcount = 0; |
static uint8_t invert_blinking = 0; |
// check both sources of communication for calibration request |
if(I2C_WriteCal.CalByte) cal = I2C_WriteCal.CalByte; |
else cal = ExternData.CalState; |
if(cal > 5) cal = 0; |
// blink code for current calibration state |
if(cal) |
{ |
if(CheckDelay(Led_Timer) || (cal != calold)) |
{ |
if(blinkcount & 0x01) if(invert_blinking) LED_GRN_ON; else LED_GRN_OFF; |
else if(invert_blinking) LED_GRN_OFF; else LED_GRN_ON; |
// end of blinkcount sequence |
if((blinkcount + 1 ) >= (2 * cal)) |
{ |
blinkcount = 0; |
Led_Timer = SetDelay(1500); |
} |
else |
{ |
blinkcount++; |
Led_Timer = SetDelay(100); |
} |
} |
} |
else |
{ |
if(invert_blinking) LED_GRN_ON; else LED_GRN_OFF; |
} |
// calibration state machine |
switch(cal) |
{ |
case 1: // 1st step of calibration |
// initialize ranges |
// used to change the orientation of the MK3MAG in the horizontal plane |
Xmin = 10000; |
Xmax = -10000; |
Ymin = 10000; |
Ymax = -10000; |
Zmin = 10000; |
Zmax = -10000; |
Calibration.AccX.Offset = RawAccX; |
Calibration.AccY.Offset = RawAccY; |
Calibration.AccZ.Offset = RawAccZ; |
invert_blinking = 0; |
break; |
case 2: // 2nd step of calibration |
// find Min and Max of the X- and Y-Sensors during rotation in the horizontal plane |
if(UncalMagX < Xmin) Xmin = UncalMagX; |
if(UncalMagX > Xmax) Xmax = UncalMagX; |
if(UncalMagY < Ymin) Ymin = UncalMagY; |
if(UncalMagY > Ymax) Ymax = UncalMagY; |
invert_blinking = 1; |
break; |
case 3: // 3rd step of calibration |
// used to change the orientation of the MK3MAG vertical to the horizontal plane |
invert_blinking = 0; |
break; |
case 4: |
// find Min and Max of the Z-Sensor |
if(UncalMagZ < Zmin) Zmin = UncalMagZ; |
if(UncalMagZ > Zmax) Zmax = UncalMagZ; |
invert_blinking = 1; |
break; |
case 5: |
// Save values |
if(cal != calold) // avoid continously writing of eeprom! |
{ |
Calibration.MagX.Range = Xmax - Xmin; |
Calibration.MagX.Offset = (Xmin + Xmax) / 2; |
Calibration.MagY.Range = Ymax - Ymin; |
Calibration.MagY.Offset = (Ymin + Ymax) / 2; |
Calibration.MagZ.Range = Zmax - Zmin; |
Calibration.MagZ.Offset = (Zmin + Zmax) / 2; |
if((Calibration.MagX.Range > 150) && (Calibration.MagY.Range > 150) && (Calibration.MagZ.Range > 150)) |
{ |
Calibration.Version = CALIBRATION_VERSION; |
// indicate write process by setting the led off for 2 seconds |
LED_GRN_OFF; |
eeprom_write_block(&Calibration, &eeCalibration, sizeof(Calibration)); |
Led_Timer = SetDelay(2000); |
// reset blinkcode |
blinkcount = 0; |
} |
} |
invert_blinking = 0; |
break; |
default: |
break; |
} |
calold = cal; |
} |
void SetDebugValues(void) |
{ |
DebugOut.Analog[0] = MagX; |
DebugOut.Analog[1] = MagY; |
DebugOut.Analog[2] = MagZ; |
DebugOut.Analog[3] = UncalMagX; |
DebugOut.Analog[4] = UncalMagY; |
DebugOut.Analog[5] = UncalMagZ; |
switch(AttitudeSource) |
{ |
case ATTITUDE_SOURCE_ACC: |
DebugOut.Analog[6] = AccAttitudeNick; |
DebugOut.Analog[7] = AccAttitudeRoll; |
break; |
case ATTITUDE_SOURCE_UART: |
DebugOut.Analog[6] = ExternData.Attitude[NICK]; |
DebugOut.Analog[7] = ExternData.Attitude[ROLL]; |
break; |
case ATTITUDE_SOURCE_I2C: |
DebugOut.Analog[6] = I2C_WriteAttitude.Nick; |
DebugOut.Analog[7] = I2C_WriteAttitude.Roll; |
break; |
} |
DebugOut.Analog[8] = Calibration.MagX.Offset; |
DebugOut.Analog[9] = Calibration.MagX.Range; |
DebugOut.Analog[10] = Calibration.MagY.Offset; |
DebugOut.Analog[11] = Calibration.MagY.Range; |
DebugOut.Analog[12] = Calibration.MagZ.Offset; |
DebugOut.Analog[13] = Calibration.MagZ.Range; |
if(I2C_WriteCal.CalByte) DebugOut.Analog[14] = I2C_WriteCal.CalByte; |
else DebugOut.Analog[14] = ExternData.CalState; |
DebugOut.Analog[15] = Heading; |
DebugOut.Analog[16] = ExternData.UserParam[0]; |
DebugOut.Analog[17] = ExternData.UserParam[1]; |
DebugOut.Analog[18] = AccX; |
DebugOut.Analog[19] = AccY; |
DebugOut.Analog[20] = AccZ; |
DebugOut.Analog[21] = RawAccX; |
DebugOut.Analog[22] = RawAccY; |
DebugOut.Analog[23] = RawAccZ; |
DebugOut.Analog[24] = Calibration.AccX.Offset; |
DebugOut.Analog[25] = Calibration.AccY.Offset; |
DebugOut.Analog[26] = Calibration.AccZ.Offset; |
DebugOut.Analog[29] = AttitudeSource; |
} |
void AccMeasurement(void) |
{ |
if(AccPresent) |
{ |
RawAccX = (RawAccX + (int16_t)ADC_GetValue(ACC_X))/2; |
RawAccY = (RawAccY + (int16_t)ADC_GetValue(ACC_Y))/2; |
RawAccZ = (RawAccZ + (int16_t)ADC_GetValue(ACC_Z))/2; |
} |
else |
{ |
RawAccX = 0; |
RawAccY = 0; |
RawAccZ = 0; |
} |
} |
int main (void) |
{ |
// reset input pullup |
DDRC &=~((1<<DDC6)); |
PORTC |= (1<<PORTC6); |
LED_Init(); |
TIMER0_Init(); |
USART0_Init(); |
ADC_Init(); |
I2C_Init(); |
sei(); // enable globale interrupts |
if(AccPresent) |
{ |
USART0_Print("ACC present\n"); |
} |
LED_GRN_ON; |
Led_Timer = SetDelay(200); |
// read calibration info from eeprom |
eeprom_read_block(&Calibration, &eeCalibration, sizeof(Calibration)); |
ExternData.CalState = 0; |
I2C_WriteCal.CalByte = 0; |
// main loop |
while (1) |
{ |
FLIP_LOW; |
Delay_ms(2); |
RawMagnet1a = ADC_GetValue(MAG_X); |
RawMagnet2a = -ADC_GetValue(MAG_Y); |
RawMagnet3a = ADC_GetValue(MAG_Z); |
AccMeasurement(); |
Delay_ms(1); |
FLIP_HIGH; |
Delay_ms(2); |
RawMagnet1b = ADC_GetValue(MAG_X); |
RawMagnet2b = -ADC_GetValue(MAG_Y); |
RawMagnet3b = ADC_GetValue(MAG_Z); |
AccMeasurement(); |
Delay_ms(1); |
CalcFields(); |
if(ExternData.CalState || I2C_WriteCal.CalByte) Calibrate(); |
else CalcHeading(); |
// check data from USART |
USART0_ProcessRxData(); |
if(NC_Connected) NC_Connected--; |
if(FC_Connected) FC_Connected--; |
// fall back to attitude estimation from acc sensor if NC or FC does'nt send attittude data |
if(!FC_Connected && ! NC_Connected) |
{ |
AttitudeSource = ATTITUDE_SOURCE_ACC; |
Orientation = ORIENTATION_FC; |
} |
if(PC_Connected) |
{ |
USART0_EnableTXD(); |
USART0_TransmitTxData(); |
PC_Connected--; |
} |
else |
{ |
USART0_DisableTXD(); |
} |
} // while(1) |
} |
/tags/V0.21b/main.h |
---|
0,0 → 1,34 |
#ifndef _MAIN_H_ |
#define _MAIN_H_ |
#include <avr/eeprom.h> |
#include <inttypes.h> |
typedef enum |
{ |
ATTITUDE_SOURCE_I2C, |
ATTITUDE_SOURCE_UART, |
ATTITUDE_SOURCE_ACC |
} AttitudeSource_t; |
typedef enum |
{ |
ORIENTATION_NC = 0, |
ORIENTATION_FC = 1 |
} Orientation_t; |
extern int16_t Heading; |
extern AttitudeSource_t AttitudeSource; |
extern Orientation_t Orientation; |
extern int16_t MagX, MagY, MagZ; |
void SetDebugValues(void); |
#endif //_MAIN_H_ |
/tags/V0.21b/makefile |
---|
0,0 → 1,420 |
#-------------------------------------------------------------------- |
# MCU name |
MCU = atmega168 |
F_CPU = 8000000 |
#------------------------------------------------------------------- |
BOARD = 10 |
#BOARD = 11 |
VERSION_MAJOR = 0 |
VERSION_MINOR = 21 |
VERSION_PATCH = 1 |
VERSION_SERIAL_MAJOR = 10 # Serial Protocol Major Version |
VERSION_SERIAL_MINOR = 0 # Serial Protocol Minor Version |
NC_I2C_COMPATIBLE = 2 # I2C Protocol Version |
#------------------------------------------------------------------- |
# get SVN revision |
REV := $(shell sh -c "cat .svn/entries | sed -n '4p'") |
# Output format. (can be srec, ihex, binary) |
FORMAT = ihex |
# Target file name (without extension). |
ifeq ($(VERSION_PATCH), 0) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)a_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 1) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)b_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 2) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)c_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 3) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)d_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 4) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)e_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 5) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)f_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 6) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)g_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 7) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)h_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 8) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)i_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 9) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)j_SVN$(REV) |
endif |
# Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. |
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
OPT = s |
########################################################################################################## |
# List C source files here. (C dependencies are automatically generated.) |
SRC = main.c uart.c timer0.c analog.c twislave.c led.c |
########################################################################################################## |
# List Assembler source files here. |
# Make them always end in a capital .S. Files ending in a lowercase .s |
# will not be considered source files but generated files (assembler |
# output from the compiler), and will be deleted upon "make clean"! |
# Even though the DOS/Win* filesystem matches both .s and .S the same, |
# it will preserve the spelling of the filenames, and gcc itself does |
# care about how the name is spelled on its command-line. |
ASRC = |
# List any extra directories to look for include files here. |
# Each directory must be seperated by a space. |
EXTRAINCDIRS = |
CDEFS = -DF_CPU=$(F_CPU)UL |
# Optional compiler flags. |
# -g: generate debugging information (for GDB, or for COFF conversion) |
# -O*: optimization level |
# -f...: tuning, see gcc manual and avr-libc documentation |
# -Wall...: warning level |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create assembler listing |
CFLAGS = -g -O$(OPT) \ |
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ |
-Wall -Wstrict-prototypes \ |
-Wa,-adhlns=$(<:.c=.lst) \ |
$(patsubst %,-I%,$(EXTRAINCDIRS)) |
# Set a "language standard" compiler flag. |
# Unremark just one line below to set the language standard to use. |
# gnu99 = C99 + GNU extensions. See GCC manual for more information. |
#CFLAGS += -std=c89 |
#CFLAGS += -std=gnu89 |
#CFLAGS += -std=c99 |
CFLAGS += -std=gnu99 |
CFLAGS += $(CDEFS) |
CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_PATCH=$(VERSION_PATCH) -DVERSION_SERIAL_MAJOR=$(VERSION_SERIAL_MAJOR) -DVERSION_SERIAL_MINOR=$(VERSION_SERIAL_MINOR) -DBOARD=$(BOARD) -DNC_I2C_COMPATIBLE=$(NC_I2C_COMPATIBLE) |
ifeq ($(AVR_CTRL_PLATINE), 1) |
CFLAGS += -DAVR_CTRL_PLATINE=$(AVR_CTRL_PLATINE) |
endif |
# Optional assembler flags. |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create listing |
# -gstabs: have the assembler create line number information; note that |
# for use in COFF files, additional information about filenames |
# and function names needs to be present in the assembler source |
# files -- see avr-libc docs [FIXME: not yet described there] |
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
# Optional linker flags. |
# -Wl,...: tell GCC to pass this to linker. |
# -Map: create map file |
# --cref: add cross reference to map file |
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref |
# Additional libraries |
# Minimalistic printf version |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_min |
# Floating point printf version (requires -lm below) |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt |
# -lm = math library |
LDFLAGS += -lm |
# Programming support using avrdude. Settings and variables. |
# Programming hardware: alf avr910 avrisp bascom bsd |
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 |
# |
# Type: avrdude -c ? |
# to get a full listing. |
# |
AVRDUDE_PROGRAMMER = dt006 |
#AVRDUDE_PROGRAMMER = stk200 |
#AVRDUDE_PORT = com1 # programmer connected to serial device |
AVRDUDE_PORT = lpt1 # programmer connected to parallel port |
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex |
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
AVRDUDE_FLAGS = -F -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) |
# Uncomment the following if you want avrdude's erase cycle counter. |
# Note that this counter needs to be initialized first using -Yn, |
# see avrdude manual. |
#AVRDUDE_ERASE += -y |
# Uncomment the following if you do /not/ wish a verification to be |
# performed after programming the device. |
#AVRDUDE_FLAGS += -V -E noreset |
# Increase verbosity level. Please use this when submitting bug |
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> |
# to submit bug reports. |
#AVRDUDE_FLAGS += -v -v |
# --------------------------------------------------------------------------- |
# Define directories, if needed. |
DIRAVR = c:/winavr |
DIRAVRBIN = $(DIRAVR)/bin |
DIRAVRUTILS = $(DIRAVR)/utils/bin |
DIRINC = . |
DIRLIB = $(DIRAVR)/avr/lib |
# Define programs and commands. |
SHELL = sh |
CC = avr-gcc |
OBJCOPY = avr-objcopy |
OBJDUMP = avr-objdump |
SIZE = avr-size |
# Programming support using avrdude. |
AVRDUDE = avrdude |
REMOVE = rm -f |
COPY = cp |
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
ELFSIZE = $(SIZE) -A $(TARGET).elf |
# Define Messages |
# English |
MSG_ERRORS_NONE = Errors: none |
MSG_BEGIN = -------- begin -------- |
MSG_END = -------- end -------- |
MSG_SIZE_BEFORE = Size before: |
MSG_SIZE_AFTER = Size after: |
MSG_COFF = Converting to AVR COFF: |
MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
MSG_FLASH = Creating load file for Flash: |
MSG_EEPROM = Creating load file for EEPROM: |
MSG_EXTENDED_LISTING = Creating Extended Listing: |
MSG_SYMBOL_TABLE = Creating Symbol Table: |
MSG_LINKING = Linking: |
MSG_COMPILING = Compiling: |
MSG_ASSEMBLING = Assembling: |
MSG_CLEANING = Cleaning project: |
# Define all object files. |
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) |
# Define all listing files. |
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) |
# Combine all necessary flags and optional flags. |
# Add target processor to flags. |
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
# Default target. |
all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ |
$(TARGET).lss $(TARGET).sym sizeafter finished end |
# Eye candy. |
# AVR Studio 3.x does not check make's exit code but relies on |
# the following magic strings to be generated by the compile job. |
begin: |
@echo |
@echo $(MSG_BEGIN) |
finished: |
@echo $(MSG_ERRORS_NONE) |
end: |
@echo $(MSG_END) |
@echo |
# Display size of file. |
sizebefore: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi |
sizeafter: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi |
# Display compiler version information. |
gccversion : |
@$(CC) --version |
# Convert ELF to COFF for use in debugging / simulating in |
# AVR Studio or VMLAB. |
COFFCONVERT=$(OBJCOPY) --debugging \ |
--change-section-address .data-0x800000 \ |
--change-section-address .bss-0x800000 \ |
--change-section-address .noinit-0x800000 \ |
--change-section-address .eeprom-0x810000 |
coff: $(TARGET).elf |
@echo |
@echo $(MSG_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof |
extcoff: $(TARGET).elf |
@echo |
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof |
# Program the device. |
program: $(TARGET).hex $(TARGET).eep |
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
# Create final output files (.hex, .eep) from ELF output file. |
%.hex: %.elf |
@echo |
@echo $(MSG_FLASH) $@ |
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ |
%.eep: %.elf |
@echo |
@echo $(MSG_EEPROM) $@ |
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ |
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@ |
# Create extended listing file from ELF output file. |
%.lss: %.elf |
@echo |
@echo $(MSG_EXTENDED_LISTING) $@ |
$(OBJDUMP) -h -S $< > $@ |
# Create a symbol table from ELF output file. |
%.sym: %.elf |
@echo |
@echo $(MSG_SYMBOL_TABLE) $@ |
avr-nm -n $< > $@ |
# Link: create ELF output file from object files. |
.SECONDARY : $(TARGET).elf |
.PRECIOUS : $(OBJ) |
%.elf: $(OBJ) |
@echo |
@echo $(MSG_LINKING) $@ |
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) |
# Compile: create object files from C source files. |
%.o : %.c |
@echo |
@echo $(MSG_COMPILING) $< |
$(CC) -c $(ALL_CFLAGS) $< -o $@ |
# Compile: create assembler files from C source files. |
%.s : %.c |
$(CC) -S $(ALL_CFLAGS) $< -o $@ |
# Assemble: create object files from assembler source files. |
%.o : %.S |
@echo |
@echo $(MSG_ASSEMBLING) $< |
$(CC) -c $(ALL_ASFLAGS) $< -o $@ |
# Target: clean project. |
clean: begin clean_list finished end |
clean_list : |
@echo |
@echo $(MSG_CLEANING) |
# $(REMOVE) $(TARGET).hex |
# $(REMOVE) $(TARGET).eep |
# $(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).cof |
$(REMOVE) $(TARGET).elf |
$(REMOVE) $(TARGET).map |
$(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).a90 |
$(REMOVE) $(TARGET).sym |
$(REMOVE) $(TARGET).lnk |
$(REMOVE) $(TARGET).lss |
$(REMOVE) $(OBJ) |
$(REMOVE) $(LST) |
$(REMOVE) $(SRC:.c=.s) |
$(REMOVE) $(SRC:.c=.d) |
# Automatically generate C source code dependencies. |
# (Code originally taken from the GNU make user manual and modified |
# (See README.txt Credits).) |
# |
# Note that this will work with sh (bash) and sed that is shipped with WinAVR |
# (see the SHELL variable defined above). |
# This may not work with other shells or other seds. |
# |
%.d: %.c |
set -e; $(CC) -MM $(ALL_CFLAGS) $< \ |
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ |
[ -s $@ ] || rm -f $@ |
# Remove the '-' if you want to see the dependency files generated. |
-include $(SRC:.c=.d) |
# Listing of phony targets. |
.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ |
clean clean_list program |
/tags/V0.21b/timer0.c |
---|
0,0 → 1,170 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <inttypes.h> |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include "main.h" |
volatile uint16_t CountMilliseconds = 0; |
volatile uint16_t I2C_Timeout = 0; |
/*****************************************************/ |
/* Initialize Timer 0 */ |
/*****************************************************/ |
void TIMER0_Init(void) |
{ |
// set PB2 as output for the PWM used to signal compass heading |
DDRB |= (1<<DDB2); |
PORTB &= ~(1<<PORTB2); |
// Timer/Counter 0 Control Register A |
// Normal Timer Counter Mode (Bits WGM02 = 0, WGM01 = 0, WGM00 = 0) |
// OC0A disconnected (Bits COM0A1 = 0, COM0A0 = 0) |
// OC0B disconnected (Bits COM0B1 = 0, COM0B0 = 0) |
TCCR0A &= ~((1<<COM0A1)|(1<<COM0A0)|(1<<COM0B1)|(1<<COM0B0)|(1<<WGM01)|(1<<WGM00)); |
// Timer/Counter 0 Control Register B |
// set clock devider for timer 0 to SYSKLOCK/8 = 8MHz / 8 = 1MHz |
// i.e. the timer increments from 0x00 to 0xFF with an update rate of 2.5 MHz |
// hence the timer overflow interrupt frequency is 2.5 MHz / 256 = 9.765 kHz |
// divider 8 (Bits CS02 = 0, CS01 = 1, CS00 = 0) |
TCCR0B &= ~((1<<FOC0A)|(1<<FOC0B)|(1<<WGM02)|(1<<CS02)); |
TCCR0B = (1<<CS01)|(0<<CS00); |
// init Timer/Counter 0 Register |
TCNT0 = 0; |
// Timer/Counter 0 Interrupt Mask Register |
// enable timer overflow interrupt only |
TIMSK0 &= ~((1<<OCIE0B)|(1<<OCIE0A)); |
TIMSK0 |= (1<<TOIE0); |
} |
// ----------------------------------------------------------------------- |
ISR(TIMER0_OVF_vect) |
{ |
static uint8_t cnt; |
static uint16_t cmps_cnt; |
// reload timer register so that overflow occurs after 100 increments at 1 MHz |
// resulting in a calling rate of this ISR of 10kHz or 0.1 ms. |
TCNT0 -= 101; |
// disable PWM when bad compass heading value |
if(Heading < 0) |
{ |
PORTB &= ~(1<<PORTB2); |
cmps_cnt = 0; |
} |
else |
{ |
// if a periode of 38.0 ms is over |
if(++cmps_cnt >= 380) |
{ |
// set PWM out to high |
PORTB |= (1<<PORTB2); |
// reset periode counter |
cmps_cnt = 0; |
} |
// if the delay in 0.1 ms is equal to Heading + 10 |
else if(cmps_cnt >= (Heading + 10)) |
{ |
// set PWM out to low |
PORTB &= ~(1<<PORTB2); |
} |
} |
if(!--cnt) |
{ |
// every 10th run (1kHz or 1ms) |
cnt = 10; |
CountMilliseconds++; |
if(I2C_Timeout) I2C_Timeout--; |
} |
} |
// ----------------------------------------------------------------------- |
uint16_t SetDelay (uint16_t t) |
{ |
return(CountMilliseconds + t - 1); |
} |
// ----------------------------------------------------------------------- |
int8_t CheckDelay(uint16_t t) |
{ |
return(((t - CountMilliseconds) & 0x8000) >> 8); // check sign bit |
} |
// ----------------------------------------------------------------------- |
void Delay_ms(uint16_t wait) |
{ |
uint16_t t_stop; |
t_stop = SetDelay(wait); |
while (!CheckDelay(t_stop)); |
} |
/tags/V0.21b/timer0.h |
---|
0,0 → 1,17 |
#ifndef _TIMER0_H |
#define _TIMER0_H |
#include <inttypes.h> |
extern volatile uint16_t CountMilliseconds; |
extern volatile uint16_t I2C_Timeout; |
void TIMER0_Init(void); |
uint16_t SetDelay (uint16_t t); |
int8_t CheckDelay(uint16_t t); |
void Delay_ms(uint16_t wait); |
#endif //_TIMER0_H |
/tags/V0.21b/twislave.c |
---|
0,0 → 1,294 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <util/twi.h> |
#include "twislave.h" |
#include "uart.h" |
#include "main.h" |
#include "timer0.h" |
#include "led.h" |
volatile uint8_t I2C_RxBufferSize = 0, I2C_TxBufferSize = 0; |
volatile uint8_t *I2C_TxBuffer = 0, *I2C_RxBuffer = 0; |
volatile uint8_t Tx_Idx = 0, Rx_Idx = 0; |
volatile uint8_t I2C_PrimRxBuffer[10]; |
uint8_t NC_Connected = 0; |
I2C_Heading_t I2C_Heading; |
I2C_WriteAttitude_t I2C_WriteAttitude; |
I2C_Mag_t I2C_Mag; |
I2C_Version_t I2C_Version; |
I2C_WriteCal_t I2C_WriteCal; |
void I2C_Init(void) |
{ |
uint8_t sreg; |
// backup status register |
sreg = SREG; |
// disable global interrupts |
cli(); |
// SCK/SCL and MISO/SDA are at put together on the same connector pin in the schematic |
// set PB4 (SCK) and PB5 (MISO) as input pull up |
DDRB &= ~((1<<DDB4)|(1<<DDB5)); |
PORTB |= ((1<<PORTB4)|(1<<PORTB5)); |
// set PC4 (SDA) and PC5 (SCL) as input tristate |
DDRC &= ~((1<<DDC4)|(1<<DDC5)); |
PORTC &= ~((1<<PORTC4)|(1<<PORTC5)); |
I2C_TxBuffer = 0; |
Tx_Idx = 0; |
I2C_TxBufferSize = 0; |
I2C_RxBuffer = 0; |
Rx_Idx = 0; |
I2C_RxBufferSize = 0; |
TWCR &= ~(1<<TWSTA)|(1<<TWSTO); |
TWCR|= (1<<TWEA) | (1<<TWEN)|(1<<TWIE); |
// set own address |
// set own address in the upper 7 bits |
TWAR = I2C_SLAVE_ADDRESS; // set own address only the upper 7 bits are relevant |
// TWI Control Register |
// enable TWI Acknowledge Bit (TWEA = 1) |
// disable TWI START Condition Bit (TWSTA = 0), SLAVE |
// disable TWI STOP Condition Bit (TWSTO = 0), SLAVE |
// enable TWI (TWEN = 1) |
// enable TWI Interrupt (TWIE = 1) |
TWCR |= (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(1<<TWEA)|(0<<TWSTA)|(1<<TWSTO)|(0<<TWWC); |
// update version info |
I2C_Version.Major = VERSION_MAJOR; |
I2C_Version.Minor = VERSION_MINOR; |
I2C_Version.Patch = VERSION_PATCH; |
I2C_Version.Compatible = NC_I2C_COMPATIBLE; |
// resore status register |
SREG = sreg; |
} |
// send ACK after recieving a byte / ACK is expected after transmitting a byte |
#define TWCR_ACK TWCR = (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(1<<TWEA)|(0<<TWSTA)|(0<<TWSTO)|(0<<TWWC) |
// send no ACK after recieving a byte / No ACK is expected after transmitting a byte |
#define TWCR_NACK TWCR = (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(0<<TWEA)|(0<<TWSTA)|(0<<TWSTO)|(0<<TWWC) |
// switched to the non adressed slave mode |
#define TWCR_RESET TWCR = (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(1<<TWEA)|(0<<TWSTA)|(0<<TWSTO)|(0<<TWWC) |
// The bit pattern for TWCR_ACK and TWCR_RESET are equal. This is no errro but used for better understanding. |
#define TWCR_CLEARBUS TWCR = (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(1<<TWEA)|(0<<TWSTA)|(1<<TWSTO)|(0<<TWWC) |
ISR (TWI_vect) |
{ |
uint8_t data; |
static uint8_t crc; |
// check event |
switch (TW_STATUS) |
{ |
case TW_SR_SLA_ACK: // slave addressed in receiver mode and ack has been returned |
Rx_Idx = 0xFF; // reset rx buffer pointer |
TWCR_ACK; // trigger receiving of first data byte and send ack afterwards |
return; |
case TW_SR_DATA_ACK: // data has been received and ack has been returned |
data = TWDR; |
if (Rx_Idx == 0xFF) |
{ // if the first byte after slave addressing was received |
switch(data) |
{ |
case I2C_CMD_VERSION: |
I2C_TxBuffer = (uint8_t *)&I2C_Version; |
I2C_TxBufferSize = sizeof(I2C_Version); |
I2C_RxBuffer = 0; |
I2C_RxBufferSize = 0; |
break; |
case I2C_CMD_WRITE_CAL: |
I2C_TxBuffer = (uint8_t *)&I2C_WriteCal; |
I2C_TxBufferSize = sizeof(I2C_WriteCal); |
I2C_RxBuffer = (uint8_t *)&I2C_WriteCal; |
I2C_RxBufferSize = sizeof(I2C_WriteCal); |
break; |
case I2C_CMD_READ_MAG: |
I2C_TxBuffer = (uint8_t *)&I2C_Mag; |
I2C_TxBufferSize = sizeof(I2C_Mag); |
I2C_RxBuffer = 0; |
I2C_RxBufferSize = 0; |
I2C_Mag.MagX = MagX; |
I2C_Mag.MagY = MagY; |
I2C_Mag.MagZ = MagZ; |
break; |
case I2C_CMD_READ_HEADING: |
I2C_TxBuffer = (uint8_t *)&I2C_Heading; |
I2C_TxBufferSize = sizeof(I2C_Heading); |
I2C_RxBuffer = (uint8_t *)&I2C_WriteAttitude; |
I2C_RxBufferSize = sizeof(I2C_WriteAttitude); |
I2C_Heading.Heading = Heading; |
AttitudeSource = ATTITUDE_SOURCE_I2C; |
Orientation = ORIENTATION_NC; |
NC_Connected = 255; |
break; |
default: // unknown command id |
I2C_RxBuffer = 0; |
I2C_RxBufferSize = 0; |
I2C_TxBuffer = 0; |
I2C_TxBufferSize = 0; |
break; |
} |
Rx_Idx = 0; // set rx buffer index to start of the buffer |
crc = data; |
} |
else // Rx_Idx != 0xFF |
{ |
// fill receiver buffer with the byte that has been received |
// if buffer exist and there is still some free space |
if(Rx_Idx < I2C_RxBufferSize) |
{ |
I2C_PrimRxBuffer[Rx_Idx] = data; |
crc += data; |
} |
else if (Rx_Idx == I2C_RxBufferSize) // crc byte was transfered |
{ // if checksum matched |
if(crc == data) |
{ // and RxBuffer exist |
if(I2C_RxBuffer != 0) |
{ // copy data to rx buffer |
for(data = 0; data < I2C_RxBufferSize; data++) |
{ |
I2C_RxBuffer[data] = I2C_PrimRxBuffer[data]; |
} |
} |
DebugOut.Analog[31]++; |
} |
else |
{ |
DebugOut.Analog[30]++; |
} |
} |
// else ignore data |
Rx_Idx++; |
} |
TWCR_ACK; |
return; |
case TW_ST_SLA_ACK: // slave transmitter selected |
// reset index to start of tx buffer |
Tx_Idx = 0; |
crc = 0; |
// if tx buffer exist and there is at least one byte to transfer |
if((I2C_TxBuffer != 0) && (I2C_TxBufferSize > 1)) |
{ |
data = I2C_TxBuffer[Tx_Idx]; |
} |
else |
{ // send 0x00 if no tx buffer exist or all bytes of the tx buffer have been transmitted |
data = 0x00; |
} |
crc += data; |
Tx_Idx++; |
TWDR = data; |
TWCR_ACK; |
return; |
case TW_ST_DATA_ACK: // data byte has been transmitted ack has been received |
// put next byte from tx buffer to the data register |
if((I2C_TxBuffer != 0) && (Tx_Idx < I2C_TxBufferSize)) |
{ |
data = I2C_TxBuffer[Tx_Idx]; |
crc += data; |
} |
else if (Tx_Idx == I2C_TxBufferSize) |
{ // send crc byte at the end |
data = crc; |
} |
else |
{ |
data = 0x00; |
} |
Tx_Idx++; |
TWDR = data; |
TWCR_ACK; |
return; |
case TW_BUS_ERROR: // Bus-Error |
TWCR_CLEARBUS; // free bus, reset to nonselected slave |
return; |
case TW_ST_DATA_NACK: // data transmitted, NACK received |
case TW_ST_LAST_DATA: // last data byte transmitted, ACK received |
case TW_SR_STOP: // stop or repeated start condition received while selected |
default: |
TWCR_RESET; // switch to the not addressed slave mode, own SLA will be recognized |
return; |
} |
} |
/tags/V0.21b/twislave.h |
---|
0,0 → 1,63 |
#ifndef _TWI_SLAVE_H_ |
#define _TWI_SLAVE_H_ |
#include <inttypes.h> |
#define I2C_SLAVE_ADDRESS 0x50 |
#define I2C_CMD_VERSION 0x01 |
#define I2C_CMD_READ_MAG 0x02 |
#define I2C_CMD_READ_HEADING 0x03 |
#define I2C_CMD_WRITE_CAL 0x04 |
#define I2C_CMD_WRITE_EEPROM 0x0A |
#define I2C_CMD_READ_EEPROM 0x0B |
typedef struct |
{ |
uint8_t Major; |
uint8_t Minor; |
uint8_t Patch; |
uint8_t Compatible; |
} I2C_Version_t; |
typedef struct |
{ |
int16_t MagX; |
int16_t MagY; |
int16_t MagZ; |
} I2C_Mag_t; |
typedef struct |
{ |
int16_t Nick; |
int16_t Roll; |
} I2C_WriteAttitude_t; |
typedef struct |
{ |
uint8_t CalByte; |
uint8_t Dummy1; |
uint8_t Dummy2; |
} I2C_WriteCal_t; |
typedef struct |
{ |
int16_t Heading; |
} I2C_Heading_t; |
extern uint8_t NC_Connected; |
extern I2C_Heading_t I2C_Heading; |
extern I2C_WriteAttitude_t I2C_WriteAttitude; |
extern I2C_Mag_t I2C_Mag; |
extern I2C_Version_t I2C_Version; |
extern I2C_WriteCal_t I2C_WriteCal; |
void I2C_Init(void); |
#endif // _TWI_SLAVE_H_ |
/tags/V0.21b/uart.c |
---|
0,0 → 1,642 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/wdt.h> |
#include <stdarg.h> |
#include <string.h> |
#include "main.h" |
#include "uart.h" |
#include "timer0.h" |
#include "twislave.h" |
// slave addresses |
#define FC_ADDRESS 1 |
#define NC_ADDRESS 2 |
#define MK3MAG_ADDRESS 3 |
#define FALSE 0 |
#define TRUE 1 |
// keep buffers as small as possible |
#define TXD_BUFFER_LEN 100 |
#define RXD_BUFFER_LEN 30 |
volatile uint8_t txd_buffer[TXD_BUFFER_LEN]; |
volatile uint8_t rxd_buffer_locked = FALSE; |
volatile uint8_t rxd_buffer[RXD_BUFFER_LEN]; |
volatile uint8_t txd_complete = TRUE; |
volatile uint8_t ReceivedBytes = 0; |
volatile uint8_t *pRxData = 0; |
volatile uint8_t RxDataLen = 0; |
// send flags |
#define RQST_VERSION_INFO 0x01 |
#define RQST_DEBUG_DATA 0x02 |
#define RQST_DEBUG_LABEL 0x04 |
#define RQST_COMPASS_HEADING 0x08 |
#define RQST_EXTERN_CTRL 0x10 |
uint8_t RequestFlags = 0x00; |
uint8_t RequestDebugLabel = 0; |
uint8_t ConfirmFrame = 0; |
uint8_t PC_Connected = 0; |
uint8_t FC_Connected = 0; |
DebugOut_t DebugOut; |
ExternData_t ExternData; |
ExternControl_t ExternControl; |
UART_VersionInfo_t UART_VersionInfo; |
uint16_t DebugData_Timer; |
uint16_t DebugData_Interval = 500; |
const uint8_t ANALOG_LABEL[32][16] = |
{ |
//1234567890123456 |
"Magnet X ", //0 |
"Magnet Y ", |
"Magnet Z ", |
"RawMagnet X ", |
"RawMagnet Y ", |
"RawMagnet Z ", //5 |
"Attitude Nick ", |
"Attitude Roll ", |
"Magnet X Offset ", |
"Magnet X Range ", |
"Magnet Y Offset ", //10 |
"Magnet Y Range ", |
"Magnet Z Offset ", |
"Magnet Z Range ", |
"Calstate ", |
"Heading ", //15 |
"User0 ", |
"User1 ", |
"Acc X ", |
"Acc Y ", |
"Acc Z ", //20 |
"RawAcc X ", |
"RawAcc Y ", |
"RawAcc Z ", |
"Acc X Offset ", |
"Acc Y Offset ", //25 |
"Acc Z Offset ", |
"Analog27 ", |
"Analog28 ", |
"Analog29 ", |
"I2C Error ", //30 |
"I2C Okay " |
}; |
/****************************************************************/ |
/* Initialization of the USART0 */ |
/****************************************************************/ |
void USART0_Init (void) |
{ |
uint8_t sreg = SREG; |
uint16_t ubrr = (uint16_t) ((uint32_t) F_CPU/(8 * BAUD_RATE) - 1); |
// disable all interrupts before configuration |
cli(); |
// disable RX-Interrupt |
UCSR0B &= ~(1 << RXCIE0); |
// disable TX-Interrupt |
UCSR0B &= ~(1 << TXCIE0); |
// set direction of RXD0 and TXD0 pins |
// set RXD0 (PD0) as an input pin tristate |
DDRD &= ~(1 << DDD0); |
PORTD &= ~(1 << PORTD0); |
// set TXD0 (PD1) as an output pin |
DDRD |= (1 << DDD1); |
PORTD &= ~(1 << PORTD1); |
// USART0 Baud Rate Register |
// set clock divider |
UBRR0H = (uint8_t)(ubrr >> 8); |
UBRR0L = (uint8_t)ubrr; |
// USART0 Control and Status Register A, B, C |
// enable double speed operation |
UCSR0A |= (1 << U2X0); |
// set asynchronous mode |
UCSR0C &= ~(1 << UMSEL01); |
UCSR0C &= ~(1 << UMSEL00); |
// no parity |
UCSR0C &= ~(1 << UPM01); |
UCSR0C &= ~(1 << UPM00); |
// 1 stop bit |
UCSR0C &= ~(1 << USBS0); |
// 8-bit |
UCSR0B &= ~(1 << UCSZ02); |
UCSR0C |= (1 << UCSZ01); |
UCSR0C |= (1 << UCSZ00); |
// enable receiver and transmitter |
UCSR0B |= (1 << RXEN0); |
UCSR0B |= (1 << TXEN0); |
// flush receive buffer |
while ( UCSR0A & (1<<RXC0) ) UDR0; |
// enable RX-Interrupt |
UCSR0B |= (1 << RXCIE0); |
// enable TX-Interrupt |
UCSR0B |= (1 << TXCIE0); |
// initialize the debug timer |
DebugData_Timer = SetDelay(DebugData_Interval); |
// unlock rxd_buffer |
rxd_buffer_locked = FALSE; |
pRxData = 0; |
RxDataLen = 0; |
// no bytes to send |
txd_complete = TRUE; |
UART_VersionInfo.SWMajor = VERSION_MAJOR; |
UART_VersionInfo.SWMinor = VERSION_MINOR; |
UART_VersionInfo.SWPatch = VERSION_PATCH; |
UART_VersionInfo.ProtoMajor = VERSION_SERIAL_MAJOR; |
UART_VersionInfo.ProtoMinor = VERSION_SERIAL_MINOR; |
// Version beim Start ausgeben (nicht schön, aber geht... ) |
USART0_putchar ('\n'); |
USART0_putchar ('C'); |
USART0_putchar ('P'); |
USART0_putchar (':'); |
USART0_putchar ('V'); |
USART0_putchar (0x30 + VERSION_MAJOR); |
USART0_putchar ('.'); |
USART0_putchar (0x30 + VERSION_MINOR/10); |
USART0_putchar (0x30 + VERSION_MINOR%10); |
USART0_putchar ('a' + VERSION_PATCH); |
USART0_putchar ('\n'); |
// restore global interrupt flags |
SREG = sreg; |
} |
// --------------------------------------------------------------------------------- |
void USART0_EnableTXD(void) |
{ |
DDRD |= (1<<DDD1); // set TXD pin as output |
PORTD &= ~(1 << PORTD1); |
UCSR0B |= (1 << TXEN0); // enable TX in USART |
UCSR0B |= (1 << TXCIE0); // disable TX-Interrupt |
} |
// --------------------------------------------------------------------------------- |
void USART0_DisableTXD(void) |
{ |
while(!txd_complete){ }; |
UCSR0B &= ~(1 << TXCIE0); // disable TX-Interrupt |
UCSR0B &= ~(1 << TXEN0); // disable TXD in USART |
DDRD &= ~(1<<DDD1); // set TXD pin as input |
PORTD &= ~(1 << PORTD1); |
} |
/****************************************************************/ |
/* USART0 transmitter ISR */ |
/****************************************************************/ |
ISR(USART_TX_vect) |
{ |
static uint16_t ptr_txd_buffer = 0; |
uint8_t tmp_tx; |
if(!txd_complete) // transmission not completed |
{ |
ptr_txd_buffer++; // die [0] wurde schon gesendet |
tmp_tx = txd_buffer[ptr_txd_buffer]; |
// if terminating character or end of txd buffer was reached |
if((tmp_tx == '\r') || (ptr_txd_buffer == TXD_BUFFER_LEN)) |
{ |
ptr_txd_buffer = 0; // reset txd pointer |
txd_complete = TRUE; // stop transmission |
} |
UDR0 = tmp_tx; // send current byte will trigger this ISR again |
} |
// transmission completed |
else ptr_txd_buffer = 0; |
} |
/****************************************************************/ |
/* USART0 receiver ISR */ |
/****************************************************************/ |
ISR(USART_RX_vect) |
{ |
static uint16_t crc; |
uint8_t crc1, crc2; |
uint8_t c; |
static uint8_t ptr_rxd_buffer = 0; |
c = UDR0; // catch the received byte |
if(rxd_buffer_locked) return; // if rxd buffer is locked immediately return |
// the rxd buffer is unlocked |
if((ptr_rxd_buffer == 0) && (c == '#')) // if rxd buffer is empty and syncronisation character is received |
{ |
rxd_buffer[ptr_rxd_buffer++] = c; // copy 1st byte to buffer |
crc = c; // init crc |
} |
#if 0 |
else if (ptr_rxd_buffer == 1) // handle address |
{ |
rxd_buffer[ptr_rxd_buffer++] = c; // copy byte to rxd buffer |
crc += c; // update crc |
} |
#endif |
else if (ptr_rxd_buffer < RXD_BUFFER_LEN) // collect incomming bytes |
{ |
if(c != '\r') // no termination character |
{ |
rxd_buffer[ptr_rxd_buffer++] = c; // copy byte to rxd buffer |
crc += c; // update crc |
} |
else // termination character was received |
{ |
// the last 2 bytes are no subject for checksum calculation |
// they are the checksum itself |
crc -= rxd_buffer[ptr_rxd_buffer-2]; |
crc -= rxd_buffer[ptr_rxd_buffer-1]; |
// calculate checksum from transmitted data |
crc %= 4096; |
crc1 = '=' + crc / 64; |
crc2 = '=' + crc % 64; |
// compare checksum to transmitted checksum bytes |
if((crc1 == rxd_buffer[ptr_rxd_buffer-2]) && (crc2 == rxd_buffer[ptr_rxd_buffer-1])) |
{ // checksum valid |
rxd_buffer[ptr_rxd_buffer] = '\r'; // set termination character |
ReceivedBytes = ptr_rxd_buffer + 1;// store number of received bytes |
rxd_buffer_locked = TRUE; // lock the rxd buffer |
// if 2nd byte is an 'R' enable watchdog that will result in an reset |
if(rxd_buffer[2] == 'R') {wdt_enable(WDTO_250MS);} // Reset-Commando |
} |
else |
{ // checksum invalid |
rxd_buffer_locked = FALSE; // unlock rxd buffer |
} |
ptr_rxd_buffer = 0; // reset rxd buffer pointer |
} |
} |
else // rxd buffer overrun |
{ |
ptr_rxd_buffer = 0; // reset rxd buffer |
rxd_buffer_locked = FALSE; // unlock rxd buffer |
} |
} |
// -------------------------------------------------------------------------- |
void AddCRC(uint16_t datalen) |
{ |
uint16_t tmpCRC = 0, i; |
for(i = 0; i < datalen; i++) |
{ |
tmpCRC += txd_buffer[i]; |
} |
tmpCRC %= 4096; |
txd_buffer[i++] = '=' + tmpCRC / 64; |
txd_buffer[i++] = '=' + tmpCRC % 64; |
txd_buffer[i++] = '\r'; |
txd_complete = FALSE; |
UDR0 = txd_buffer[0]; // initiates the transmission (continued in the TXD ISR) |
} |
// -------------------------------------------------------------------------- |
void SendOutData(uint8_t cmd, uint8_t address, uint8_t numofbuffers, ...) // uint8_t *pdata, uint8_t len, ... |
{ |
va_list ap; |
uint16_t pt = 0; |
uint8_t a,b,c; |
uint8_t ptr = 0; |
uint8_t *pdata = 0; |
int len = 0; |
txd_buffer[pt++] = '#'; // Start character |
txd_buffer[pt++] = 'a' + address; // Address (a=0; b=1,...) |
txd_buffer[pt++] = cmd; // Command |
va_start(ap, numofbuffers); |
if(numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
while(len) |
{ |
if(len) |
{ |
a = pdata[ptr++]; |
len--; |
if((!len) && numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
} |
else a = 0; |
if(len) |
{ |
b = pdata[ptr++]; |
len--; |
if((!len) && numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
} |
else b = 0; |
if(len) |
{ |
c = pdata[ptr++]; |
len--; |
if((!len) && numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
} |
else c = 0; |
txd_buffer[pt++] = '=' + (a >> 2); |
txd_buffer[pt++] = '=' + (((a & 0x03) << 4) | ((b & 0xf0) >> 4)); |
txd_buffer[pt++] = '=' + (((b & 0x0f) << 2) | ((c & 0xc0) >> 6)); |
txd_buffer[pt++] = '=' + ( c & 0x3f); |
} |
va_end(ap); |
AddCRC(pt); // add checksum after data block and initates the transmission |
} |
// -------------------------------------------------------------------------- |
void Decode64(void) |
{ |
uint8_t a,b,c,d; |
uint8_t x,y,z; |
uint8_t ptrIn = 3; |
uint8_t ptrOut = 3; |
uint8_t len = ReceivedBytes - 6; |
while(len) |
{ |
a = rxd_buffer[ptrIn++] - '='; |
b = rxd_buffer[ptrIn++] - '='; |
c = rxd_buffer[ptrIn++] - '='; |
d = rxd_buffer[ptrIn++] - '='; |
//if(ptrIn > ReceivedBytes - 3) break; |
x = (a << 2) | (b >> 4); |
y = ((b & 0x0f) << 4) | (c >> 2); |
z = ((c & 0x03) << 6) | d; |
if(len--) rxd_buffer[ptrOut++] = x; else break; |
if(len--) rxd_buffer[ptrOut++] = y; else break; |
if(len--) rxd_buffer[ptrOut++] = z; else break; |
} |
pRxData = &rxd_buffer[3]; |
RxDataLen = ptrOut - 3; |
} |
// -------------------------------------------------------------------------- |
int16_t USART0_putchar (int8_t c) |
{ |
// if tx is not enabled return immediatly |
if(!(UCSR0B & (1 << TXEN0))) return (0); |
if (c == '\n') USART0_putchar('\r'); |
// wait until previous character was send |
loop_until_bit_is_set(UCSR0A, UDRE0); |
// send character |
UDR0 = c; |
return (0); |
} |
// -------------------------------------------------------------------------- |
void USART0_ProcessRxData(void) |
{ |
// if data in the rxd buffer are not locked immediately return |
if(!rxd_buffer_locked) return; |
Decode64(); // decode data block in rxd_buffer |
switch(rxd_buffer[1]-'a') // check Slave Address |
{ |
case MK3MAG_ADDRESS: |
switch(rxd_buffer[2]) // check for CmdID |
{ |
case 'w': // old style |
case 'k': // Attitude info from FC |
memcpy(&ExternData, (uint8_t*)pRxData, sizeof(ExternData)); |
RequestFlags |= RQST_COMPASS_HEADING; |
AttitudeSource = ATTITUDE_SOURCE_UART; |
Orientation = ExternData.Orientation; |
FC_Connected = 255; |
break; |
default: |
// unsupported command |
break; |
} // case MK3MAG_ADDRESS: |
default: // any Slave Adress |
switch(rxd_buffer[2]) // check for CmdID |
{ |
case 'b': // extern control |
memcpy(&ExternControl, (uint8_t*)pRxData, sizeof(ExternControl)); |
#define KEY1 0x01 |
#define KEY2 0x02 |
#define KEY3 0x04 |
#define KEY4 0x08 |
#define KEY5 0x10 |
// use right arrow at display for switching the calstate |
if(ExternControl.RemoteButtons & KEY2) |
{ |
ExternData.CalState++; |
if(ExternData.CalState == 6) ExternData.CalState = 0; |
} |
ConfirmFrame = ExternControl.Frame; |
PC_Connected = 255; |
break; |
case 'd': // request for the debug data |
DebugData_Interval = (uint16_t) pRxData[0] * 10; |
if(DebugData_Interval>0) RequestFlags |= RQST_DEBUG_DATA; |
PC_Connected = 255; |
break; |
case 'v': // request version and board release |
RequestFlags |= RQST_VERSION_INFO; |
PC_Connected = 255; |
break; |
case 'h': // request lcd data |
PC_Connected = 255; |
break; |
case 'a':// Labels of the Analog Debug outputs |
RequestDebugLabel = pRxData[0]; |
RequestFlags |= RQST_DEBUG_LABEL; |
PC_Connected = 255; |
break; |
case 'g':// get extern control data |
RequestFlags |= RQST_EXTERN_CTRL; |
PC_Connected = 255; |
break; |
default: |
// unsupported command |
break; |
} |
break; // default: |
} |
// unlock the rxd buffer after processing |
pRxData = 0; |
RxDataLen = 0; |
rxd_buffer_locked = FALSE; |
} |
//--------------------------------------------------------------------------------------------- |
void USART0_TransmitTxData(void) |
{ |
if(!(UCSR0B & (1 << TXEN0))) return; |
if(!txd_complete) return; |
if((RequestFlags & RQST_DEBUG_LABEL) && txd_complete) |
{ |
SendOutData('A', MK3MAG_ADDRESS, 2, (uint8_t *)&RequestDebugLabel, sizeof(RequestDebugLabel), (uint8_t *) ANALOG_LABEL[RequestDebugLabel], 16); |
RequestDebugLabel = 0xFF; |
RequestFlags &= ~RQST_DEBUG_LABEL; |
} |
if(ConfirmFrame && txd_complete) |
{ |
SendOutData('B', MK3MAG_ADDRESS, 1, (uint8_t *) &ConfirmFrame, sizeof(ConfirmFrame)); |
ConfirmFrame = 0; |
} |
if(( (DebugData_Interval>0 && CheckDelay(DebugData_Timer)) || (RequestFlags & RQST_DEBUG_DATA)) && txd_complete) |
{ |
SetDebugValues(); |
SendOutData('D', MK3MAG_ADDRESS, 1, (uint8_t *) &DebugOut, sizeof(DebugOut)); |
DebugData_Timer = SetDelay(DebugData_Interval); |
RequestFlags &= ~RQST_DEBUG_DATA; |
} |
if((RequestFlags & RQST_EXTERN_CTRL) && txd_complete) |
{ |
SendOutData('G', MK3MAG_ADDRESS, 1, (uint8_t *) &ExternControl,sizeof(ExternControl)); |
RequestFlags &= ~RQST_EXTERN_CTRL; |
} |
if((RequestFlags & RQST_COMPASS_HEADING) && txd_complete) |
{ |
SendOutData('K', FC_ADDRESS, 1, (uint8_t *) &I2C_Heading, sizeof(I2C_Heading)); // send compass heading to FC |
RequestFlags &= ~RQST_COMPASS_HEADING; |
} |
if((RequestFlags & RQST_VERSION_INFO) && txd_complete) |
{ |
SendOutData('V', MK3MAG_ADDRESS, 1, (uint8_t *) &UART_VersionInfo, sizeof(UART_VersionInfo)); |
RequestFlags &= ~RQST_VERSION_INFO; |
} |
} |
void USART0_Print(int8_t *msg) |
{ |
uint8_t i = 0; |
while(msg[i] != 0) |
{ |
USART0_putchar(msg[i++]); |
} |
} |
/tags/V0.21b/uart.h |
---|
0,0 → 1,76 |
#ifndef _UART_H_ |
#define _UART_H_ |
#include <inttypes.h> |
#define NICK 0 |
#define ROLL 1 |
#define BAUD_RATE 57600 |
extern uint16_t DebugData_Timer; |
void USART0_Init (void); |
void USART0_EnableTXD(void); |
void USART0_DisableTXD(void); |
void USART0_TransmitTxData(void); |
void USART0_ProcessRxData(void); |
int16_t USART0_putchar(int8_t c); |
void USART0_Print(int8_t *msg); |
typedef struct |
{ |
uint8_t Digital[2]; |
uint16_t Analog[32]; // Debugvalues |
} DebugOut_t; |
extern DebugOut_t DebugOut; |
typedef struct |
{ |
int16_t Attitude[2]; // nick and roll angle in 0.1 deg |
uint8_t UserParam[2]; |
uint8_t CalState; |
uint8_t Orientation; |
} ExternData_t; |
extern ExternData_t ExternData; |
typedef struct |
{ |
uint8_t Digital[2]; |
uint8_t RemoteButtons; |
int8_t Nick; |
int8_t Roll; |
int8_t Yaw; |
uint8_t Gas; |
int8_t Height; |
uint8_t free; |
uint8_t Frame; |
uint8_t Config; |
} ExternControl_t; |
extern ExternControl_t ExternControl; |
typedef struct |
{ |
uint8_t SWMajor; |
uint8_t SWMinor; |
uint8_t ProtoMajor; |
uint8_t ProtoMinor; |
uint8_t SWPatch; |
uint8_t Reserved[5]; |
} UART_VersionInfo_t; |
extern uint8_t PC_Connected; |
extern uint8_t FC_Connected; |
#endif //_UART_H_ |
/tags/V0.21b |
---|
Property changes: |
Added: tsvn:logminsize |
+8 |
\ No newline at end of property |
/tags/V0.22c/Compass.pnproj |
---|
0,0 → 1,0 |
<Project name="avr_ctrl"><File path="uart.h"></File><File path="main.c"></File><File path="main.h"></File><File path="makefile"></File><File path="uart.c"></File><File path="timer0.c"></File><File path="timer0.h"></File><File path="analog.h"></File><File path="analog.c"></File><File path="twislave.c"></File><File path="twislave.h"></File><File path="menu.c"></File></Project> |
/tags/V0.22c/Compassl.pnps |
---|
0,0 → 1,0 |
<pd><ViewState><e p="avr_ctrl" x="true"></e></ViewState></pd> |
/tags/V0.22c/Hex-Files/BootLoader_MEGA168_8MHZ_V0.2.hex |
---|
0,0 → 1,61 |
:1038000011241FBECFEFD4E0DEBFCDBF11E0A0E09A |
:10381000B1E0EEEAFBE302C005900D92A030B107E3 |
:10382000D9F711E0A0E0B1E001C01D92A238B107C4 |
:10383000E1F70C943B1C0C941D1C0895982F80916B |
:10384000C00085FFFCCF9093C60008958091C00012 |
:103850008823E4F78091C600992708958DE40E949B |
:103860001E1C8BE40E941E1C82E40E941E1C8CE421 |
:103870000E941E1C0895CFEFD4E0DEBFCDBFE0E074 |
:10388000F0E004917F01992494BE98E10FB6F8947A |
:1038900090936000109260000FBE9092C50080E18E |
:1038A0008093C4008091C00082608093C000909398 |
:1038B000C10086E08093C200EF01192D8091C00005 |
:1038C00087FF0DC0113031F48091C6008A3A89F12A |
:1038D00010E005C08091C6008B3109F411E0CE01E3 |
:1038E00021968436910500F10F3F41F0002331F01D |
:1038F000E0910001F0910101099516C08AE00E9453 |
:103900001E1C8DE00E941E1C86E50E941E1C80E38A |
:103910000E941E1C8EE20E941E1C82E30E941E1C3E |
:103920008AE30E941E1C05C080E29EE40197F1F725 |
:10393000C5CF0E942E1C0E94261C813611F489E5F9 |
:1039400033C1813471F40E94261CE82EFF24FE2C22 |
:10395000EE240E94261C9927E82AF92AF694E79477 |
:10396000F1C0823641F489E50E941E1C80E00E946D |
:103970001E1C80E819C1823409F075C00E94261C03 |
:103980000E94261CD82E0E94261C082FB2E0AB2EC7 |
:10399000B1E0BB2E10E0E5010894A11CB11C1D157F |
:1039A00018F40E94261C01C08FEF88831F5F17FF49 |
:1039B000F2CF38E7931609F0D4C0063409F03DC0C1 |
:1039C0008FEFE81687E3F80608F033C0CD2DA70186 |
:1039D00066277727440F551F661F771F6A017B01F3 |
:1039E000A2E0B1E011E08D9199272D913327322F7C |
:1039F0002227822B932B0C01FA0110935700E89594 |
:103A000011244E5F5F4F6F4F7F4FC25061F785E0CB |
:103A1000F60180935700E89507B600FCFDCF81E1E1 |
:103A200080935700E89576956795579547957A0165 |
:103A300089C080E00E941E1C85C0053409F082C048 |
:103A4000F7012D2DA2E0B1E0E1BD8F2F992782BDB6 |
:103A50008D9180BD3196FA9AF99AF999FECF21504D |
:103A600099F77F016FC0873609F03DC00E94261C80 |
:103A70000E94261CC82F0E94261C863419F5C701F7 |
:103A8000AA27BB276C017D01CC0CDD1CEE1CFF1CA2 |
:103A9000F60105911491802F0E941E1C812F9927F9 |
:103AA0000E941E1C82E090E0A0E0B0E0C80ED91E8B |
:103AB000EA1EFB1EC25061F7F694E794D794C794B0 |
:103AC000760139CF853409F036CFE1BC8F2D9927A7 |
:103AD00082BDF89A0894E11CF11C80B50E941E1C5E |
:103AE000C15099F728CF853601F598E7991651F519 |
:103AF00080E090E0A0E0B0E023E0FC0120935700DC |
:103B0000E89507B600FCFDCF80589F4FAF4FBF4FE1 |
:103B10008F3F37E3930730E0A30730E0B30768F344 |
:103B200081E180935700E8950DC0853469F488E100 |
:103B300090E02CE00FB6F894A895809360000FBE3B |
:103B4000209360008DE030C08035E1F38C34D1F3F8 |
:103B5000803711F483E528C0843729F488E70E9470 |
:103B60001E1C80E021C0843521F40E94261C982E62 |
:103B7000E9CF8B3109F4DDCE8A3A09F4DACE863505 |
:103B800029F480E30E941E1C82E30EC0833741F4B7 |
:103B900086E00E941E1C84E90E941E1C8EE104C067 |
:0E3BA0008B3109F4C8CE8FE30E941E1CC4CEE8 |
:0400000300003800C1 |
:00000001FF |
/tags/V0.22c/Hex-Files/MK3Mag_MEGA168_V0_22c_SVN62.hex |
---|
0,0 → 1,804 |
:100000000C94B8010C94D3010C94D3010C94D3013B |
:100010000C94D3010C94D3010C94D3010C94D30110 |
:100020000C94D3010C94D3010C94D3010C94D30100 |
:100030000C94D3010C94D3010C94D3010C94D301F0 |
:100040000C94B30E0C94D3010C944F0A0C94D3016E |
:100050000C94160A0C94D3010C94D3010C94D30184 |
:100060000C94C10F0C94D30107BAA57A2C3BDA90FB |
:10007000C5BC8BFC663CFD10F8BD4D83923DB63A85 |
:100080009EBE5BBFCA3FC90FDA000829573F9F2DAC |
:1000900049CBA5310F76C73493F27E37D00D013AA4 |
:1000A000B60B613D2AAAAB3F0000003F8000000074 |
:1000B000083B3BD74ABC846E023D2FC1FEBD9A313E |
:1000C000743DDA3D83BE117FC73E4CBBE5BEAAAA94 |
:1000D0006C3F800000004D61676E657420582020E1 |
:1000E0002020202020204D61676E6574205920203B |
:1000F0002020202020204D61676E6574205A20202A |
:100100002020202020205261774D61676E65742089 |
:100110005820202020205261774D61676E65742041 |
:100120005920202020205261774D61676E65742030 |
:100130005A20202020204174746974756465204E13 |
:1001400069636B2020204174746974756465205262 |
:100150006F6C6C2020204D61676E65742058204FB5 |
:100160006666736574204D61676E65742058205211 |
:10017000616E676520204D61676E65742059204F60 |
:100180006666736574204D61676E657420592052F0 |
:10019000616E676520204D61676E6574205A204F3F |
:1001A0006666736574204D61676E6574205A2052CF |
:1001B000616E6765202043616C73746174652020F3 |
:1001C00020202020202048656164696E672020205F |
:1001D00020202020202055736572302020202020F0 |
:1001E00020202020202055736572312020202020DF |
:1001F0002020202020204163632058202020202020 |
:10020000202020202020416363205920202020200E |
:10021000202020202020416363205A2020202020FD |
:100220002020202020205261774163632058202025 |
:100230002020202020205261774163632059202014 |
:10024000202020202020526177416363205A202003 |
:100250002020202020204163632058204F666673B1 |
:100260006574202020204163632059204F66667307 |
:10027000657420202020416363205A204F666673F6 |
:1002800065742020202048656164696E67205820CD |
:1002900020202020202048656164696E6720592055 |
:1002A00020202020202041747469747564652053D7 |
:1002B0006F7572636520493243204572726F7220F8 |
:1002C000202020202020493243204F6B61792020BC |
:1002D0002020202020205B25695D005B25695D00D2 |
:1002E0002B2B2020204D4B334D41472020202B2B02 |
:1002F000200020562025642E2564256300204143DC |
:100300004320537570706F727420200020202020CD |
:100310002020202020202020200028632920427532 |
:1003200073732C204275736B6572202020004D6121 |
:10033000676E65742053656E736F72733A20005850 |
:100340003A252B3464202020202020202020005912 |
:100350003A252B3464202020202020202020005A01 |
:100360003A252B346420202020202020202000004B |
:1003700011241FBECFEFD4E0DEBFCDBF11E0A0E05F |
:10038000B1E0E8E4F1E302C005900D92AE3DB107A3 |
:10039000D9F713E0AEEDB1E001C01D92AB35B10766 |
:1003A000E1F70C94F9070C9400000F931F93CF937F |
:1003B000DF9340915002509151028091310290910F |
:1003C0003202481B590B5093590240935802C09176 |
:1003D0003502D091360280912F0290913002C81BD5 |
:1003E000D90BD0933402C093330200915402109180 |
:1003F00055028091560290915702081B190B1093D9 |
:100400005302009352022091370230913802211595 |
:10041000310509F4B1C08091390290913A02481B2C |
:10042000590BCA01AA2797FDA095BA2F5AE0880F49 |
:10043000991FAA1FBB1F5A95D1F7442737FD409536 |
:10044000542FBC01CD010E946B183093F30120930F |
:10045000F20120913B0230913C022115310509F453 |
:1004600082C080913D0290913E02C81BD90BCE0103 |
:10047000AA2797FDA095BA2F4AE0880F991FAA1FB7 |
:10048000BB1F4A95D1F7442737FD4095542FBC0137 |
:10049000CD010E946B183093F1012093F0018091FF |
:1004A000410290914202081B190BC801AA2797FD2F |
:1004B000A095BA2F2AE0880F991FAA1FBB1F2A9563 |
:1004C000D1F720913F0230914002442737FD4095FB |
:1004D000542FBC01CD010E946B183093EF01209383 |
:1004E000EE0180912102882309F4CCC0C091EC0177 |
:1004F000D091ED018091450290914602C81BD90B25 |
:10050000D093E701C093E6014091EA015091EB01DD |
:100510008091490290914A02481B590B5093E50182 |
:100520004093E40180914D0290914E022091E801A8 |
:100530003091E901821B930B9093E3018093E201D8 |
:1005400049385105F4F080E293E09093E101809303 |
:10055000E001C938D1051CF180E293E09093DF01FE |
:100560008093DE018FC03093F1012093F00130932E |
:10057000EF012093EE01B5CF3093F3012093F20108 |
:1005800068CF8FEF483758070CF046C080EE9CEFDD |
:100590009093E1018093E001C938D105ECF68FEF2B |
:1005A000C837D8071CF480EE9CEFD8CFCE01AA271D |
:1005B00097FDA095BA2FBC01CD010E946816DC0101 |
:1005C000CB0120E030E04AE053E4BC01CD010E94C1 |
:1005D0000516DC01CB01BC01CD010E949215DC01A6 |
:1005E000CB0120E030E041EE54E4BC01CD010E949B |
:1005F0005417DC01CB012BED3FE049E450E4BC0192 |
:10060000CD010E940516DC01CB01BC01CD010E9489 |
:100610004B16DC01CB01A2CFCA01AA2797FDA095FA |
:10062000BA2FBC01CD010E946816DC01CB0120E08D |
:1006300030E04AE053E4BC01CD010E940516DC0124 |
:10064000CB01BC01CD010E949215DC01CB0120E061 |
:1006500030E041EE54E4BC01CD010E945417DC01AE |
:10066000CB012BED3FE049E450E4BC01CD010E94F9 |
:100670000516DC01CB01BC01CD010E944B16DC014B |
:10068000CB0163CFDF91CF911F910F9108952F92EE |
:100690003F924F925F926F927F928F929F92AF9212 |
:1006A000BF92CF92DF92EF92FF920F931F93CF935F |
:1006B000DF93CDB7DEB724970FB6F894DEBF0FBE39 |
:1006C000CDBF0F2EF0E02F2EF0E03F2EF0E04F2EAA |
:1006D000F0E05F2EF02D8201710129823A824B8277 |
:1006E0005C828091F4019091F5010E941A0F882399 |
:1006F00089F080914F02813009F456C18BB190E8A6 |
:1007000089278BB986E990E00E94110F9093F5013B |
:100710008093F40180914F028130A9F02FEF3FEFD9 |
:10072000F894C90188599E4F815D924028F4309316 |
:1007300001012093000160C18FEF9FEF90930101B1 |
:100740008093000159C1809102019927009709F017 |
:1007500005C18091F2019091F301AA2797FDA09520 |
:10076000BA2FBC01CD010E9468167B018C018091DB |
:10077000F0019091F101AA2797FDA095BA2FBC0135 |
:10078000CD010E9468161B012C018091EE01909111 |
:10079000EF01AA2797FDA095BA2FBC01CD010E94B9 |
:1007A000681669837A838B839C83809103019927E0 |
:1007B0008130910509F4FAC0823091050CF40EC124 |
:1007C000029709F402C188249924C401AA2797FD3D |
:1007D000A095BA2FBC01CD010E946816DC01CB01A7 |
:1007E0002BED3FE049E450E4BC01CD010E945417D9 |
:1007F000DC01CB0120E030E041EE54E4BC01CD014E |
:100800000E9405165B016C01C401AA2797FDA09503 |
:10081000BA2FBC01CD010E946816DC01CB012BED83 |
:100820003FE049E450E4BC01CD010E945417DC01D3 |
:10083000CB0120E030E041EE54E4BC01CD010E9448 |
:1008400005163B014C01C601B5010E94FF15DC01F4 |
:10085000CB01A8019701BC01CD010E9454177B0177 |
:100860008C01C601B5010E949C17DC01CB012981D6 |
:100870003A814B815C81BC01CD010E945417DC019F |
:10088000CB019C01AD01C801B7010E944F155B016E |
:100890006C01C401B3010E94FF15DC01CB01A20170 |
:1008A0009101BC01CD010E9454177B018C01C40150 |
:1008B000B3010E949C17DC01CB0129813A814B8155 |
:1008C0005C81BC01CD010E945417DC01CB019C016D |
:1008D000AD01C801B7010E9450157B018C01C60112 |
:1008E000B5010E944B16DC01CB019093CE028093A0 |
:1008F000CD02C801B7010E944B16DC01CB019093D9 |
:10090000D0028093CF02A6019501C801B7010E94D1 |
:10091000CC15DC01CB0120E030E044E353E4BC0122 |
:10092000CD010E945417DC01CB012BED3FE049E4DF |
:1009300050E4BC01CD010E940516DC01CB01BC01D5 |
:10094000CD010E944B16DC01CB019C0197FD39C003 |
:1009500088E691E0821B930B9C01E2CE019709F09F |
:1009600024CF8091F0019091F101AA2797FDA095E5 |
:10097000BA2FBC01CD010E9468167B018C018091C9 |
:10098000F2019091F301AA2797FDA095BA2FBC011F |
:10099000CD010E946816DC01CB011C012D0157FA24 |
:1009A000509457F85094F1CE5F9AACCEF894809161 |
:1009B0008D0290918E0280908F0290909002789498 |
:1009C00005CF309521953F4FABCE8091E0019091BE |
:1009D000E1018090DE019090DF01F8CE892B09F0D3 |
:1009E000F2CEF894809140039091410380904203AD |
:1009F000909043037894EACE789424960FB6F894B6 |
:100A0000DEBF0FBECDBFDF91CF911F910F91FF9041 |
:100A1000EF90DF90CF90BF90AF909F908F907F909E |
:100A20006F905F904F903F902F9008951F93CF93BA |
:100A3000DF9380913D03882309F44FC0182F1630AF |
:100A400008F450C010E080910402882309F481C0AA |
:100A50005F9AC0E0D0E0C330D10509F477C0C4305C |
:100A6000D1050CF078C0C130D10509F4FBC0229744 |
:100A700009F05DC120915802309159028091F7012F |
:100A80009091F801281739070CF428C18091F901D9 |
:100A90009091FA018217930724F43093FA0120937E |
:100AA000F90120913302309134028091FB01909141 |
:100AB000FC012817390724F43093FC012093FB0133 |
:100AC0008091FD019091FE01821793070CF0C6C042 |
:100AD0003093FE012093FD01C1C0109193021630A6 |
:100AE00008F0B0CF112309F4AECF8091F4019091BA |
:100AF000F5010E941A0F882329F48091F601181736 |
:100B000009F4F9C04091030240FFE1C08091040262 |
:100B1000882309F0E1C05F98842F99270196C12F9F |
:100B2000DD279E012C0F3D1F821793070CF4DDC0BB |
:100B3000109203028CED95E00E94110F9093F50145 |
:100B40008093F401C330D10509F089CF10920402DB |
:100B5000EEC05F987ECFC430D10509F465C02597FB |
:100B600009F0E5C08091F601181781F3E7E3F2E0A0 |
:100B70002091F9013091FA018091F7019091F801EB |
:100B8000D901A81BB90BB0933802A0933702820F8A |
:100B9000931F97FDA8C09595879590933A028093EF |
:100BA00039022091FD013091FE018091FB0190916D |
:100BB000FC01B901681B790B70933C0260933B0206 |
:100BC000820F931F97FD9CC09595879590933E0249 |
:100BD00080933D0220910102309102028091FF0139 |
:100BE00090910002A901481B590B50934002409379 |
:100BF0003F02820F931F97FD81C095958795909333 |
:100C0000420280934102A739B1053CF06739710572 |
:100C100024F0473951050CF075C0A0E0B0E089E13F |
:100C2000182E0E94861892CF2091520230915302C2 |
:100C30008091FF01909100022817390724F4309326 |
:100C400000022093FF01809101029091020282171D |
:100C5000930724F4309302022093010281E08093F1 |
:100C6000040265C020E137E23093F8012093F701D8 |
:100C700080EF98ED9093FA018093F9013093FC0195 |
:100C80002093FB019093FE018093FD0130930002BD |
:100C90002093FF0190930202809301028091EC0166 |
:100CA0009091ED0190934602809345028091EA0174 |
:100CB0009091EB0190934A02809349028091E80160 |
:100CC0009091E90190934E0280934D023FCF809125 |
:100CD0000402882309F01FCF5F9A1ECF3093F801DA |
:100CE0002093F701D3CE019656CF4F5F4093030276 |
:100CF00084E690E021CFC12FDD27ADCE01967DCFD8 |
:100D0000019662CF81E080934F025F98A0E0B0E04F |
:100D100089E1182E0E948B1880ED97E00E94110F38 |
:100D20009093F5018093F401109203020FCF10937A |
:100D3000F601DF91CF911F9108958091F20190917A |
:100D4000F30190939802809397028091F001909123 |
:100D5000F10190939A02809399028091EE01909113 |
:100D6000EF0190939C0280939B0280915802909196 |
:100D7000590290939E0280939D028091330290913C |
:100D800034029093A00280939F028091520290912E |
:100D900053029093A2028093A10220910301822F1B |
:100DA00099278130910509F43EC0823091050CF4F9 |
:100DB00058C0029709F448C08091390290913A02D4 |
:100DC0009093A8028093A7028091370290913802F5 |
:100DD0009093AA028093A90280913D0290913E02D5 |
:100DE0009093AC028093AB0280913B0290913C02C5 |
:100DF0009093AE028093AD028091410290914202A5 |
:100E00009093B0028093AF0280913F029091400294 |
:100E10009093B2028093B10280913D03882389F5BB |
:100E2000809193022EC080918D0290918E029093BA |
:100E3000A4028093A30280918F02909190029093DC |
:100E4000A6028093A502B8CF8091E0019091E101C4 |
:100E50009093A4028093A3028091DE019091DF0120 |
:100E6000EECF892B09F0A8CF8091400390914103E8 |
:100E70009093A4028093A302809142039091430334 |
:100E8000DECF99279093B4028093B3028091000142 |
:100E9000909101019093B6028093B50280919102E6 |
:100EA00099279093B8028093B70280919202992774 |
:100EB0009093BA028093B9028091E6019091E70184 |
:100EC0009093BC028093BB028091E4019091E50174 |
:100ED0009093BE028093BD028091E2019091E30164 |
:100EE0009093C0028093BF028091EC019091ED013C |
:100EF0009093C2028093C1028091EA019091EB012C |
:100F00009093C4028093C3028091E8019091E9011B |
:100F10009093C6028093C50280914502909146024B |
:100F20009093C8028093C7028091490290914A022F |
:100F30009093CA028093C90280914D0290914E0213 |
:100F40009093CC028093CB02822F99279093D20268 |
:100F50008093D102089580912102882369F4109230 |
:100F6000ED011092EC011092EB011092EA01109247 |
:100F7000E9011092E801089582E00E94320F209169 |
:100F8000EC013091ED01280F391F37FD29C035954F |
:100F900027953093ED012093EC0183E00E94320FFE |
:100FA0002091EA013091EB01280F391F37FD1EC057 |
:100FB000359527953093EB012093EA0186E00E9456 |
:100FC000320F2091E8013091E901280F391F37FDD8 |
:100FD0000AC0359527953093E9012093E8010895DB |
:100FE0002F5F3F4FD4CF2F5F3F4FF3CF2F5F3F4F48 |
:100FF000DFCFCFEFD4E0DEBFCDBF3E98469A0E9450 |
:1010000024110E949D0E0E9450090E94470F0E94C9 |
:10101000830F789484E091E00E94810E83E591E053 |
:101020000E94810E80912102882309F01DC15F9AE0 |
:1010300088EC90E00E94110F9093F5018093F401E9 |
:10104000E7E3F2E0A0E0B0E089E1182E0E94861804 |
:101050001092930210923D0380E090E00E94110FE5 |
:10106000909307028093060280910502C82FDD2726 |
:10107000C130D10531F1C230D1050CF45BC0C230B2 |
:10108000D10509F472C0239709F486C080E090E08E |
:101090000E94110F9093070280930602109205029E |
:1010A0000E94650C80910A0290910B02892BE9F550 |
:1010B0000E940A0A80910502C82FDD27C130D105A0 |
:1010C000D1F680910602909107020E941A0F8823A0 |
:1010D00039F380E00E94320F9093510280935002C6 |
:1010E00081E00E94320F909581959F4F9093550219 |
:1010F0008093540287E00E94320F909336028093CF |
:1011000035020E94AB07CE010E94110F9093070297 |
:101110008093060282E0809305020E94650C809114 |
:101120000A0290910B02892B19F20E94020A0E9476 |
:10113000280D9ACFCD2B09F0A9CF8091060290916E |
:1011400007020E941A0F882309F4AACF8BB18F7966 |
:101150008BB982E090E00E94110F90930702809378 |
:10116000060281E080930502D8CF8091060290911B |
:1011700007020E941A0F882309F492CF8BB1806670 |
:101180008BB9CE010E94110F909307028093060243 |
:1011900083E080930502C1CF8091060290910702FF |
:1011A0000E941A0F882309F47BCF80E00E94320F3F |
:1011B000909332028093310281E00E94320F909529 |
:1011C00081959F4F909357028093560287E00E942B |
:1011D000320F9093300280932F020E94AB0781E080 |
:1011E00090E00E94110F90930702809306021092E4 |
:1011F00005020E94D50180919302882321F48091F9 |
:101200003D03882371F10E94160540912202442378 |
:1012100019F04150409322022091080230910902B6 |
:101220002115310531F021503040309309022093CF |
:10123000080280910A0290910B02009729F0019711 |
:1012400090930B0280930A02232B09F029CF4423A9 |
:1012500009F026CF82E08093030181E080930201B0 |
:101260001FCF0E944703D1CF8BE791E00E94810EF0 |
:10127000DECECF93C82F8091C10083FF0DC0CA304E |
:1012800039F08091C00085FFFCCFC093C60004C038 |
:101290008DE00E943909F5CF80E090E0CF9108956C |
:1012A0001F93CF93CFB720E130E0F8948091C10035 |
:1012B0008F778093C1008091C1008F7B8093C100A4 |
:1012C00050985898519A5998832F99278093C50020 |
:1012D0002093C4008091C00082608093C000809100 |
:1012E000C2008F778093C2008091C2008F7B809371 |
:1012F000C2008091C2008F7D8093C2008091C200A5 |
:101300008F7E8093C2008091C200877F8093C2004D |
:101310008091C1008B7F8093C1008091C200846066 |
:101320008093C2008091C20082608093C20080914D |
:10133000C10080618093C1008091C100886080936A |
:10134000C1008091C00087FF0CC08091C6008091D1 |
:10135000C000882334F48091C6008091C0008823A7 |
:10136000A4F38091C10080688093C1008091C10086 |
:1013700080648093C10080918A0190918B010E94CA |
:10138000110F90933C0380933B0310921402109230 |
:101390001202109211021092100281E080938C01CF |
:1013A0001092780286E18093790282E080937C0239 |
:1013B0001AE010937A0210927B02812F0E94390961 |
:1013C00083E40E94390980E50E9439098AE30E947A |
:1013D000390986E50E94390980E30E9439098EE2C5 |
:1013E0000E94390982E30E94390982E30E94390987 |
:1013F00083E60E943909812F0E943909CFBFCF911E |
:101400001F910895519A59988091C10088608093E6 |
:10141000C100089580918C018823E1F38091C1007F |
:10142000877F8093C1005198599808951F920F9219 |
:101430000FB60F9211248F939F93EF93FF93809198 |
:101440008C018823A9F480911502909116020196CF |
:10145000FC01E952FD4FE081ED3079F084369105D1 |
:1014600061F09093160280931502E093C6000EC0BF |
:10147000109216021092150209C0109216021092D4 |
:10148000150281E080938C01E093C600FF91EF91FB |
:101490009F918F910F900FBE0F901F9018951F92E4 |
:1014A0000F920FB60F9211242F933F934F935F9398 |
:1014B0008F939F93AF93BF93CF93DF93EF93FF935C |
:1014C0005091C60080911402882309F073C04091A6 |
:1014D00019024423B9F45332E1F05D3011F1E42FE5 |
:1014E000FF27E65AFD4F50834F5F409319028091CA |
:1014F000170290911802850F911D90931802809306 |
:10150000170258C04E3148F3809319028093140299 |
:1015100051C050935A0281E08093190283E290E017 |
:10152000ECCFA42FBB27A65ABD4FFD013297808177 |
:101530002091170230911802281B3109ED012197E3 |
:101540008881281B3109C9019F70909318028093EC |
:1015500017020024880F991F001C880F991F001C78 |
:10156000892F902D982F935C2F733070235C80818E |
:10157000891729F010921402109219021BC0888159 |
:101580008217C1F75C934F5F4093130281E0809311 |
:10159000140280915C02823579F788E190E02CE0BA |
:1015A0000FB6F894A895809360000FBE209360005A |
:1015B00010921902FF91EF91DF91CF91BF91AF91FE |
:1015C0009F918F915F914F913F912F910F900FBEFF |
:1015D0000F901F901895AC01A0E0B0E09D01A817F6 |
:1015E000B90748F4E7EDF2E08191280F311D11961B |
:1015F000A417B507C8F33F70FD01E952FD4FC901BB |
:101600000024880F991F001C880F991F001C892F28 |
:10161000902D835C80831196FD01E952FD4F2F735D |
:101620003070822F835C8083A852BD4F8DE08C93F5 |
:1016300010928C018091D7028093C6000895BF92CA |
:10164000CF92DF92EF92FF920F931F93CF93DF938E |
:10165000CDB7DEB72C859D857E85BB2483E2809344 |
:10166000D7029F599093D8022093D90203E010E04B |
:10167000772309F4ADC0CF84D88843E1E42EF12C60 |
:10168000EC0EFD1EA989BA897150109709F4A0C00B |
:10169000109709F43CC0F601EB0DF11DB394908155 |
:1016A000119789F47723A1F1F70122E030E0E20EEF |
:1016B000F31ED701C080D180E20EF31E0D90BC91C5 |
:1016C000A02DBB247150109719F1F601EB0DF11DFF |
:1016D000B3944081119709F466C01097D1F0F601D8 |
:1016E000EB0DF11DB39460811197A1F4772391F074 |
:1016F000F7013296D701CD90DC9032E0E32EF12C49 |
:10170000EE0EFF1EA081B181BB24715003C090E09A |
:1017100040E060E0F801E952FD4F892F86958695FB |
:10172000835C80830F5F1F4FF801E952FD4F892FC3 |
:1017300099278370907082959295907F9827807FEB |
:10174000982755279A01329522952F7023273F70AD |
:101750002327822B835C80830F5F1F4FF801E952A0 |
:10176000FD4F4F705070440F551F440F551F862F6B |
:1017700099270024880F991F001C880F991F001CAF |
:10178000892F902D842B835C80830F5F1F4FF8017E |
:10179000E952FD4F6F73635C60830F5F1F4F1097BB |
:1017A00009F076CF15C0772309F4B3CFF701A2E093 |
:1017B000B0E0EA0EFB1ED701C080D18022E030E00D |
:1017C000E20EF31E0D90BC91A02DBB24715085CF6D |
:1017D000C8010E94EB0ADF91CF911F910F91FF90FA |
:1017E000EF90DF90CF90BF900895A3E07A2F4091C3 |
:1017F0001302465009F45FC0E72FFF27E65AFD4F5A |
:1018000080818D537F5FE72FFF27E65AFD4F2081B0 |
:101810002D537F5FE72FFF27E65AFD4F30813D5361 |
:101820007F5FE72FFF27E65AFD4F60816D537F5F93 |
:101830009927880F991F880F991F522F52955F7013 |
:10184000582B822F99278F70907082959295907F58 |
:101850009827807F9827232F26952695282B832F3E |
:101860009927837090700024969587950794969594 |
:1018700087950794982F802D682B41504F3FD9F0C2 |
:10188000EA2FFF27E65AFD4F5083AF5F41504F3F8D |
:1018900091F0EA2FFF27E65AFD4F2083AF5F4150BA |
:1018A0004F3F49F0EA2FFF27E65AFD4F6083AF5FB5 |
:1018B000442309F0A1CF8DE592E09093120280932A |
:1018C0001102A350A093100208958091140288235E |
:1018D00009F408950E94F50B80915B02843609F4A7 |
:1018E00046C080915C0299278436910559F185366E |
:1018F00091058CF48136910509F47FC082369105FB |
:1019000009F488C010921202109211021092100273 |
:101910001092140208958836910509F45AC0893648 |
:1019200091050CF04CC08736910561F780910F024C |
:10193000806180930F0280ED97E090930B0280937B |
:101940000A02E0CFE0911102F091120290818AE048 |
:10195000989FC001112490938B0180938A01892B59 |
:1019600051F380910F02826080930F02E4CF809147 |
:101970005C0299278B36910521F08737910509F094 |
:10198000B0CFA0911102B091120288E0EDE8F2E030 |
:101990000D9001928A95E1F780910F028860809303 |
:1019A0000F0281E0809303018091940280930201F1 |
:1019B0008FEF90E0909309028093080292CF8637D0 |
:1019C000910509F09FCF80910F02816080930F02F3 |
:1019D000B2CFE0911102F0911202808190912D021C |
:1019E000892B80932D02882311F010920C02809194 |
:1019F0000F02806280930F029ECFE0911102F0915E |
:101A00001202808180930E0280910F028460809385 |
:101A10000F0291CFA0911102B09112028BE0E2E887 |
:101A2000F2E00D9001928A95E1F78091840281FFA6 |
:101A300007C0809193028F5F863039F080939302C4 |
:101A400080918B0280930D0276CF10929302F8CF93 |
:101A5000CF93DF93CDB7DEB760970FB6F894DEBFB4 |
:101A60000FBECDBF8091C10083FF42C180918C0128 |
:101A7000882309F43DC120910F0222FD53C08091BB |
:101A80000D02882329F080918C01882309F0C4C0BD |
:101A900080918A0190918B01892B09F084C021FFEC |
:101AA00007C080918C01882309F0C9C020910F02E2 |
:101AB00025FF05C080918C01882309F0E0C024FF38 |
:101AC00005C080918C01882309F079C023FF05C0EF |
:101AD00080918C01882309F086C020FF09C1809184 |
:101AE0008C01882309F404C18AE090E09F938F93CE |
:101AF00088E792E09F938F9381E08F9383E08F93A9 |
:101B000086E58F930E941F0B80910F028E7F80933A |
:101B10000F028DB79EB707960FB6F8949EBF0FBE03 |
:101B20008DBFE6C080918C01882309F4A8CF8091F5 |
:101B30000E02992782959295907F9827807F98270B |
:101B40008A529F4F40E150E0BC01CE0101960E94B5 |
:101B5000351580E190E09F938F93CE0101969F937E |
:101B60008F9381E090E09F938F938EE092E09F931C |
:101B70008F9382E08F9383E08F9381E48F930E9411 |
:101B80001F0B8FEF80930E0280910F028B7F80934B |
:101B90000F022DB73EB7255F3F4F0FB6F8943EBFFB |
:101BA0000FBE2DBFA5C080913B0390913C030E94C6 |
:101BB0001A0F882309F075CF20910F0270CF8BE0A8 |
:101BC00090E09F938F9382E892E09F938F9381E0C0 |
:101BD0008F9383E08F9387E48F930E941F0B8091F4 |
:101BE0000F028F7E94CF82E090E09F938F9380E0EE |
:101BF00091E09F938F9381E08F938F938BE48F93EA |
:101C00000E941F0B80910F02877F80930F022DB7D8 |
:101C10003EB7295F3F4FC1CF81E090E09F938F9304 |
:101C20008DE092E09F938F9381E08F9383E08F9379 |
:101C300082E48F930E941F0B10920D026ACF0E94C4 |
:101C40009D0682E490E09F938F9385E992E09F93B5 |
:101C50008F9381E08F9383E08F9384E48F930E942E |
:101C60001F0B80918A0190918B010E94110F90931C |
:101C70003C0380933B0380910F028D7FC6CF0E946F |
:101C8000301184E190E09F938F9390910C0284E156 |
:101C9000989FC001112483579E4F9F938F9381E09B |
:101CA00090E09F938F938CE092E09F938F9382E0DC |
:101CB0008F9381E08F9388E48F930E941F0B809114 |
:101CC0000C028F5F2DB73EB7255F3F4F0FB6F894DC |
:101CD0003EBF0FBE2DBF843040F010920C028091A9 |
:101CE0000F028F7D80930F0203C080930C02F7CF09 |
:101CF00060960FB6F894DEBF0FBECDBFDF91CF91D7 |
:101D000008951F93CF93DF93EC0110E0888188231F |
:101D100081F0A0E0B0E0AC0FBD1F1F5F8C910E946E |
:101D20003909A12FBB27FE01EA0FFB1F8081882301 |
:101D300091F7DF91CF911F910895229A2A9884B547 |
:101D40008C7084BD85B5837385BD82E085BD16BC6E |
:101D500080916E00897F80936E0080916E0081601B |
:101D600080936E0008951F920F920FB60F92112468 |
:101D70002F933F934F938F939F9386B5855686BD40 |
:101D8000209100013091010137FD3FC080911F0279 |
:101D900090912002019641E08C37940728F12A9A0D |
:101DA0001092200210921F0280911E02815051F564 |
:101DB0008AE080931E0280911C0290911D02019680 |
:101DC00090931D0280931C0280911A0290911B0235 |
:101DD000892BE9F080911A0290911B020197909350 |
:101DE0001B0280931A0213C09093200280931F025B |
:101DF000265F3F4F82179307B8F22A9880911E0200 |
:101E00008150B1F280931E0202C02A98C9CF9F91DF |
:101E10008F914F913F912F910F900FBE0F901F9078 |
:101E2000189520911C0230911D02280F391FC901FD |
:101E30000197089520911C0230911D02821B930B83 |
:101E4000892F990F990B80780895CF93DF930E9483 |
:101E5000110FEC01CE010E941A0F8823D9F3DF91F4 |
:101E6000CF91089580937C0080917A008061809367 |
:101E70007A0080917A00806480937A0080917A0061 |
:101E800084FFFCCF8091780090917900089587B10C |
:101E9000807F87B988B1807F88B98AB180668AB926 |
:101EA0008BB18F798BB910927C0080917A00877901 |
:101EB00080937A0080917A00876980937A001092EB |
:101EC0007C0080917A00806480937A0088B18C6075 |
:101ED00088B980E29EE40197F1F782E00E94320F18 |
:101EE000895E934020F481E08093210208C083E062 |
:101EF0000E94320F895E9340B0F31092210288B1A4 |
:101F0000837F88B908959FB7F89484B18F7C84B992 |
:101F100085B1806385B987B18F7C87B988B18F7CA3 |
:101F200088B910922802109227021092240210926F |
:101F3000290210922602109225021092230210927A |
:101F40002A028FED8093BC008091BC008564809351 |
:101F5000BC0080E58093BA008091BC00856D8093C1 |
:101F6000BC001092460386E18093470382E0809391 |
:101F7000480383E08093490385EC8093BC009FBFB6 |
:101F800008951F920F920FB60F9211242F933F9333 |
:101F90008F939F93AF93BF93EF93FF938091B9007B |
:101FA0009927887F907080389105A9F08138910534 |
:101FB0004CF0883A910509F44BC0883B9105A1F19A |
:101FC00085EC33C1009709F180369105C9F78FEF91 |
:101FD00080932302F5CF3091BB00209123022F3F45 |
:101FE00009F452C09091230280912A02981778F048 |
:101FF0009091230280912A02981709F481C0809160 |
:1020000023028F5F80932302DBCF85ED0EC1809189 |
:102010002302E82FFF27E65BFC4F308380912B02E1 |
:10202000830F80932B02EBCFE0912702F0912802DF |
:10203000309709F44AC090912402809129029817A0 |
:1020400008F043C080912402E80FF11D30810FC0D9 |
:102050001092240210922B02E0912702F0912802A4 |
:10206000309721F080912902823060F730E0809132 |
:102070002B02830F80932B02809124028F5F809329 |
:1020800024023093BB009CCF832F99278230910587 |
:1020900009F447C0833091050CF18330910509F4B0 |
:1020A00093C0049709F4B1C0109226021092250241 |
:1020B00010922A02109228021092270210922902EE |
:1020C0001092230230932B027BCF909124028091B7 |
:1020D0002902981709F44DC030E0CECF019721F7BF |
:1020E00086E493E0909328028093270284E0809313 |
:1020F0002902109226021092250210922A02E0CFA5 |
:1021000080912B02809580932B028317B1F18091EF |
:10211000D3029091D40201969093D4028093D3027B |
:102120006ECF84E593E0909328028093270286E0A7 |
:1021300080932902109226021092250210922A0200 |
:102140008091F2019091F301909355038093540391 |
:102150008091F0019091F101909357038093560381 |
:102160008091EE019091EF01909359038093580371 |
:10217000A7CF30912B0230957FCFA0912502B0914F |
:1021800026021097B9F030E080912A02381728F023 |
:1021900011C0A0912502B0912602E32FFF27AE0FB8 |
:1021A000BF1FE65BFC4F80818C933F5F80912A02CA |
:1021B000381778F38091D5029091D60201969093CA |
:1021C000D6028093D5021BCF84E493E0909328023B |
:1021D0008093270282E08093290280E493E0909329 |
:1021E00026028093250284E080932A0280910001D8 |
:1021F0009091010190934503809344031092030151 |
:1022000010920201209322025BCF8DE393E0909322 |
:1022100028028093270223E020932902909326022C |
:102220008093250220932A024BCF8093BC00FF911C |
:10223000EF91BF91AF919F918F913F912F910F900F |
:102240000FBE0F901F901895579A5F98089590E2CF |
:10225000EDE8F1E08FE49193815087FFFCCF089582 |
:102260001F93CF93DF9320912D0220FF08C0809110 |
:102270002E02882309F44FC0815080932E0221FF43 |
:102280000AC090912E028091DD01981709F49AC03E |
:102290009F5F90932E02822F992780FF02C081FDBD |
:1022A0003FC00E94271190912E028091DD01891775 |
:1022B00018F480932E02982F9A3018F581E18093BC |
:1022C0002C02892F99279F938F9386ED92E09F93FD |
:1022D0008F9381E08F930E94A0120F900F900F9028 |
:1022E0000F900F9090912E02C92FDD272097D9F0E3 |
:1022F000219709F46AC091509093DD0110922E024B |
:10230000B0C080E180932C02892F99279F938F93EF |
:102310008BED92E0DCCF8091DD0180932E02AFCF78 |
:1023200010922E02BECF10922C0280EE92E09F936C |
:102330008F9311E01F930E94A01284E180932C02DE |
:102340000F900F900F9083E690E09F938F9386E11C |
:1023500090E09F938F93DF93CF9382EF92E09F93D0 |
:102360008F931F930E94A0128DB79EB709960FB648 |
:10237000F8949EBF0FBE8DBF809121028823E1F4A7 |
:1023800088E280932C028CE093E09F938F931F93BD |
:102390000E94A0120F900F900F908CE380932C025C |
:1023A0008AE193E09F938F9381E08F930E94A01224 |
:1023B0000F900F900F9055C088E280932C028DEF04 |
:1023C00092E0E3CF10922E0266CF10922C028EE2A2 |
:1023D00093E09F938F9311E01F930E94A01284E1DA |
:1023E00080932C020F900F900F908091F2019091AA |
:1023F000F3019F938F938FE393E09F938F931F93AA |
:102400000E94A01288E280932C020F900F900F90F0 |
:102410000F900F908091F0019091F1019F938F9315 |
:102420008FE493E09F938F931F930E94A0128CE3FD |
:1024300080932C020F900F900F900F900F9080912F |
:10244000EE019091EF019F938F938FE593E09F931F |
:102450008F931F930E94A0120F900F900F900F90D8 |
:102460000F9010922D02DF91CF911F910895982F18 |
:1024700080915A03813031F0892F0E943909282F29 |
:1024800033270CC080912C02E82FFF27E357FE4F23 |
:1024900090838F5F80932C0221E030E0C901089582 |
:1024A0000F931F93CF93DF938C01EB01672B71F098 |
:1024B000F80181918F010E943712219739F0F801BC |
:1024C00081918F010E943712219791F7DF91CF916F |
:1024D0001F910F9108950F931F93CF93DF938C015A |
:1024E000EB01672B81F0F8010F5F1F4F84910E9471 |
:1024F0003712219741F0F8010F5F1F4F84910E941E |
:102500003712219781F7DF91CF911F910F91089595 |
:10251000CF93C82F181634F480E20E943712C150AE |
:102520001C16D4F3CF910895CF93C82F181634F406 |
:1025300080E30E943712C1501C16D4F3CF91089546 |
:102540002F923F924F925F926F927F928F929F92C3 |
:10255000AF92BF92CF92DF92EF92FF920F931F93B1 |
:10256000CF93DF93CDB7DEB7E0970FB6F894DEBF19 |
:102570000FBECDBF26968FAD26972896EEADFFAD48 |
:10258000289788249924540180935A0348E4C42E40 |
:10259000D12CCC0EDD1E7F01C701F7011491112350 |
:1025A00031F0153221F00894E11CF11CF6CFB7018F |
:1025B000681B790B09F095C0112309F43DC20894FA |
:1025C000E11CF11C1FA63FA4232C0FEF39A6F70135 |
:1025D0000894E11CF11C14911537C9F1812F806218 |
:1025E0008837A9F1103209F440C0133209F48DC0C4 |
:1025F0001A3209F479C01D3209F476C01B32C9F1D0 |
:102600001E32C9F1103309F48AC0812F81538930F9 |
:1026100008F07EC060E070E0CB01880F991F880F42 |
:10262000991F880F991F860F971F680F791F610FD9 |
:10263000711D60537040F7010894E11CF11C149166 |
:10264000812F80538A3040F3262E153739F630FE1D |
:102650003DC0F60184E090E0C80ED91E80809180D4 |
:10266000A280B380103209F0C0CF89A5882309F079 |
:10267000AECF19A7ACCFF7010894E11CF11C14915F |
:102680001A3209F451C060E070E014C0CB01880F29 |
:10269000991F880F991F880F991F860F971F680F22 |
:1026A000791F610F711D60537040F7010894E11CA0 |
:1026B000F11C1491812F80538A3040F3EFEF6F3F6C |
:1026C0007E0714F46FEF7FEF062F86CFF60182E0CE |
:1026D00090E0C80ED91E808191814C01AA24BB24B0 |
:1026E00081CF0E946B1268CF1A3251F4F60182E05A |
:1026F00090E0C80ED91E208022200CF068CF2194D3 |
:1027000090E1392AEFED3E2262CF98E0392A5FCF7F |
:102710001836C9F01C36D1F481E0382A58CF34FC81 |
:1027200056CFF0E23F2A53CFF60182E090E0C80E88 |
:10273000D91E608171819FEF6F3F790714F46FEFAD |
:102740007FEF062F44CF24E0322A41CF133609F41D |
:102750004DC1143409F41FC1143609F41CC11936D3 |
:1027600009F419C11F3409F40FC11F3609F40CC153 |
:10277000103709F4F9C0133709F4B2C0153509F45C |
:10278000ECC0153709F4E9C0183509F444C018370E |
:1027900009F441C0112309F44FC1CE0101969DA750 |
:1027A0008CA7198381E0482E19A6632C7724042D69 |
:1027B0005FA4541857FC2DC029A5222331F10F5FC7 |
:1027C000050DC30180739070892B09F42FC122235A |
:1027D00009F027C166FC1BC1C3018073907080970C |
:1027E00009F410C1852D0E949412842D992787FD2C |
:1027F0009095BC018CA59DA50E94501264FECCCE84 |
:10280000822D801B0E948812C7CE66FED9CF0E5F34 |
:10281000D7CF5524D1CFE0E1EEA733FE07C0811416 |
:102820009104A104B10411F0F0E43F2A19A60FA706 |
:1028300007FD02C02FED3222CE0189969DA78CA7FD |
:1028400081149104A104B10419F49FA5992361F1A5 |
:10285000EEA54E2E55246624772418AA84149504D8 |
:10286000A604B70410F0F1E0F8ABC501B401A30170 |
:1028700092010E944918DC01CB01082F8A30F0F444 |
:10288000005DECA5FDA50293FDA7ECA7C501B40171 |
:10289000A30192010E94491849015A01F8A9FF2396 |
:1028A000E1F62EA5283079F0632C7724CE0101962D |
:1028B000482EFCA54F1A28E2420E79CF095A183546 |
:1028C00001F70F7DDECF632C772463FEEFCF00335B |
:1028D00069F380E3ECA5FDA58293FDA7ECA7E6CF05 |
:1028E000F60182E090E0C80ED91E0190F081E02D43 |
:1028F000FDA7ECA7EF2B81F4FE013196FDA7ECA715 |
:1029000088E289838EE6818385E78B838CE68C83DE |
:102910008D8389E28E831F8207FD15C0802F992742 |
:1029200087FD9095AC0160E070E08CA59DA50E94AC |
:102930004215009731F0482EFCA54F1A04150CF0F3 |
:1029400033CF402E31CFECA5FDA501900020E9F753 |
:1029500031974E2E2CA5421A27CF153511F481E060 |
:10296000382A9AE09EA762CFF60182E090E0C80E76 |
:10297000D91E808191814C01AA24BB2490E19EA79D |
:10298000E0E43E2A18E752CF1F3411F4E1E03E2A7A |
:10299000F8E0FEA74BCF143411F491E0392A30FE51 |
:1029A00018C0F60184E090E0C80ED91E80809180A6 |
:1029B000A280B380B7FE0AC0B094A0949094809493 |
:1029C000811C911CA11CB11C8DE289A79AE09EA7D5 |
:1029D0002ECFF60182E090E0C80ED91E8081918151 |
:1029E0004C01AA2497FCA094BA2CE4CFFE013196A6 |
:1029F000FDA7ECA7F60182E090E0C80ED91E808109 |
:102A00008983D0CE822D801B0E949412EBCE80E36E |
:102A10008AA71BA762E070E0CE018A960E9450123E |
:102A2000DBCE61E070E0CE018996F8CF822D801B6D |
:102A30000E94881229A5CBCEE0960FB6F894DEBF8F |
:102A40000FBECDBFDF91CF911F910F91FF90EF90FF |
:102A5000DF90CF90BF90AF909F908F907F906F90BE |
:102A60005F904F903F902F900895FB01DC0140FF55 |
:102A700005C002C005900D9205900D924250504045 |
:102A8000C8F70895FC014150504030F001900616FF |
:102A9000D1F73197CF010895882799270895505885 |
:102AA000192EA4D101D054C1BA1762077307840745 |
:102AB0009507B1F188F40EF410940B2EBA2FA02DC7 |
:102AC000062E622F202D072E732F302D082E842FD7 |
:102AD000402D092E952F502DFF275523B9F0591B56 |
:102AE00049F0573E98F0469537952795A795F040C1 |
:102AF0005395C9F776F0BA0F621F731F841F30F425 |
:102B0000879577956795B795F040939517FA0F2EAF |
:102B10000895BF1BBB27BA0B620B730B840BF6CF58 |
:102B2000DEF690C1AA2797FDA160AF939F775FE380 |
:102B300040E8613071058407950720F00E94C016B7 |
:102B4000AF9108959F938F937F936F93E8E6F0E0A2 |
:102B50000E94C3162F913F914F915F919F938F9346 |
:102B60007F936F939FE380E87727662750680E94E2 |
:102B700050150E94AF172F913F914F915F910E9486 |
:102B800054175FE349EC3FE02BED90680E9450152D |
:102B9000AF91A0FD90680895552319F0992351F045 |
:102BA00018C09923A1F097FB6BED7FE089EC9FE3C0 |
:102BB00097F90895552359F02AF46BED7FE089E4E5 |
:102BC00090E40895662777278827992708950C941D |
:102BD000C0161F93112797FD116057FD12600E94C8 |
:102BE00005160E94F11711FF08C02BED3FE049E4E4 |
:102BF00050E410FD50680E9450151F91089550E454 |
:102C000049EC3FE02BED6ED080C0F0D001D0A0C0E9 |
:102C1000552359F0992369F09F575F57951B33F45B |
:102C200042F4903811F4915805C0AAC091589F3FC2 |
:102C300009F408C1BB27112462177307840730F415 |
:102C4000660F771F881FBB1F915098F311D00F920A |
:102C50000FD00F920DD0A0E82617370748071B06A4 |
:102C600009F0A048BA2F602D7F918F91002408951C |
:102C7000A0E80024621773078407B10528F0621BDF |
:102C8000730B840BB1090A2A660F771F881FBB1FBD |
:102C9000A69581F7089597FBB5D09F3738F0FEE9E8 |
:102CA000F91B982F872F762F6B2F05C0C8C09695DC |
:102CB000879577956795F150D0F73EF4909580957C |
:102CC000709561957F4F8F4F9F4F0895E89403C093 |
:102CD00097FB0EF4F3DFB62F672F782F892F9EE92D |
:102CE000002436C05F77552319F444230AF048C006 |
:102CF0002F933F934F935F9388DF55274427A4D0AA |
:102D00005F914F913F912F91CFC01F939F7750ECD0 |
:102D100049E43FE02BEDC4DE10E89F775FE349EC28 |
:102D20003FE02BED621773078407950720F050EC06 |
:102D300049E4B6DE112751D19068EAE8F0E023D0EB |
:102D400091271F9108959A95BB0F661F771F881FC3 |
:102D500011249923A1F08823B2F79F3F59F0BB0FAC |
:102D600048F421F4002011F460FF04C06F5F7F4F2E |
:102D70008F4F9F4F881F9795879597F908955FC04C |
:102D80009FEF80EC0895FF92EF92DF92CF92BF9277 |
:102D90006B017C01B59016D0B590BB2069F09F9374 |
:102DA0008F937F936F93B601C7010CD02F913F9102 |
:102DB0004F915F910E940516BF90CF90DF90EF90EA |
:102DC000FF9008953DD102C09601A701EF93FF93B4 |
:102DD0000E945417FF91EF9133D1EF93FF930E941C |
:102DE0005015FF91EF91BA9479F70895052E0926B1 |
:102DF00007FA440F551F5F3F79F0AA27A51708F07F |
:102E000051E04795880F991F9F3F31F0BB27B917B5 |
:102E100008F091E0879508959F919F911124B0CF7C |
:102E200097FB880F991F9F3F31F0BB27B91708F018 |
:102E300091E0879508959F919F911124A1CF6627D6 |
:102E40007727882799270895EBDFCF93DF93D52F36 |
:102E5000C42F55274427332722279923D9F09F379A |
:102E6000C8F0F92F75DF592F482F372F262FF63945 |
:102E700068F411DF2DDFC030CD0721F0699379931D |
:102E8000899399939058DF91CF910ACE99278827FB |
:102E900077276627C030CD0721F0299339934993CE |
:102EA0005993DF91CF9154CFA1DF01D051CF992316 |
:102EB00039F0552329F09F575F57950F13F49AF176 |
:102EC000C1CF91589F3FE1F3629FA12D0F92BB2785 |
:102ED000639FA00DB11DEE27729FA00DB11DEE1FC7 |
:102EE000AF93AA27649FB00DE11D739FB00DE11D44 |
:102EF000AA1F6627829FB00DE11DA61F5527749F4C |
:102F0000E00DA11D551F839FE00DA11D561F849F3D |
:102F1000A00D511D852F7A2F6E2F1F900F908823A3 |
:102F20001AF4939539F42CCF000C111CBB1F661FAB |
:102F3000771F881F012808959F939F77993358F032 |
:102F400050E449EC3FE02BEDCDDE5FEB49EC3FE098 |
:102F50002BEDA6DDDADE5F9150789527089597FD79 |
:102F60000FCF992309F40895482F5ADFF92FFF57FF |
:102F7000F5959F1B9F1BFF93EBDEFF92EF92DF9275 |
:102F8000CF92BF92AF929F928F926B017C0140587B |
:102F900047953327222740685FE3B601C7014901FF |
:102FA0005A010E9405169401A5010E9450154FEF89 |
:102FB0005FEF53D09B01AC0182169306A406B506C1 |
:102FC00061F78F909F90AF90BF90CF90DF90EF9080 |
:102FD000FF905F9125DF950FBBCE9B01AC010C9458 |
:102FE00054171F930F930027192F10789F775FE3D3 |
:102FF00040E8613071058407950718F000680E9469 |
:103000002518912B6F937F938F939F930E94ED17B9 |
:10301000E0EBF0E0B8DE5F914F913F912F910E947D |
:103020005417002351F02BED3FE049EC5FE300E83B |
:10303000902717FD50680E9450150F911F91089519 |
:10304000559145913591259108959B01AC019FE3E0 |
:1030500080E8772766270C940516E2DE992359F05D |
:10306000AA27940FA51F43F032F04FEF50E09417BA |
:10307000A50714F46DCEE3CE0EF006C000C09FEF9E |
:1030800080E870E060E008959FE780E870E060E02D |
:103090000895A1E21A2EAA1BBB1BFD010DC0AA1F99 |
:1030A000BB1FEE1FFF1FA217B307E407F50720F0B1 |
:1030B000A21BB30BE40BF50B661F771F881F991F2C |
:1030C0001A9469F760957095809590959B01AC0175 |
:1030D000BD01CF01089597FB092E05260ED057FD9F |
:1030E00004D0D7DF0AD0001C38F4509540953095B5 |
:1030F00021953F4F4F4F5F4F0895F6F7909580957C |
:10310000709561957F4F8F4F9F4F089509D0019221 |
:103110001A94E1F7089501900BD01A94E1F70895FD |
:10312000F999FECFB2BDA1BDF89A119600B40895E9 |
:10313000F999FECFB2BDA1BD00BC11960FB6F894AF |
:08314000FA9AF99A0FBE0895F6 |
:10314800FFFF01020A0D74686520757365206F66BC |
:10315800207468697320736F66747761726520697B |
:1031680073206F6E6C79207065726D697474656414 |
:103178000A0D6F6E206F726967696E616C204D6908 |
:103188006B726F4B6F707465722D486172647761F2 |
:103198007265000A0D7777772E4D696B726F4B6FEA |
:1031A800707465722E6465202863292048695379F4 |
:1031B8007374656D7320476D6248000A0A41434382 |
:1031C8002070726573656E740A00F4010148656CBD |
:1031D8006C6F20576F726C640000000000000000E4 |
:1031E80000000000000000000000000000000000D7 |
:1031F80000000000000000000000000000000000C7 |
:1032080000000000000000000000000000000000B6 |
:0E3218000000000000000000000000000002A6 |
:00000001FF |
/tags/V0.22c/License.txt |
---|
0,0 → 1,59 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
/tags/V0.22c/analog.c |
---|
0,0 → 1,120 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <util/delay.h> |
#include "analog.h" |
uint8_t AccPresent = 0; |
void ADC_Init(void) |
{ |
// The analog inputs have a VREF of 5V and a resolution of 10 bit (0...1024 counts) |
// i.e. 4.88mV/Count |
// set PortC 0,1,2,3 as input |
DDRC &= ~((1<<DDC3)|(1<<DDC2)|(1<<DDC1)|(1<<DDC0)); |
// set PortC 0,1,2,3 as tri state |
PORTC &= ~((1<<PORTC3)|(1<<PORTC2)|(1<<PORTC1)|(1<<PORTC0)); |
// port PD5 and PD6 control the current direction of the test coils of the sensors |
DDRD |= ((1<<DDD5)|(1<<DDD6)); |
FLIP_LOW; |
// disable internal reference voltage and right adjust bits in ADCW |
ADMUX = 0x00; |
// clear start conversion bit (ADSC = 0) |
// disable ADC Auto Trigger Enable (ADATE = 0) |
// disable interrupt (ADIE = 0) |
ADCSRA &= ~((1<<ADSC)|(1<<ADATE)|(1<<ADIE)); |
// Enable ADC (ADEN = 1) with SYSCLK/128 (ADPS2 = 1, ADPS1 = 1, ADPS0 = 1) and clear ready flag (ADIF = 1) |
ADCSRA |= ((1<<ADEN)|(1<<ADIF)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0)); |
ADMUX = 0x00; // select ADC0 |
ADCSRA |= (1<<ADSC); // start conversion |
// Check if acceleration sensor is present |
// The output of the LIS3L02AL (MK3MAG V1.0) and the LIS344ALH (MK3MAG V1.1) is Vdd/5 +/- 10% per 1g. |
// The Vdd is 3.0V at this board therefore the sensitivity is 0.6V/g +/-10% that corresponds to 123 counts. |
// The offsets at 0g is VDD/2 (1.5V) that is 307 counts. |
// that yields to an ADC range of 184 to 430 counts. |
// pullup PC2(AccX) and PC3 (AccY) |
PORTC |= ((1<<PORTC3)|(1<<PORTC2)); |
_delay_ms(10.0); |
// if ADC2 and ADC 3 is larger than 1000 counts (4.88V) no load is at the pins |
if((ADC_GetValue(ADC2) > 1000) && (ADC_GetValue(ADC3) > 1000)) AccPresent = 0; |
else AccPresent = 1; |
// set port back to tristate |
PORTC &= ~((1<<PORTC3)|(1<<PORTC2)); |
} |
uint16_t ADC_GetValue(ADChannel_t channel) |
{ |
uint16_t value = 0; |
ADMUX = channel; // set muxer bits |
ADCSRA |= (1<<ADIF); // clear ready-flag |
ADCSRA |= (1<<ADSC); // start conversion |
while (((ADCSRA & (1<<ADIF)) == 0)); // wait for end of conversion |
value = ADCW; // read adc result |
return(value); |
} |
/tags/V0.22c/analog.h |
---|
0,0 → 1,39 |
#ifndef _ANALOG_H_ |
#define _ANALOG_H_ |
#include <inttypes.h> |
#include <avr/io.h> |
#define FLIP_HIGH PORTD |= ((1<<PORTD5)|(1<<PORTD6)) |
#define FLIP_LOW PORTD &= ~((1<<PORTD5)|(1<<PORTD6)) |
typedef enum |
{ |
ADC0 = 0, |
ADC1 = 1, |
ADC2 = 2, |
ADC3 = 3, |
ADC4 = 4, |
ADC5 = 5, |
ADC6 = 6, |
ADC7 = 7, |
REF1V1 = 14, |
AGND = 15 |
} ADChannel_t; |
#define MAG_X ADC0 |
#define MAG_Y ADC1 |
#define MAG_Z ADC7 |
#define ACC_X ADC2 |
#define ACC_Y ADC3 |
#define ACC_Z ADC6 |
extern uint8_t AccPresent; |
void ADC_Init(void); |
uint16_t ADC_GetValue(ADChannel_t channel); |
#endif // _ANALOG_H_ |
/tags/V0.22c/led.c |
---|
0,0 → 1,73 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "led.h" |
void LED_Init(void) |
{ |
// Set PD7 as output |
DDRD |= (1<<DDD7); |
// set port pon to GND |
PORTD &= ~((1<<PORTD7)); |
} |
/tags/V0.22c/led.h |
---|
0,0 → 1,12 |
#ifndef _LED_H_ |
#define _LED_H_ |
#include <avr/io.h> |
#define LED_GRN_ON PORTD |= (1<<PORTD7) |
#define LED_GRN_OFF PORTD &= ~(1<<PORTD7) |
#define LED_GRN_TOGGLE PORTD ^= (1<<PORTD7) |
void LED_Init(void); |
#endif //_LED_H_ |
/tags/V0.22c/main.c |
---|
0,0 → 1,534 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <avr/interrupt.h> |
#include <math.h> |
#include <stdlib.h> |
#include <stdio.h> |
#include "main.h" |
#include "timer0.h" |
#include "twislave.h" |
#include "led.h" |
#include "analog.h" |
#include "uart.h" |
#define CALIBRATION_VERSION 1 |
AttitudeSource_t AttitudeSource = ATTITUDE_SOURCE_ACC; |
Orientation_t Orientation = ORIENTATION_FC; |
uint16_t Led_Timer = 0; |
typedef struct |
{ |
int16_t Range; |
int16_t Offset; |
} Scaling_t; |
typedef struct |
{ |
Scaling_t MagX; |
Scaling_t MagY; |
Scaling_t MagZ; |
Scaling_t AccX; |
Scaling_t AccY; |
Scaling_t AccZ; |
unsigned char Version; |
} Calibration_t; |
Calibration_t eeCalibration EEMEM; // calibration data in EEProm |
Calibration_t Calibration; // calibration data in RAM |
// magnet sensor variable |
int16_t RawMagnet1a, RawMagnet1b; // raw magnet sensor data |
int16_t RawMagnet2a, RawMagnet2b; |
int16_t RawMagnet3a, RawMagnet3b; |
int16_t UncalMagX, UncalMagY, UncalMagZ; // sensor signal difference without Scaling |
int16_t MagX = 0, MagY = 0, MagZ = 0; // rescaled magnetic field readings |
// acceleration sensor variables |
int16_t RawAccX = 0, RawAccY = 0, RawAccZ = 0; // raw acceleration readings |
int16_t AccX = 0, AccY = 0, AccZ = 0; // rescaled acceleration readings |
int16_t AccAttitudeNick = 0, AccAttitudeRoll = 0; // nick and roll angle from acc |
int16_t Heading = -1; // the current compass heading in deg |
void CalcFields(void) |
{ |
UncalMagX = (RawMagnet1a - RawMagnet1b); |
UncalMagY = (RawMagnet3a - RawMagnet3b); |
UncalMagZ = (RawMagnet2a - RawMagnet2b); |
if(Calibration.MagX.Range != 0) MagX = (1024L * (int32_t)(UncalMagX - Calibration.MagX.Offset)) / (Calibration.MagX.Range); |
else MagX = 0; |
if(Calibration.MagY.Range != 0) MagY = (1024L * (int32_t)(UncalMagY - Calibration.MagY.Offset)) / (Calibration.MagY.Range); |
else MagY = 0; |
if(Calibration.MagY.Range != 0) MagZ = (1024L * (int32_t)(UncalMagZ - Calibration.MagZ.Offset)) / (Calibration.MagZ.Range); |
else MagZ = 0; |
if(AccPresent) |
{ |
AccX = (RawAccX - Calibration.AccX.Offset); |
AccY = (RawAccY - Calibration.AccY.Offset); |
AccZ = (Calibration.AccZ.Offset - RawAccZ); |
#if (BOARD == 10) // the hardware 1.0 has the LIS3L02AL |
// acc mode assumes orientation like FC |
if(AccX > 136) AccAttitudeNick = -800; |
else |
if(AccX < -136) AccAttitudeNick = 800; |
else AccAttitudeNick = (int16_t)(-1800.0 * asin((double) AccX / 138.0) / M_PI); |
if(AccY > 136) AccAttitudeRoll = 800; |
else |
if(AccY < -136) AccAttitudeRoll = -800; |
else AccAttitudeRoll = (int16_t)( 1800.0 * asin((double) AccY / 138.0) / M_PI); |
#else // the hardware 1.1 has the LIS344ALH with a different axis definition (X -> -Y, Y -> X, Z -> Z) |
// acc mode assumes orientation like FC |
if(AccY > 136) AccAttitudeNick = 800; |
else |
if(AccY < -136) AccAttitudeNick = -800; |
else AccAttitudeNick = (int16_t)( 1800.0 * asin((double) AccY / 138.0) / M_PI); |
if(AccX > 136) AccAttitudeRoll = 800; |
else |
if(AccX < -136) AccAttitudeRoll = -800; |
else AccAttitudeRoll = (int16_t)( 1800.0 * asin((double) AccX / 138.0) / M_PI); |
#endif |
} |
} |
void CalcHeading(void) |
{ |
double nick_rad, roll_rad, Cx = 0, Cy = 0, Cz = 0, Hx = 0, Hy = 0; |
int16_t nick, roll; |
int16_t heading = -1; |
// blink code for normal operation |
if(CheckDelay(Led_Timer)) |
{ |
if(Calibration.Version != CALIBRATION_VERSION) LED_GRN_TOGGLE; |
else LED_GRN_ON; |
Led_Timer = SetDelay(150); |
} |
if(Calibration.Version != CALIBRATION_VERSION) heading = -1; // Version of the calibration Data does not match |
else |
{ |
switch(Orientation) |
{ |
case ORIENTATION_NC: |
Cx = (double)MagX; |
Cy = (double)MagY; |
Cz = (double)MagZ; |
break; |
case ORIENTATION_FC: |
// rotation of 90 deg compared to NC setup |
Cx = (double)MagY; |
Cy = -(double)MagX; |
Cz = (double)MagZ; |
break; |
} |
// calculate nick and roll angle in rad |
switch(AttitudeSource) |
{ |
case ATTITUDE_SOURCE_I2C: |
cli(); // stop interrupts |
nick = I2C_WriteAttitude.Nick; |
roll = I2C_WriteAttitude.Roll; |
sei(); // start interrupts |
break; |
case ATTITUDE_SOURCE_UART: |
cli(); // stop interrupts |
nick = ExternData.Attitude[NICK]; |
roll = ExternData.Attitude[ROLL]; |
sei(); // start interrupts |
break; |
case ATTITUDE_SOURCE_ACC: |
nick = AccAttitudeNick; |
roll = AccAttitudeRoll; |
break; |
default: |
nick = 0; |
roll = 0; |
break; |
} |
nick_rad = ((double)nick * M_PI) / 1800.0; |
roll_rad = ((double)roll * M_PI) / 1800.0; |
// calculate attitude correction |
Hx = Cx * cos(nick_rad) - Cz * sin(nick_rad); |
Hy = Cy * cos(roll_rad) + Cz * sin(roll_rad); |
DebugOut.Analog[27] = (int16_t)Hx; |
DebugOut.Analog[28] = (int16_t)Hy; |
// calculate Heading |
heading = (int16_t)((180.0 * atan2(Hy, Hx)) / M_PI); |
// atan2 returns angular range from -180 deg to 180 deg in counter clockwise notation |
// but the compass course is defined in a range from 0 deg to 360 deg clockwise notation. |
if (heading < 0) heading = -heading; |
else heading = 360 - heading; |
} |
// stop interrrupts during heading update to avoid transmitting heading between the update of both bytes of the int16_t |
cli(); // stop interrupts |
if(abs(heading) < 361) Heading = heading; |
else (Heading = -1); |
sei(); // start interrupts |
} |
void Calibrate(void) |
{ |
uint8_t cal; |
static uint8_t calold = 0; |
static int16_t Xmin = 0, Xmax = 0, Ymin = 0, Ymax = 0, Zmin = 0, Zmax = 0; |
static uint8_t blinkcount = 0; |
static uint8_t invert_blinking = 0; |
// check both sources of communication for calibration request |
if(I2C_WriteCal.CalByte) cal = I2C_WriteCal.CalByte; |
else cal = ExternData.CalState; |
if(cal > 5) cal = 0; |
// blink code for current calibration state |
if(cal) |
{ |
if(CheckDelay(Led_Timer) || (cal != calold)) |
{ |
if(blinkcount & 0x01) if(invert_blinking) LED_GRN_ON; else LED_GRN_OFF; |
else if(invert_blinking) LED_GRN_OFF; else LED_GRN_ON; |
// end of blinkcount sequence |
if((blinkcount + 1 ) >= (2 * cal)) |
{ |
blinkcount = 0; |
Led_Timer = SetDelay(1500); |
} |
else |
{ |
blinkcount++; |
Led_Timer = SetDelay(100); |
} |
} |
} |
else |
{ |
if(invert_blinking) LED_GRN_ON; else LED_GRN_OFF; |
} |
// calibration state machine |
switch(cal) |
{ |
case 1: // 1st step of calibration |
// initialize ranges |
// used to change the orientation of the MK3MAG in the horizontal plane |
Xmin = 10000; |
Xmax = -10000; |
Ymin = 10000; |
Ymax = -10000; |
Zmin = 10000; |
Zmax = -10000; |
Calibration.AccX.Offset = RawAccX; |
Calibration.AccY.Offset = RawAccY; |
Calibration.AccZ.Offset = RawAccZ; |
invert_blinking = 0; |
break; |
case 2: // 2nd step of calibration |
// find Min and Max of the X- and Y-Sensors during rotation in the horizontal plane |
if(UncalMagX < Xmin) Xmin = UncalMagX; |
if(UncalMagX > Xmax) Xmax = UncalMagX; |
if(UncalMagY < Ymin) Ymin = UncalMagY; |
if(UncalMagY > Ymax) Ymax = UncalMagY; |
invert_blinking = 1; |
break; |
case 3: // 3rd step of calibration |
// used to change the orientation of the MK3MAG vertical to the horizontal plane |
invert_blinking = 0; |
break; |
case 4: |
// find Min and Max of the Z-Sensor |
if(UncalMagZ < Zmin) Zmin = UncalMagZ; |
if(UncalMagZ > Zmax) Zmax = UncalMagZ; |
invert_blinking = 1; |
break; |
case 5: |
// Save values |
if(cal != calold) // avoid continously writing of eeprom! |
{ |
Calibration.MagX.Range = Xmax - Xmin; |
Calibration.MagX.Offset = (Xmin + Xmax) / 2; |
Calibration.MagY.Range = Ymax - Ymin; |
Calibration.MagY.Offset = (Ymin + Ymax) / 2; |
Calibration.MagZ.Range = Zmax - Zmin; |
Calibration.MagZ.Offset = (Zmin + Zmax) / 2; |
if((Calibration.MagX.Range > 150) && (Calibration.MagY.Range > 150) && (Calibration.MagZ.Range > 150)) |
{ |
Calibration.Version = CALIBRATION_VERSION; |
// indicate write process by setting the led off for 2 seconds |
LED_GRN_OFF; |
eeprom_write_block(&Calibration, &eeCalibration, sizeof(Calibration)); |
Led_Timer = SetDelay(2000); |
// reset blinkcode |
blinkcount = 0; |
} |
else |
{ |
// restore old calibration data from eeprom |
eeprom_read_block(&Calibration, &eeCalibration, sizeof(Calibration)); |
} |
} |
invert_blinking = 0; |
break; |
default: |
break; |
} |
calold = cal; |
} |
void SetDebugValues(void) |
{ |
DebugOut.Analog[0] = MagX; |
DebugOut.Analog[1] = MagY; |
DebugOut.Analog[2] = MagZ; |
DebugOut.Analog[3] = UncalMagX; |
DebugOut.Analog[4] = UncalMagY; |
DebugOut.Analog[5] = UncalMagZ; |
switch(AttitudeSource) |
{ |
case ATTITUDE_SOURCE_ACC: |
DebugOut.Analog[6] = AccAttitudeNick; |
DebugOut.Analog[7] = AccAttitudeRoll; |
break; |
case ATTITUDE_SOURCE_UART: |
DebugOut.Analog[6] = ExternData.Attitude[NICK]; |
DebugOut.Analog[7] = ExternData.Attitude[ROLL]; |
break; |
case ATTITUDE_SOURCE_I2C: |
DebugOut.Analog[6] = I2C_WriteAttitude.Nick; |
DebugOut.Analog[7] = I2C_WriteAttitude.Roll; |
break; |
} |
DebugOut.Analog[8] = Calibration.MagX.Offset; |
DebugOut.Analog[9] = Calibration.MagX.Range; |
DebugOut.Analog[10] = Calibration.MagY.Offset; |
DebugOut.Analog[11] = Calibration.MagY.Range; |
DebugOut.Analog[12] = Calibration.MagZ.Offset; |
DebugOut.Analog[13] = Calibration.MagZ.Range; |
if(I2C_WriteCal.CalByte) DebugOut.Analog[14] = I2C_WriteCal.CalByte; |
else DebugOut.Analog[14] = ExternData.CalState; |
DebugOut.Analog[15] = Heading; |
DebugOut.Analog[16] = ExternData.UserParam[0]; |
DebugOut.Analog[17] = ExternData.UserParam[1]; |
DebugOut.Analog[18] = AccX; |
DebugOut.Analog[19] = AccY; |
DebugOut.Analog[20] = AccZ; |
DebugOut.Analog[21] = RawAccX; |
DebugOut.Analog[22] = RawAccY; |
DebugOut.Analog[23] = RawAccZ; |
DebugOut.Analog[24] = Calibration.AccX.Offset; |
DebugOut.Analog[25] = Calibration.AccY.Offset; |
DebugOut.Analog[26] = Calibration.AccZ.Offset; |
DebugOut.Analog[29] = AttitudeSource; |
} |
void AccMeasurement(void) |
{ |
if(AccPresent) |
{ |
RawAccX = (RawAccX + (int16_t)ADC_GetValue(ACC_X))/2; |
RawAccY = (RawAccY + (int16_t)ADC_GetValue(ACC_Y))/2; |
RawAccZ = (RawAccZ + (int16_t)ADC_GetValue(ACC_Z))/2; |
} |
else |
{ |
RawAccX = 0; |
RawAccY = 0; |
RawAccZ = 0; |
} |
} |
int main (void) |
{ |
static uint8_t state = 0; |
static uint16_t statetimer; |
// reset input pullup |
DDRC &=~((1<<DDC6)); |
PORTC |= (1<<PORTC6); |
LED_Init(); |
TIMER0_Init(); |
USART0_Init(); |
ADC_Init(); |
I2C_Init(); |
sei(); // enable globale interrupts |
USART0_Print("\n\rthe use of this software is only permitted\n\ron original MikroKopter-Hardware"); |
USART0_Print("\n\rwww.MikroKopter.de (c) HiSystems GmbH"); |
if(AccPresent) |
{ |
USART0_Print("\n\nACC present\n"); |
} |
LED_GRN_ON; |
Led_Timer = SetDelay(200); |
// read calibration info from eeprom |
eeprom_read_block(&Calibration, &eeCalibration, sizeof(Calibration)); |
ExternData.CalState = 0; |
I2C_WriteCal.CalByte = 0; |
statetimer = SetDelay(0); |
// main loop |
while (1) |
{ |
switch(state) |
{ |
case 0: |
if(CheckDelay(statetimer)) |
{ |
FLIP_LOW; |
statetimer = SetDelay(2); |
state = 1; |
} |
break; |
case 1: |
if(CheckDelay(statetimer)) |
{ |
RawMagnet1a = ADC_GetValue(MAG_X); |
RawMagnet2a = -ADC_GetValue(MAG_Y); |
RawMagnet3a = ADC_GetValue(MAG_Z); |
AccMeasurement(); |
statetimer = SetDelay(1); |
state = 2; |
} |
break; |
case 2: |
if(CheckDelay(statetimer)) |
{ |
FLIP_HIGH; |
statetimer = SetDelay(2); |
state = 3; |
} |
break; |
case 3: |
if(CheckDelay(statetimer)) |
{ |
RawMagnet1b = ADC_GetValue(MAG_X); |
RawMagnet2b = -ADC_GetValue(MAG_Y); |
RawMagnet3b = ADC_GetValue(MAG_Z); |
AccMeasurement(); |
statetimer = SetDelay(1); |
state = 0; |
CalcFields(); |
if(ExternData.CalState || I2C_WriteCal.CalByte) Calibrate(); |
else CalcHeading(); |
if(NC_Connected) NC_Connected--; |
if(FC_Connected) FC_Connected--; |
if(PC_Connected) PC_Connected--; |
// fall back to attitude estimation from onboard acc sensor if NC or FC does'nt send attitude data |
if(!FC_Connected && ! NC_Connected) |
{ |
AttitudeSource = ATTITUDE_SOURCE_ACC; |
Orientation = ORIENTATION_FC; |
} |
} |
break; |
default: // should never happen |
statetimer = SetDelay(0); |
state = 0; |
break; |
} // one full state cylce is 6 ms |
// check data from USART |
USART0_ProcessRxData(); |
if(PC_Connected) |
{ |
USART0_EnableTXD(); |
USART0_TransmitTxData(); |
} |
else |
{ |
USART0_DisableTXD(); |
} |
} // while(1) |
} |
/tags/V0.22c/main.h |
---|
0,0 → 1,34 |
#ifndef _MAIN_H_ |
#define _MAIN_H_ |
#include <avr/eeprom.h> |
#include <inttypes.h> |
typedef enum |
{ |
ATTITUDE_SOURCE_I2C = 0, |
ATTITUDE_SOURCE_UART = 1, |
ATTITUDE_SOURCE_ACC = 2 |
} AttitudeSource_t; |
typedef enum |
{ |
ORIENTATION_NC = 0, |
ORIENTATION_FC = 1 |
} Orientation_t; |
extern int16_t Heading; |
extern AttitudeSource_t AttitudeSource; |
extern Orientation_t Orientation; |
extern int16_t MagX, MagY, MagZ; |
void SetDebugValues(void); |
#endif //_MAIN_H_ |
/tags/V0.22c/makefile |
---|
0,0 → 1,420 |
#-------------------------------------------------------------------- |
# MCU name |
MCU = atmega168 |
F_CPU = 8000000 |
#------------------------------------------------------------------- |
#BOARD = 10 |
BOARD = 11 |
VERSION_MAJOR = 0 |
VERSION_MINOR = 22 |
VERSION_PATCH = 2 |
VERSION_SERIAL_MAJOR = 10 # Serial Protocol Major Version |
VERSION_SERIAL_MINOR = 0 # Serial Protocol Minor Version |
NC_I2C_COMPATIBLE = 3 # I2C Protocol Version |
#------------------------------------------------------------------- |
# get SVN revision |
REV := $(shell sh -c "cat .svn/entries | sed -n '4p'") |
# Output format. (can be srec, ihex, binary) |
FORMAT = ihex |
# Target file name (without extension). |
ifeq ($(VERSION_PATCH), 0) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)a_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 1) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)b_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 2) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)c_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 3) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)d_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 4) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)e_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 5) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)f_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 6) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)g_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 7) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)h_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 8) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)i_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 9) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)j_SVN$(REV) |
endif |
# Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. |
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
OPT = 2 |
########################################################################################################## |
# List C source files here. (C dependencies are automatically generated.) |
SRC = main.c uart.c timer0.c analog.c twislave.c led.c menu.c printf_P.c |
########################################################################################################## |
# List Assembler source files here. |
# Make them always end in a capital .S. Files ending in a lowercase .s |
# will not be considered source files but generated files (assembler |
# output from the compiler), and will be deleted upon "make clean"! |
# Even though the DOS/Win* filesystem matches both .s and .S the same, |
# it will preserve the spelling of the filenames, and gcc itself does |
# care about how the name is spelled on its command-line. |
ASRC = |
# List any extra directories to look for include files here. |
# Each directory must be seperated by a space. |
EXTRAINCDIRS = |
CDEFS = -DF_CPU=$(F_CPU)UL |
# Optional compiler flags. |
# -g: generate debugging information (for GDB, or for COFF conversion) |
# -O*: optimization level |
# -f...: tuning, see gcc manual and avr-libc documentation |
# -Wall...: warning level |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create assembler listing |
CFLAGS = -O$(OPT) \ |
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ |
-Wall -Wstrict-prototypes \ |
-Wa,-adhlns=$(<:.c=.lst) \ |
$(patsubst %,-I%,$(EXTRAINCDIRS)) |
# Set a "language standard" compiler flag. |
# Unremark just one line below to set the language standard to use. |
# gnu99 = C99 + GNU extensions. See GCC manual for more information. |
#CFLAGS += -std=c89 |
#CFLAGS += -std=gnu89 |
#CFLAGS += -std=c99 |
CFLAGS += -std=gnu99 |
CFLAGS += $(CDEFS) |
CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_PATCH=$(VERSION_PATCH) -DVERSION_SERIAL_MAJOR=$(VERSION_SERIAL_MAJOR) -DVERSION_SERIAL_MINOR=$(VERSION_SERIAL_MINOR) -DBOARD=$(BOARD) -DNC_I2C_COMPATIBLE=$(NC_I2C_COMPATIBLE) |
ifeq ($(AVR_CTRL_PLATINE), 1) |
CFLAGS += -DAVR_CTRL_PLATINE=$(AVR_CTRL_PLATINE) |
endif |
# Optional assembler flags. |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create listing |
# -gstabs: have the assembler create line number information; note that |
# for use in COFF files, additional information about filenames |
# and function names needs to be present in the assembler source |
# files -- see avr-libc docs [FIXME: not yet described there] |
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
# Optional linker flags. |
# -Wl,...: tell GCC to pass this to linker. |
# -Map: create map file |
# --cref: add cross reference to map file |
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref |
# Additional libraries |
# Minimalistic printf version |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_min |
# Floating point printf version (requires -lm below) |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt |
# -lm = math library |
LDFLAGS += -lm |
# Programming support using avrdude. Settings and variables. |
# Programming hardware: alf avr910 avrisp bascom bsd |
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 |
# |
# Type: avrdude -c ? |
# to get a full listing. |
# |
AVRDUDE_PROGRAMMER = dt006 |
#AVRDUDE_PROGRAMMER = stk200 |
#AVRDUDE_PORT = com1 # programmer connected to serial device |
AVRDUDE_PORT = lpt1 # programmer connected to parallel port |
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex |
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
AVRDUDE_FLAGS = -F -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) |
# Uncomment the following if you want avrdude's erase cycle counter. |
# Note that this counter needs to be initialized first using -Yn, |
# see avrdude manual. |
#AVRDUDE_ERASE += -y |
# Uncomment the following if you do /not/ wish a verification to be |
# performed after programming the device. |
#AVRDUDE_FLAGS += -V -E noreset |
# Increase verbosity level. Please use this when submitting bug |
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> |
# to submit bug reports. |
#AVRDUDE_FLAGS += -v -v |
# --------------------------------------------------------------------------- |
# Define directories, if needed. |
DIRAVR = c:/winavr |
DIRAVRBIN = $(DIRAVR)/bin |
DIRAVRUTILS = $(DIRAVR)/utils/bin |
DIRINC = . |
DIRLIB = $(DIRAVR)/avr/lib |
# Define programs and commands. |
SHELL = sh |
CC = avr-gcc |
OBJCOPY = avr-objcopy |
OBJDUMP = avr-objdump |
SIZE = avr-size |
# Programming support using avrdude. |
AVRDUDE = avrdude |
REMOVE = rm -f |
COPY = cp |
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
ELFSIZE = $(SIZE) -A $(TARGET).elf |
# Define Messages |
# English |
MSG_ERRORS_NONE = Errors: none |
MSG_BEGIN = -------- begin -------- |
MSG_END = -------- end -------- |
MSG_SIZE_BEFORE = Size before: |
MSG_SIZE_AFTER = Size after: |
MSG_COFF = Converting to AVR COFF: |
MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
MSG_FLASH = Creating load file for Flash: |
MSG_EEPROM = Creating load file for EEPROM: |
MSG_EXTENDED_LISTING = Creating Extended Listing: |
MSG_SYMBOL_TABLE = Creating Symbol Table: |
MSG_LINKING = Linking: |
MSG_COMPILING = Compiling: |
MSG_ASSEMBLING = Assembling: |
MSG_CLEANING = Cleaning project: |
# Define all object files. |
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) |
# Define all listing files. |
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) |
# Combine all necessary flags and optional flags. |
# Add target processor to flags. |
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
# Default target. |
all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ |
$(TARGET).lss $(TARGET).sym sizeafter finished end |
# Eye candy. |
# AVR Studio 3.x does not check make's exit code but relies on |
# the following magic strings to be generated by the compile job. |
begin: |
@echo |
@echo $(MSG_BEGIN) |
finished: |
@echo $(MSG_ERRORS_NONE) |
end: |
@echo $(MSG_END) |
@echo |
# Display size of file. |
sizebefore: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi |
sizeafter: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi |
# Display compiler version information. |
gccversion : |
@$(CC) --version |
# Convert ELF to COFF for use in debugging / simulating in |
# AVR Studio or VMLAB. |
COFFCONVERT=$(OBJCOPY) --debugging \ |
--change-section-address .data-0x800000 \ |
--change-section-address .bss-0x800000 \ |
--change-section-address .noinit-0x800000 \ |
--change-section-address .eeprom-0x810000 |
coff: $(TARGET).elf |
@echo |
@echo $(MSG_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof |
extcoff: $(TARGET).elf |
@echo |
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof |
# Program the device. |
program: $(TARGET).hex $(TARGET).eep |
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
# Create final output files (.hex, .eep) from ELF output file. |
%.hex: %.elf |
@echo |
@echo $(MSG_FLASH) $@ |
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ |
%.eep: %.elf |
@echo |
@echo $(MSG_EEPROM) $@ |
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ |
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@ |
# Create extended listing file from ELF output file. |
%.lss: %.elf |
@echo |
@echo $(MSG_EXTENDED_LISTING) $@ |
$(OBJDUMP) -h -S $< > $@ |
# Create a symbol table from ELF output file. |
%.sym: %.elf |
@echo |
@echo $(MSG_SYMBOL_TABLE) $@ |
avr-nm -n $< > $@ |
# Link: create ELF output file from object files. |
.SECONDARY : $(TARGET).elf |
.PRECIOUS : $(OBJ) |
%.elf: $(OBJ) |
@echo |
@echo $(MSG_LINKING) $@ |
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) |
# Compile: create object files from C source files. |
%.o : %.c |
@echo |
@echo $(MSG_COMPILING) $< |
$(CC) -c $(ALL_CFLAGS) $< -o $@ |
# Compile: create assembler files from C source files. |
%.s : %.c |
$(CC) -S $(ALL_CFLAGS) $< -o $@ |
# Assemble: create object files from assembler source files. |
%.o : %.S |
@echo |
@echo $(MSG_ASSEMBLING) $< |
$(CC) -c $(ALL_ASFLAGS) $< -o $@ |
# Target: clean project. |
clean: begin clean_list finished end |
clean_list : |
@echo |
@echo $(MSG_CLEANING) |
# $(REMOVE) $(TARGET).hex |
# $(REMOVE) $(TARGET).eep |
# $(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).cof |
$(REMOVE) $(TARGET).elf |
$(REMOVE) $(TARGET).map |
$(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).a90 |
$(REMOVE) $(TARGET).sym |
$(REMOVE) $(TARGET).lnk |
$(REMOVE) $(TARGET).lss |
$(REMOVE) $(OBJ) |
$(REMOVE) $(LST) |
$(REMOVE) $(SRC:.c=.s) |
$(REMOVE) $(SRC:.c=.d) |
# Automatically generate C source code dependencies. |
# (Code originally taken from the GNU make user manual and modified |
# (See README.txt Credits).) |
# |
# Note that this will work with sh (bash) and sed that is shipped with WinAVR |
# (see the SHELL variable defined above). |
# This may not work with other shells or other seds. |
# |
%.d: %.c |
set -e; $(CC) -MM $(ALL_CFLAGS) $< \ |
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ |
[ -s $@ ] || rm -f $@ |
# Remove the '-' if you want to see the dependency files generated. |
-include $(SRC:.c=.d) |
# Listing of phony targets. |
.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ |
clean clean_list program |
/tags/V0.22c/menu.c |
---|
0,0 → 1,102 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + only for non-profit use |
// + www.MikroKopter.com |
// + see the File "License.txt" for further Informations |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <stdlib.h> |
#include <inttypes.h> |
#include "menu.h" |
#include "uart.h" |
#include "printf_P.h" |
#include "analog.h" |
#include "main.h" |
uint8_t MaxMenuItem = 2; |
uint8_t MenuItem = 0; |
uint8_t RemoteKeys = 0; |
#define KEY1 0x01 |
#define KEY2 0x02 |
#define KEY3 0x04 |
#define KEY4 0x08 |
#define KEY5 0x10 |
int8_t DisplayBuff[DISPLAYBUFFSIZE] = "Hello World"; |
uint8_t DispPtr = 0; |
/************************************/ |
/* Clear LCD Buffer */ |
/************************************/ |
void LCD_Clear(void) |
{ |
uint8_t i; |
for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' '; |
} |
/************************************/ |
/* Update Menu on LCD */ |
/************************************/ |
// Display with 20 characters in 4 lines |
void LCD_PrintMenu(void) |
{ |
if(RemoteKeys & KEY1) |
{ |
if(MenuItem) MenuItem--; |
else MenuItem = MaxMenuItem; |
} |
if(RemoteKeys & KEY2) |
{ |
if(MenuItem == MaxMenuItem) MenuItem = 0; |
else MenuItem++; |
} |
if((RemoteKeys & KEY1) && (RemoteKeys & KEY2)) MenuItem = 0; |
LCD_Clear(); |
if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
// print menu item number in the upper right corner |
if(MenuItem < 10) |
{ |
LCD_printfxy(17,0,"[%i]",MenuItem); |
} |
else |
{ |
LCD_printfxy(16,0,"[%i]",MenuItem); |
} |
switch(MenuItem) |
{ |
case 0:// Version Info Menu Item |
LCD_printfxy(0,0,"++ MK3MAG ++ "); |
LCD_printfxy(0,1," V %d.%d%c", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH + 'a'); |
if(AccPresent) |
{ |
LCD_printfxy(0,2, " ACC Support "); |
} |
else |
{ |
LCD_printfxy(0,2, " "); |
} |
LCD_printfxy(0,3,"(c) Buss, Busker "); |
break; |
case 1: // Magnet readings |
LCD_printfxy(0,0,"Magnet Sensors: "); |
LCD_printfxy(0,1,"X:%+4d ", MagX); |
LCD_printfxy(0,2,"Y:%+4d ", MagY); |
LCD_printfxy(0,3,"Z:%+4d ", MagZ); |
break; |
default: |
MaxMenuItem = MenuItem - 1; |
MenuItem = 0; |
break; |
} |
RemoteKeys = 0; |
} |
/tags/V0.22c/menu.h |
---|
0,0 → 1,18 |
#ifndef _MENU_H |
#define _MENU_H |
#include <inttypes.h> |
#define DISPLAYBUFFSIZE 80 |
extern void LCD_PrintMenu(void); |
extern void LCD_Clear(void); |
extern int8_t DisplayBuff[]; |
extern uint8_t DispPtr; |
extern uint8_t MenuItem; |
extern uint8_t MaxMenuItem; |
extern uint8_t RemoteKeys; |
#endif //_MENU_H |
/tags/V0.22c/old_macros.h |
---|
0,0 → 1,47 |
/* |
For backwards compatibility only. |
Ingo Busker ingo@mikrocontroller.com |
*/ |
#ifndef cbi |
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) |
#endif |
#ifndef sbi |
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) |
#endif |
#ifndef inb |
#define inb(sfr) _SFR_BYTE(sfr) |
#endif |
#ifndef outb |
#define outb(sfr, val) (_SFR_BYTE(sfr) = (val)) |
#endif |
#ifndef inw |
#define inw(sfr) _SFR_WORD(sfr) |
#endif |
#ifndef outw |
#define outw(sfr, val) (_SFR_WORD(sfr) = (val)) |
#endif |
#ifndef outp |
#define outp(val, sfr) outb(sfr, val) |
#endif |
#ifndef inp |
#define inp(sfr) inb(sfr) |
#endif |
#ifndef BV |
#define BV(bit) _BV(bit) |
#endif |
#ifndef PRG_RDB |
#define PRG_RDB pgm_read_byte |
#endif |
/tags/V0.22c/printf_P.c |
---|
0,0 → 1,483 |
// Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist nicht von der Lizenz für den MikroKopter-Teil unterstellt |
/* |
Copyright (C) 1993 Free Software Foundation |
This file is part of the GNU IO Library. This library is free |
software; you can redistribute it and/or modify it under the |
terms of the GNU General Public License as published by the |
Free Software Foundation; either version 2, or (at your option) |
any later version. |
This library is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
You should have received a copy of the GNU General Public License |
along with this library; see the file COPYING. If not, write to the Free |
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
As a special exception, if you link this library with files |
compiled with a GNU compiler to produce an executable, this does not cause |
the resulting executable to be covered by the GNU General Public License. |
This exception does not however invalidate any other reasons why |
the executable file might be covered by the GNU General Public License. */ |
/* |
* Copyright (c) 1990 Regents of the University of California. |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. [rescinded 22 July 1999] |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
*/ |
/****************************************************************************** |
This file is a patched version of printf called _printf_P |
It is made to work with avr-gcc for Atmel AVR MCUs. |
There are some differences from standard printf: |
1. There is no floating point support (with fp the code is about 8K!) |
2. Return type is void |
3. Format string must be in program memory (by using macro printf this is |
done automaticaly) |
4. %n is not implemented (just remove the comment around it if you need it) |
5. If LIGHTPRINTF is defined, the code is about 550 bytes smaller and the |
folowing specifiers are disabled : |
space # * . - + p s o O |
6. A function void uart_sendchar(char c) is used for output. The UART must |
be initialized before using printf. |
Alexander Popov |
sasho@vip.orbitel.bg |
******************************************************************************/ |
/* |
* Actual printf innards. |
* |
* This code is large and complicated... |
*/ |
#include <string.h> |
#ifdef __STDC__ |
#include <stdarg.h> |
#else |
#include <varargs.h> |
#endif |
#include "old_macros.h" |
#include "printf_P.h" |
#include "menu.h" |
#include "uart.h" |
//#define LIGHTPRINTF |
char PrintZiel; |
char Putchar(char zeichen) |
{ |
if(PrintZiel == OUT_LCD) { DisplayBuff[DispPtr++] = zeichen; return(1);} |
else return(USART0_putchar(zeichen)); |
} |
void PRINT(const char * ptr, unsigned int len) |
{ |
for(;len;len--) Putchar(*ptr++); |
} |
void PRINTP(const char * ptr, unsigned int len) |
{ |
for(;len;len--) Putchar(pgm_read_byte(ptr++)); |
} |
void PAD_SP(signed char howmany) |
{ |
for(;howmany>0;howmany--) Putchar(' '); |
} |
void PAD_0(signed char howmany) |
{ |
for(;howmany>0;howmany--) Putchar('0'); |
} |
#define BUF 40 |
/* |
* Macros for converting digits to letters and vice versa |
*/ |
#define to_digit(c) ((c) - '0') |
#define is_digit(c) ((c)<='9' && (c)>='0') |
#define to_char(n) ((n) + '0') |
/* |
* Flags used during conversion. |
*/ |
#define LONGINT 0x01 /* long integer */ |
#define LONGDBL 0x02 /* long double; unimplemented */ |
#define SHORTINT 0x04 /* short integer */ |
#define ALT 0x08 /* alternate form */ |
#define LADJUST 0x10 /* left adjustment */ |
#define ZEROPAD 0x20 /* zero (as opposed to blank) pad */ |
#define HEXPREFIX 0x40 /* add 0x or 0X prefix */ |
void _printf_P (char ziel,char const *fmt0, ...) /* Works with string from FLASH */ |
{ |
va_list ap; |
register const char *fmt; /* format string */ |
register char ch; /* character from fmt */ |
register int n; /* handy integer (short term usage) */ |
register char *cp; /* handy char pointer (short term usage) */ |
const char *fmark; /* for remembering a place in fmt */ |
register unsigned char flags; /* flags as above */ |
signed char width; /* width from format (%8d), or 0 */ |
signed char prec; /* precision from format (%.3d), or -1 */ |
char sign; /* sign prefix (' ', '+', '-', or \0) */ |
unsigned long _ulong=0; /* integer arguments %[diouxX] */ |
#define OCT 8 |
#define DEC 10 |
#define HEX 16 |
unsigned char base; /* base for [diouxX] conversion */ |
signed char dprec; /* a copy of prec if [diouxX], 0 otherwise */ |
signed char dpad; /* extra 0 padding needed for integers */ |
signed char fieldsz; /* field size expanded by sign, dpad etc */ |
/* The initialization of 'size' is to suppress a warning that |
'size' might be used unitialized. It seems gcc can't |
quite grok this spaghetti code ... */ |
signed char size = 0; /* size of converted field or string */ |
char buf[BUF]; /* space for %c, %[diouxX], %[eEfgG] */ |
char ox[2]; /* space for 0x hex-prefix */ |
PrintZiel = ziel; // bestimmt, LCD oder UART |
va_start(ap, fmt0); |
fmt = fmt0; |
/* |
* Scan the format for conversions (`%' character). |
*/ |
for (;;) { |
for (fmark = fmt; (ch = pgm_read_byte(fmt)) != '\0' && ch != '%'; fmt++) |
/* void */; |
if ((n = fmt - fmark) != 0) { |
PRINTP(fmark, n); |
} |
if (ch == '\0') |
goto done; |
fmt++; /* skip over '%' */ |
flags = 0; |
dprec = 0; |
width = 0; |
prec = -1; |
sign = '\0'; |
rflag: ch = PRG_RDB(fmt++); |
reswitch: |
#ifdef LIGHTPRINTF |
if (ch=='o' || ch=='u' || (ch|0x20)=='x') { |
#else |
if (ch=='u' || (ch|0x20)=='x') { |
#endif |
if (flags&LONGINT) { |
_ulong=va_arg(ap, unsigned long); |
} else { |
register unsigned int _d; |
_d=va_arg(ap, unsigned int); |
_ulong = flags&SHORTINT ? (unsigned long)(unsigned short)_d : (unsigned long)_d; |
} |
} |
#ifndef LIGHTPRINTF |
if(ch==' ') { |
/* |
* ``If the space and + flags both appear, the space |
* flag will be ignored.'' |
* -- ANSI X3J11 |
*/ |
if (!sign) |
sign = ' '; |
goto rflag; |
} else if (ch=='#') { |
flags |= ALT; |
goto rflag; |
} else if (ch=='*'||ch=='-') { |
if (ch=='*') { |
/* |
* ``A negative field width argument is taken as a |
* - flag followed by a positive field width.'' |
* -- ANSI X3J11 |
* They don't exclude field widths read from args. |
*/ |
if ((width = va_arg(ap, int)) >= 0) |
goto rflag; |
width = -width; |
} |
flags |= LADJUST; |
flags &= ~ZEROPAD; /* '-' disables '0' */ |
goto rflag; |
} else if (ch=='+') { |
sign = '+'; |
goto rflag; |
} else if (ch=='.') { |
if ((ch = PRG_RDB(fmt++)) == '*') { |
n = va_arg(ap, int); |
prec = n < 0 ? -1 : n; |
goto rflag; |
} |
n = 0; |
while (is_digit(ch)) { |
n = n*10 + to_digit(ch); |
ch = PRG_RDB(fmt++); |
} |
prec = n < 0 ? -1 : n; |
goto reswitch; |
} else |
#endif /* LIGHTPRINTF */ |
if (ch=='0') { |
/* |
* ``Note that 0 is taken as a flag, not as the |
* beginning of a field width.'' |
* -- ANSI X3J11 |
*/ |
if (!(flags & LADJUST)) |
flags |= ZEROPAD; /* '-' disables '0' */ |
goto rflag; |
} else if (ch>='1' && ch<='9') { |
n = 0; |
do { |
n = 10 * n + to_digit(ch); |
ch = PRG_RDB(fmt++); |
} while (is_digit(ch)); |
width = n; |
goto reswitch; |
} else if (ch=='h') { |
flags |= SHORTINT; |
goto rflag; |
} else if (ch=='l') { |
flags |= LONGINT; |
goto rflag; |
} else if (ch=='c') { |
*(cp = buf) = va_arg(ap, int); |
size = 1; |
sign = '\0'; |
} else if (ch=='D'||ch=='d'||ch=='i') { |
if(ch=='D') |
flags |= LONGINT; |
if (flags&LONGINT) { |
_ulong=va_arg(ap, long); |
} else { |
register int _d; |
_d=va_arg(ap, int); |
_ulong = flags&SHORTINT ? (long)(short)_d : (long)_d; |
} |
if ((long)_ulong < 0) { |
_ulong = -_ulong; |
sign = '-'; |
} |
base = DEC; |
goto number; |
} else |
/* |
if (ch=='n') { |
if (flags & LONGINT) |
*va_arg(ap, long *) = ret; |
else if (flags & SHORTINT) |
*va_arg(ap, short *) = ret; |
else |
*va_arg(ap, int *) = ret; |
continue; // no output |
} else |
*/ |
#ifndef LIGHTPRINTF |
if (ch=='O'||ch=='o') { |
if (ch=='O') |
flags |= LONGINT; |
base = OCT; |
goto nosign; |
} else if (ch=='p') { |
/* |
* ``The argument shall be a pointer to void. The |
* value of the pointer is converted to a sequence |
* of printable characters, in an implementation- |
* defined manner.'' |
* -- ANSI X3J11 |
*/ |
/* NOSTRICT */ |
_ulong = (unsigned int)va_arg(ap, void *); |
base = HEX; |
flags |= HEXPREFIX; |
ch = 'x'; |
goto nosign; |
} else if (ch=='s') { // print a string from RAM |
if ((cp = va_arg(ap, char *)) == NULL) { |
cp=buf; |
cp[0] = '('; |
cp[1] = 'n'; |
cp[2] = 'u'; |
cp[4] = cp[3] = 'l'; |
cp[5] = ')'; |
cp[6] = '\0'; |
} |
if (prec >= 0) { |
/* |
* can't use strlen; can only look for the |
* NUL in the first `prec' characters, and |
* strlen() will go further. |
*/ |
char *p = (char*)memchr(cp, 0, prec); |
if (p != NULL) { |
size = p - cp; |
if (size > prec) |
size = prec; |
} else |
size = prec; |
} else |
size = strlen(cp); |
sign = '\0'; |
} else |
#endif /* LIGHTPRINTF */ |
if(ch=='U'||ch=='u') { |
if (ch=='U') |
flags |= LONGINT; |
base = DEC; |
goto nosign; |
} else if (ch=='X'||ch=='x') { |
base = HEX; |
/* leading 0x/X only if non-zero */ |
if (flags & ALT && _ulong != 0) |
flags |= HEXPREFIX; |
/* unsigned conversions */ |
nosign: sign = '\0'; |
/* |
* ``... diouXx conversions ... if a precision is |
* specified, the 0 flag will be ignored.'' |
* -- ANSI X3J11 |
*/ |
number: if ((dprec = prec) >= 0) |
flags &= ~ZEROPAD; |
/* |
* ``The result of converting a zero value with an |
* explicit precision of zero is no characters.'' |
* -- ANSI X3J11 |
*/ |
cp = buf + BUF; |
if (_ulong != 0 || prec != 0) { |
register unsigned char _d,notlastdigit; |
do { |
notlastdigit=(_ulong>=base); |
_d = _ulong % base; |
if (_d<10) { |
_d+='0'; |
} else { |
_d+='a'-10; |
if (ch=='X') _d&=~0x20; |
} |
*--cp=_d; |
_ulong /= base; |
} while (notlastdigit); |
#ifndef LIGHTPRINTF |
// handle octal leading 0 |
if (base==OCT && flags & ALT && *cp != '0') |
*--cp = '0'; |
#endif |
} |
size = buf + BUF - cp; |
} else { //default |
/* "%?" prints ?, unless ? is NUL */ |
if (ch == '\0') |
goto done; |
/* pretend it was %c with argument ch */ |
cp = buf; |
*cp = ch; |
size = 1; |
sign = '\0'; |
} |
/* |
* All reasonable formats wind up here. At this point, |
* `cp' points to a string which (if not flags&LADJUST) |
* should be padded out to `width' places. If |
* flags&ZEROPAD, it should first be prefixed by any |
* sign or other prefix; otherwise, it should be blank |
* padded before the prefix is emitted. After any |
* left-hand padding and prefixing, emit zeroes |
* required by a decimal [diouxX] precision, then print |
* the string proper, then emit zeroes required by any |
* leftover floating precision; finally, if LADJUST, |
* pad with blanks. |
*/ |
/* |
* compute actual size, so we know how much to pad. |
*/ |
fieldsz = size; |
dpad = dprec - size; |
if (dpad < 0) |
dpad = 0; |
if (sign) |
fieldsz++; |
else if (flags & HEXPREFIX) |
fieldsz += 2; |
fieldsz += dpad; |
/* right-adjusting blank padding */ |
if ((flags & (LADJUST|ZEROPAD)) == 0) |
PAD_SP(width - fieldsz); |
/* prefix */ |
if (sign) { |
PRINT(&sign, 1); |
} else if (flags & HEXPREFIX) { |
ox[0] = '0'; |
ox[1] = ch; |
PRINT(ox, 2); |
} |
/* right-adjusting zero padding */ |
if ((flags & (LADJUST|ZEROPAD)) == ZEROPAD) |
PAD_0(width - fieldsz); |
/* leading zeroes from decimal precision */ |
PAD_0(dpad); |
/* the string or number proper */ |
PRINT(cp, size); |
/* left-adjusting padding (always blank) */ |
if (flags & LADJUST) |
PAD_SP(width - fieldsz); |
} |
done: |
va_end(ap); |
} |
/tags/V0.22c/printf_P.h |
---|
0,0 → 1,19 |
#ifndef _PRINTF_P_H_ |
#define _PRINTF_P_H_ |
#include <avr/pgmspace.h> |
#define OUT_V24 0 |
#define OUT_LCD 1 |
void _printf_P (char, char const *fmt0, ...); |
extern char PrintZiel; |
#define printf_P(format, args...) _printf_P(OUT_V24,format , ## args) |
#define printf(format, args...) _printf_P(OUT_V24,PSTR(format) , ## args) |
#define LCD_printfxy(x,y,format, args...) { DispPtr = y * 20 + x; _printf_P(OUT_LCD,PSTR(format) , ## args);} |
#define LCD_printf(format, args...) { _printf_P(OUT_LCD,PSTR(format) , ## args);} |
#endif |
/tags/V0.22c/timer0.c |
---|
0,0 → 1,170 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <inttypes.h> |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include "main.h" |
volatile uint16_t CountMilliseconds = 0; |
volatile uint16_t I2C_Timeout = 0; |
/*****************************************************/ |
/* Initialize Timer 0 */ |
/*****************************************************/ |
void TIMER0_Init(void) |
{ |
// set PB2 as output for the PWM used to signal compass heading |
DDRB |= (1<<DDB2); |
PORTB &= ~(1<<PORTB2); |
// Timer/Counter 0 Control Register A |
// Normal Timer Counter Mode (Bits WGM02 = 0, WGM01 = 0, WGM00 = 0) |
// OC0A disconnected (Bits COM0A1 = 0, COM0A0 = 0) |
// OC0B disconnected (Bits COM0B1 = 0, COM0B0 = 0) |
TCCR0A &= ~((1<<COM0A1)|(1<<COM0A0)|(1<<COM0B1)|(1<<COM0B0)|(1<<WGM01)|(1<<WGM00)); |
// Timer/Counter 0 Control Register B |
// set clock devider for timer 0 to SYSKLOCK/8 = 8MHz / 8 = 1MHz |
// i.e. the timer increments from 0x00 to 0xFF with an update rate of 2.5 MHz |
// hence the timer overflow interrupt frequency is 2.5 MHz / 256 = 9.765 kHz |
// divider 8 (Bits CS02 = 0, CS01 = 1, CS00 = 0) |
TCCR0B &= ~((1<<FOC0A)|(1<<FOC0B)|(1<<WGM02)|(1<<CS02)); |
TCCR0B = (1<<CS01)|(0<<CS00); |
// init Timer/Counter 0 Register |
TCNT0 = 0; |
// Timer/Counter 0 Interrupt Mask Register |
// enable timer overflow interrupt only |
TIMSK0 &= ~((1<<OCIE0B)|(1<<OCIE0A)); |
TIMSK0 |= (1<<TOIE0); |
} |
// ----------------------------------------------------------------------- |
ISR(TIMER0_OVF_vect) |
{ |
static uint8_t cnt; |
static uint16_t cmps_cnt; |
// reload timer register so that overflow occurs after 100 increments at 1 MHz |
// resulting in a calling rate of this ISR of 10kHz or 0.1 ms. |
TCNT0 -= 101; |
// disable PWM when bad compass heading value |
if(Heading < 0) |
{ |
PORTB &= ~(1<<PORTB2); |
cmps_cnt = 0; |
} |
else |
{ |
// if a periode of 38.0 ms is over |
if(++cmps_cnt >= 380) |
{ |
// set PWM out to high |
PORTB |= (1<<PORTB2); |
// reset periode counter |
cmps_cnt = 0; |
} |
// if the delay in 0.1 ms is equal to Heading + 10 |
else if(cmps_cnt >= (Heading + 10)) |
{ |
// set PWM out to low |
PORTB &= ~(1<<PORTB2); |
} |
} |
if(!--cnt) |
{ |
// every 10th run (1kHz or 1ms) |
cnt = 10; |
CountMilliseconds++; |
if(I2C_Timeout) I2C_Timeout--; |
} |
} |
// ----------------------------------------------------------------------- |
uint16_t SetDelay (uint16_t t) |
{ |
return(CountMilliseconds + t - 1); |
} |
// ----------------------------------------------------------------------- |
int8_t CheckDelay(uint16_t t) |
{ |
return(((t - CountMilliseconds) & 0x8000) >> 8); // check sign bit |
} |
// ----------------------------------------------------------------------- |
void Delay_ms(uint16_t wait) |
{ |
uint16_t t_stop; |
t_stop = SetDelay(wait); |
while (!CheckDelay(t_stop)); |
} |
/tags/V0.22c/timer0.h |
---|
0,0 → 1,17 |
#ifndef _TIMER0_H |
#define _TIMER0_H |
#include <inttypes.h> |
extern volatile uint16_t CountMilliseconds; |
extern volatile uint16_t I2C_Timeout; |
void TIMER0_Init(void); |
uint16_t SetDelay (uint16_t t); |
int8_t CheckDelay(uint16_t t); |
void Delay_ms(uint16_t wait); |
#endif //_TIMER0_H |
/tags/V0.22c/twislave.c |
---|
0,0 → 1,293 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <util/twi.h> |
#include "twislave.h" |
#include "uart.h" |
#include "main.h" |
#include "timer0.h" |
#include "led.h" |
volatile uint8_t I2C_RxBufferSize = 0, I2C_TxBufferSize = 0; |
volatile uint8_t *I2C_TxBuffer = 0, *I2C_RxBuffer = 0; |
volatile uint8_t Tx_Idx = 0, Rx_Idx = 0; |
volatile uint8_t I2C_PrimRxBuffer[10]; |
uint8_t NC_Connected = 0; |
I2C_Heading_t I2C_Heading; |
I2C_WriteAttitude_t I2C_WriteAttitude; |
I2C_Mag_t I2C_Mag; |
I2C_Version_t I2C_Version; |
I2C_WriteCal_t I2C_WriteCal; |
// send ACK after recieving a byte / ACK is expected after transmitting a byte |
#define TWCR_ACK TWCR = (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(1<<TWEA)|(0<<TWSTA)|(0<<TWSTO)|(0<<TWWC) |
// send no ACK after recieving a byte / No ACK is expected after transmitting a byte |
#define TWCR_NACK TWCR = (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(0<<TWEA)|(0<<TWSTA)|(0<<TWSTO)|(0<<TWWC) |
// switched to the non adressed slave mode |
#define TWCR_RESET TWCR = (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(1<<TWEA)|(0<<TWSTA)|(0<<TWSTO)|(0<<TWWC) |
// The bit pattern for TWCR_ACK and TWCR_RESET are equal. This is no errro but used for better understanding. |
#define TWCR_CLEARBUS TWCR = (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(1<<TWEA)|(0<<TWSTA)|(1<<TWSTO)|(0<<TWWC) |
void I2C_Init(void) |
{ |
uint8_t sreg; |
// backup status register |
sreg = SREG; |
// disable global interrupts |
cli(); |
// SCK/SCL and MISO/SDA are at put together on the same connector pin in the schematic |
// set PB4 (SCK) and PB5 (MISO) as input pull up |
DDRB &= ~((1<<DDB4)|(1<<DDB5)); |
PORTB |= ((1<<PORTB4)|(1<<PORTB5)); |
// set PC4 (SDA) and PC5 (SCL) as input tristate |
DDRC &= ~((1<<DDC4)|(1<<DDC5)); |
PORTC &= ~((1<<PORTC4)|(1<<PORTC5)); |
I2C_TxBuffer = 0; |
Tx_Idx = 0; |
I2C_TxBufferSize = 0; |
I2C_RxBuffer = 0; |
Rx_Idx = 0; |
I2C_RxBufferSize = 0; |
TWCR = ~(1<<TWSTA)|(1<<TWSTO); |
TWCR|= (1<<TWEA) | (1<<TWEN)|(1<<TWIE); |
// set own address |
// set own address in the upper 7 bits |
TWAR = I2C_SLAVE_ADDRESS; // set own address only the upper 7 bits are relevant |
// TWI Control Register |
// enable TWI Acknowledge Bit (TWEA = 1) |
// disable TWI START Condition Bit (TWSTA = 0), SLAVE |
// disable TWI STOP Condition Bit (TWSTO = 0), SLAVE |
// enable TWI (TWEN = 1) |
// enable TWI Interrupt (TWIE = 1) |
TWCR |= (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(1<<TWEA)|(0<<TWSTA)|(1<<TWSTO)|(0<<TWWC); |
// update version info |
I2C_Version.Major = VERSION_MAJOR; |
I2C_Version.Minor = VERSION_MINOR; |
I2C_Version.Patch = VERSION_PATCH; |
I2C_Version.Compatible = NC_I2C_COMPATIBLE; |
TWCR_RESET; |
// resore status register |
SREG = sreg; |
} |
ISR (TWI_vect) |
{ |
uint8_t data; |
static uint8_t crc; |
// check event |
switch (TW_STATUS) |
{ |
case TW_SR_SLA_ACK: // slave addressed in receiver mode and ack has been returned |
Rx_Idx = 0xFF; // reset rx buffer pointer |
TWCR_ACK; // trigger receiving of first data byte and send ack afterwards |
return; |
case TW_SR_DATA_ACK: // data has been received and ack has been returned |
data = TWDR; |
if (Rx_Idx == 0xFF) |
{ // if the first byte after slave addressing was received |
switch(data) |
{ |
case I2C_CMD_VERSION: |
I2C_TxBuffer = (uint8_t *)&I2C_Version; |
I2C_TxBufferSize = sizeof(I2C_Version); |
I2C_RxBuffer = 0; |
I2C_RxBufferSize = 0; |
break; |
case I2C_CMD_WRITE_CAL: |
I2C_TxBuffer = (uint8_t *)&I2C_WriteCal; |
I2C_TxBufferSize = sizeof(I2C_WriteCal); |
I2C_RxBuffer = (uint8_t *)&I2C_WriteCal; |
I2C_RxBufferSize = sizeof(I2C_WriteCal); |
break; |
case I2C_CMD_READ_MAG: |
I2C_TxBuffer = (uint8_t *)&I2C_Mag; |
I2C_TxBufferSize = sizeof(I2C_Mag); |
I2C_RxBuffer = 0; |
I2C_RxBufferSize = 0; |
I2C_Mag.MagX = MagX; |
I2C_Mag.MagY = MagY; |
I2C_Mag.MagZ = MagZ; |
break; |
case I2C_CMD_READ_HEADING: |
I2C_TxBuffer = (uint8_t *)&I2C_Heading; |
I2C_TxBufferSize = sizeof(I2C_Heading); |
I2C_RxBuffer = (uint8_t *)&I2C_WriteAttitude; |
I2C_RxBufferSize = sizeof(I2C_WriteAttitude); |
I2C_Heading.Heading = Heading; // get heading |
AttitudeSource = ATTITUDE_SOURCE_I2C; |
Orientation = ORIENTATION_NC; |
NC_Connected = 255; |
break; |
default: // unknown command id |
I2C_RxBuffer = 0; |
I2C_RxBufferSize = 0; |
I2C_TxBuffer = 0; |
I2C_TxBufferSize = 0; |
break; |
} |
Rx_Idx = 0; // set rx buffer index to start of the buffer |
crc = data; |
} |
else // Rx_Idx != 0xFF |
{ |
// fill receiver buffer with the byte that has been received |
// if buffer exist and there is still some free space |
if(Rx_Idx < I2C_RxBufferSize) |
{ |
I2C_PrimRxBuffer[Rx_Idx] = data; |
crc += data; |
} |
else if (Rx_Idx == I2C_RxBufferSize) // crc byte was transfered |
{ // if checksum matched |
crc = ~crc; //flip all bits inthe checksum |
if(crc == data) |
{ // and RxBuffer exist |
if(I2C_RxBuffer != 0) |
{ // copy data to rx buffer |
for(data = 0; data < I2C_RxBufferSize; data++) |
{ |
I2C_RxBuffer[data] = I2C_PrimRxBuffer[data]; |
} |
} |
DebugOut.Analog[31]++; |
} |
else |
{ |
DebugOut.Analog[30]++; |
} |
} |
// else ignore data |
Rx_Idx++; |
} |
TWCR_ACK; |
return; |
case TW_ST_SLA_ACK: // slave transmitter selected |
// reset index to start of tx buffer |
Tx_Idx = 0; |
crc = 0; |
// if tx buffer exist and there is at least one byte to transfer |
if((I2C_TxBuffer != 0) && (I2C_TxBufferSize > 1)) |
{ |
data = I2C_TxBuffer[Tx_Idx]; |
} |
else |
{ // send 0x00 if no tx buffer exist or all bytes of the tx buffer have been transmitted |
data = 0x00; |
} |
crc += data; |
Tx_Idx++; |
TWDR = data; |
TWCR_ACK; |
return; |
case TW_ST_DATA_ACK: // data byte has been transmitted ack has been received |
// put next byte from tx buffer to the data register |
if((I2C_TxBuffer != 0) && (Tx_Idx < I2C_TxBufferSize)) |
{ |
data = I2C_TxBuffer[Tx_Idx]; |
crc += data; |
} |
else if (Tx_Idx == I2C_TxBufferSize) |
{ // send crc byte at the end |
data = ~crc; |
} |
else |
{ |
data = 0x00; |
} |
Tx_Idx++; |
TWDR = data; |
TWCR_ACK; |
return; |
case TW_BUS_ERROR: // Bus-Error |
TWCR_CLEARBUS; // free bus, reset to nonselected slave |
return; |
case TW_ST_DATA_NACK: // data transmitted, NACK received |
case TW_ST_LAST_DATA: // last data byte transmitted, ACK received |
case TW_SR_STOP: // stop or repeated start condition received while selected |
default: |
TWCR_RESET; // switch to the not addressed slave mode, own SLA will be recognized |
return; |
} |
} |
/tags/V0.22c/twislave.h |
---|
0,0 → 1,63 |
#ifndef _TWI_SLAVE_H_ |
#define _TWI_SLAVE_H_ |
#include <inttypes.h> |
#define I2C_SLAVE_ADDRESS 0x50 |
#define I2C_CMD_VERSION 0x01 |
#define I2C_CMD_READ_MAG 0x02 |
#define I2C_CMD_READ_HEADING 0x03 |
#define I2C_CMD_WRITE_CAL 0x04 |
#define I2C_CMD_WRITE_EEPROM 0x0A |
#define I2C_CMD_READ_EEPROM 0x0B |
typedef struct |
{ |
uint8_t Major; |
uint8_t Minor; |
uint8_t Patch; |
uint8_t Compatible; |
} I2C_Version_t; |
typedef struct |
{ |
int16_t MagX; |
int16_t MagY; |
int16_t MagZ; |
} I2C_Mag_t; |
typedef struct |
{ |
int16_t Nick; |
int16_t Roll; |
} I2C_WriteAttitude_t; |
typedef struct |
{ |
uint8_t CalByte; |
uint8_t Dummy1; |
uint8_t Dummy2; |
} I2C_WriteCal_t; |
typedef struct |
{ |
int16_t Heading; |
} I2C_Heading_t; |
extern uint8_t NC_Connected; |
extern I2C_Heading_t I2C_Heading; |
extern I2C_WriteAttitude_t I2C_WriteAttitude; |
extern I2C_Mag_t I2C_Mag; |
extern I2C_Version_t I2C_Version; |
extern I2C_WriteCal_t I2C_WriteCal; |
void I2C_Init(void); |
#endif // _TWI_SLAVE_H_ |
/tags/V0.22c/uart.c |
---|
0,0 → 1,655 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/wdt.h> |
#include <avr/pgmspace.h> |
#include <stdarg.h> |
#include <string.h> |
#include "main.h" |
#include "menu.h" |
#include "uart.h" |
#include "timer0.h" |
#include "twislave.h" |
// slave addresses |
#define FC_ADDRESS 1 |
#define NC_ADDRESS 2 |
#define MK3MAG_ADDRESS 3 |
#define FALSE 0 |
#define TRUE 1 |
// keep buffers as small as possible |
#define TXD_BUFFER_LEN 100 |
#define RXD_BUFFER_LEN 30 |
volatile uint8_t txd_buffer[TXD_BUFFER_LEN]; |
volatile uint8_t rxd_buffer_locked = FALSE; |
volatile uint8_t rxd_buffer[RXD_BUFFER_LEN]; |
volatile uint8_t txd_complete = TRUE; |
volatile uint8_t ReceivedBytes = 0; |
volatile uint8_t *pRxData = 0; |
volatile uint8_t RxDataLen = 0; |
// send flags |
#define RQST_VERSION_INFO 0x01 |
#define RQST_DEBUG_DATA 0x02 |
#define RQST_DEBUG_LABEL 0x04 |
#define RQST_COMPASS_HEADING 0x08 |
#define RQST_EXTERN_CTRL 0x10 |
#define RQST_DISPLAY_DATA 0x20 |
uint8_t RequestFlags = 0x00; |
uint8_t RequestDebugLabel = 0; |
uint8_t ConfirmFrame = 0; |
uint8_t DisplayLine = 0; |
uint16_t PC_Connected = 0; |
uint16_t FC_Connected = 0; |
DebugOut_t DebugOut; |
ExternData_t ExternData; |
ExternControl_t ExternControl; |
UART_VersionInfo_t UART_VersionInfo; |
uint16_t DebugData_Timer; |
uint16_t DebugData_Interval = 500; |
const prog_uint8_t ANALOG_LABEL[32][16] = |
{ |
//1234567890123456 |
"Magnet X ", //0 |
"Magnet Y ", |
"Magnet Z ", |
"RawMagnet X ", |
"RawMagnet Y ", |
"RawMagnet Z ", //5 |
"Attitude Nick ", |
"Attitude Roll ", |
"Magnet X Offset ", |
"Magnet X Range ", |
"Magnet Y Offset ", //10 |
"Magnet Y Range ", |
"Magnet Z Offset ", |
"Magnet Z Range ", |
"Calstate ", |
"Heading ", //15 |
"User0 ", |
"User1 ", |
"Acc X ", |
"Acc Y ", |
"Acc Z ", //20 |
"RawAcc X ", |
"RawAcc Y ", |
"RawAcc Z ", |
"Acc X Offset ", |
"Acc Y Offset ", //25 |
"Acc Z Offset ", |
"Heading X ", |
"Heading Y ", |
"Attitude Source ", |
"I2C Error ", //30 |
"I2C Okay " |
}; |
/****************************************************************/ |
/* Initialization of the USART0 */ |
/****************************************************************/ |
void USART0_Init (void) |
{ |
uint8_t sreg = SREG; |
uint16_t ubrr = (uint16_t) ((uint32_t) F_CPU/(8 * BAUD_RATE) - 1); |
// disable all interrupts before configuration |
cli(); |
// disable RX-Interrupt |
UCSR0B &= ~(1 << RXCIE0); |
// disable TX-Interrupt |
UCSR0B &= ~(1 << TXCIE0); |
// set direction of RXD0 and TXD0 pins |
// set RXD0 (PD0) as an input pin tristate |
DDRD &= ~(1 << DDD0); |
PORTD &= ~(1 << PORTD0); |
// set TXD0 (PD1) as an output pin |
DDRD |= (1 << DDD1); |
PORTD &= ~(1 << PORTD1); |
// USART0 Baud Rate Register |
// set clock divider |
UBRR0H = (uint8_t)(ubrr >> 8); |
UBRR0L = (uint8_t)ubrr; |
// USART0 Control and Status Register A, B, C |
// enable double speed operation |
UCSR0A |= (1 << U2X0); |
// set asynchronous mode |
UCSR0C &= ~(1 << UMSEL01); |
UCSR0C &= ~(1 << UMSEL00); |
// no parity |
UCSR0C &= ~(1 << UPM01); |
UCSR0C &= ~(1 << UPM00); |
// 1 stop bit |
UCSR0C &= ~(1 << USBS0); |
// 8-bit |
UCSR0B &= ~(1 << UCSZ02); |
UCSR0C |= (1 << UCSZ01); |
UCSR0C |= (1 << UCSZ00); |
// enable receiver and transmitter |
UCSR0B |= (1 << RXEN0); |
UCSR0B |= (1 << TXEN0); |
// flush receive buffer |
while ( UCSR0A & (1<<RXC0) ) UDR0; |
// enable RX-Interrupt |
UCSR0B |= (1 << RXCIE0); |
// enable TX-Interrupt |
UCSR0B |= (1 << TXCIE0); |
// initialize the debug timer |
DebugData_Timer = SetDelay(DebugData_Interval); |
// unlock rxd_buffer |
rxd_buffer_locked = FALSE; |
pRxData = 0; |
RxDataLen = 0; |
// no bytes to send |
txd_complete = TRUE; |
UART_VersionInfo.SWMajor = VERSION_MAJOR; |
UART_VersionInfo.SWMinor = VERSION_MINOR; |
UART_VersionInfo.SWPatch = VERSION_PATCH; |
UART_VersionInfo.ProtoMajor = VERSION_SERIAL_MAJOR; |
UART_VersionInfo.ProtoMinor = VERSION_SERIAL_MINOR; |
// send version info at startup |
USART0_putchar ('\n'); |
USART0_putchar ('C'); |
USART0_putchar ('P'); |
USART0_putchar (':'); |
USART0_putchar ('V'); |
USART0_putchar ('0' + VERSION_MAJOR); |
USART0_putchar ('.'); |
USART0_putchar ('0' + VERSION_MINOR/10); |
USART0_putchar ('0' + VERSION_MINOR%10); |
USART0_putchar ('a' + VERSION_PATCH); |
USART0_putchar ('\n'); |
// restore global interrupt flags |
SREG = sreg; |
} |
// --------------------------------------------------------------------------------- |
void USART0_EnableTXD(void) |
{ |
DDRD |= (1<<DDD1); // set TXD pin as output |
PORTD &= ~(1 << PORTD1); |
UCSR0B |= (1 << TXEN0); // enable TX in USART |
//changing the interrupt flag yields to strange effects |
//UCSR0B |= (1 << TXCIE0); // enable TX-Interrupt |
} |
// --------------------------------------------------------------------------------- |
void USART0_DisableTXD(void) |
{ |
while(!txd_complete){ }; |
//changing the interrupt flag yields to strange effects |
//UCSR0B &= ~(1 << TXCIE0); // disable TX-Interrupt |
UCSR0B &= ~(1 << TXEN0); // disable TX in USART |
DDRD &= ~(1<<DDD1); // set TXD pin as input |
PORTD &= ~(1 << PORTD1); |
} |
/****************************************************************/ |
/* USART0 transmitter ISR */ |
/****************************************************************/ |
ISR(USART_TX_vect) |
{ |
static uint16_t ptr_txd_buffer = 0; |
uint8_t tmp_tx; |
if(!txd_complete) // transmission not completed |
{ |
ptr_txd_buffer++; // die [0] wurde schon gesendet |
tmp_tx = txd_buffer[ptr_txd_buffer]; |
// if terminating character or end of txd buffer was reached |
if((tmp_tx == '\r') || (ptr_txd_buffer == TXD_BUFFER_LEN)) |
{ |
ptr_txd_buffer = 0; // reset txd pointer |
txd_complete = TRUE; // stop transmission |
} |
UDR0 = tmp_tx; // send current byte will trigger this ISR again |
} |
// transmission completed |
else ptr_txd_buffer = 0; |
} |
/****************************************************************/ |
/* USART0 receiver ISR */ |
/****************************************************************/ |
ISR(USART_RX_vect) |
{ |
static uint16_t crc; |
uint8_t crc1, crc2; |
uint8_t c; |
static uint8_t ptr_rxd_buffer = 0; |
c = UDR0; // catch the received byte |
if(rxd_buffer_locked) return; // if rxd buffer is locked immediately return |
// the rxd buffer is unlocked |
if((ptr_rxd_buffer == 0) && (c == '#')) // if rxd buffer is empty and syncronisation character is received |
{ |
rxd_buffer[ptr_rxd_buffer++] = c; // copy 1st byte to buffer |
crc = c; // init crc |
} |
#if 0 |
else if (ptr_rxd_buffer == 1) // handle address |
{ |
rxd_buffer[ptr_rxd_buffer++] = c; // copy byte to rxd buffer |
crc += c; // update crc |
} |
#endif |
else if (ptr_rxd_buffer < RXD_BUFFER_LEN) // collect incomming bytes |
{ |
if(c != '\r') // no termination character |
{ |
rxd_buffer[ptr_rxd_buffer++] = c; // copy byte to rxd buffer |
crc += c; // update crc |
} |
else // termination character was received |
{ |
// the last 2 bytes are no subject for checksum calculation |
// they are the checksum itself |
crc -= rxd_buffer[ptr_rxd_buffer-2]; |
crc -= rxd_buffer[ptr_rxd_buffer-1]; |
// calculate checksum from transmitted data |
crc %= 4096; |
crc1 = '=' + crc / 64; |
crc2 = '=' + crc % 64; |
// compare checksum to transmitted checksum bytes |
if((crc1 == rxd_buffer[ptr_rxd_buffer-2]) && (crc2 == rxd_buffer[ptr_rxd_buffer-1])) |
{ // checksum valid |
rxd_buffer[ptr_rxd_buffer] = '\r'; // set termination character |
ReceivedBytes = ptr_rxd_buffer + 1;// store number of received bytes |
rxd_buffer_locked = TRUE; // lock the rxd buffer |
// if 2nd byte is an 'R' enable watchdog that will result in an reset |
if(rxd_buffer[2] == 'R') {wdt_enable(WDTO_250MS);} // Reset-Commando |
} |
else |
{ // checksum invalid |
rxd_buffer_locked = FALSE; // unlock rxd buffer |
} |
ptr_rxd_buffer = 0; // reset rxd buffer pointer |
} |
} |
else // rxd buffer overrun |
{ |
ptr_rxd_buffer = 0; // reset rxd buffer |
rxd_buffer_locked = FALSE; // unlock rxd buffer |
} |
} |
// -------------------------------------------------------------------------- |
void AddCRC(uint16_t datalen) |
{ |
uint16_t tmpCRC = 0, i; |
for(i = 0; i < datalen; i++) |
{ |
tmpCRC += txd_buffer[i]; |
} |
tmpCRC %= 4096; |
txd_buffer[i++] = '=' + tmpCRC / 64; |
txd_buffer[i++] = '=' + tmpCRC % 64; |
txd_buffer[i++] = '\r'; |
txd_complete = FALSE; |
UDR0 = txd_buffer[0]; // initiates the transmission (continued in the TXD ISR) |
} |
// -------------------------------------------------------------------------- |
void SendOutData(uint8_t cmd, uint8_t address, uint8_t numofbuffers, ...) // uint8_t *pdata, uint8_t len, ... |
{ |
va_list ap; |
uint16_t pt = 0; |
uint8_t a,b,c; |
uint8_t ptr = 0; |
uint8_t *pdata = 0; |
int len = 0; |
txd_buffer[pt++] = '#'; // Start character |
txd_buffer[pt++] = 'a' + address; // Address (a=0; b=1,...) |
txd_buffer[pt++] = cmd; // Command |
va_start(ap, numofbuffers); |
if(numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
while(len) |
{ |
if(len) |
{ |
a = pdata[ptr++]; |
len--; |
if((!len) && numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
} |
else a = 0; |
if(len) |
{ |
b = pdata[ptr++]; |
len--; |
if((!len) && numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
} |
else b = 0; |
if(len) |
{ |
c = pdata[ptr++]; |
len--; |
if((!len) && numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
} |
else c = 0; |
txd_buffer[pt++] = '=' + (a >> 2); |
txd_buffer[pt++] = '=' + (((a & 0x03) << 4) | ((b & 0xf0) >> 4)); |
txd_buffer[pt++] = '=' + (((b & 0x0f) << 2) | ((c & 0xc0) >> 6)); |
txd_buffer[pt++] = '=' + ( c & 0x3f); |
} |
va_end(ap); |
AddCRC(pt); // add checksum after data block and initates the transmission |
} |
// -------------------------------------------------------------------------- |
void Decode64(void) |
{ |
uint8_t a,b,c,d; |
uint8_t x,y,z; |
uint8_t ptrIn = 3; |
uint8_t ptrOut = 3; |
uint8_t len = ReceivedBytes - 6; |
while(len) |
{ |
a = rxd_buffer[ptrIn++] - '='; |
b = rxd_buffer[ptrIn++] - '='; |
c = rxd_buffer[ptrIn++] - '='; |
d = rxd_buffer[ptrIn++] - '='; |
//if(ptrIn > ReceivedBytes - 3) break; |
x = (a << 2) | (b >> 4); |
y = ((b & 0x0f) << 4) | (c >> 2); |
z = ((c & 0x03) << 6) | d; |
if(len--) rxd_buffer[ptrOut++] = x; else break; |
if(len--) rxd_buffer[ptrOut++] = y; else break; |
if(len--) rxd_buffer[ptrOut++] = z; else break; |
} |
pRxData = &rxd_buffer[3]; |
RxDataLen = ptrOut - 3; |
} |
// -------------------------------------------------------------------------- |
int16_t USART0_putchar (int8_t c) |
{ |
// if tx is not enabled return immediatly |
if(!(UCSR0B & (1 << TXEN0))) return (0); |
if (c == '\n') USART0_putchar('\r'); |
// wait until previous character was send |
loop_until_bit_is_set(UCSR0A, UDRE0); |
// send character |
UDR0 = c; |
return (0); |
} |
// -------------------------------------------------------------------------- |
void USART0_ProcessRxData(void) |
{ |
// if data in the rxd buffer are not locked immediately return |
if(!rxd_buffer_locked) return; |
Decode64(); // decode data block in rxd_buffer |
switch(rxd_buffer[1]-'a') // check Slave Address |
{ |
case MK3MAG_ADDRESS: |
switch(rxd_buffer[2]) // check for CmdID |
{ |
case 'w': // old style |
case 'k': // Attitude info from FC |
memcpy(&ExternData, (uint8_t*)pRxData, sizeof(ExternData)); |
RequestFlags |= RQST_COMPASS_HEADING; |
AttitudeSource = ATTITUDE_SOURCE_UART; |
Orientation = ExternData.Orientation; |
FC_Connected = 255; |
break; |
default: |
// unsupported command |
break; |
} // case MK3MAG_ADDRESS: |
default: // any Slave Address |
switch(rxd_buffer[2]) // check for CmdID |
{ |
case 'b': // extern control |
memcpy(&ExternControl, (uint8_t*)pRxData, sizeof(ExternControl)); |
#define KEY1 0x01 |
#define KEY2 0x02 |
#define KEY3 0x04 |
#define KEY4 0x08 |
#define KEY5 0x10 |
// use right arrow at display for switching the calstate |
if(ExternControl.RemoteButtons & KEY2) |
{ |
ExternData.CalState++; |
if(ExternData.CalState == 6) ExternData.CalState = 0; |
} |
ConfirmFrame = ExternControl.Frame; |
PC_Connected = 2000; |
break; |
case 'd': // request for the debug data |
DebugData_Interval = (uint16_t) pRxData[0] * 10; |
if(DebugData_Interval>0) RequestFlags |= RQST_DEBUG_DATA; |
PC_Connected = 2000; |
break; |
case 'v': // request version and board release |
RequestFlags |= RQST_VERSION_INFO; |
PC_Connected = 2000; |
break; |
case 'h': // request display data |
RemoteKeys |= pRxData[0]; |
if(RemoteKeys) DisplayLine = 0; |
RequestFlags |= RQST_DISPLAY_DATA; |
PC_Connected = 2000; |
break; |
case 'a':// Labels of the Analog Debug outputs |
RequestDebugLabel = pRxData[0]; |
RequestFlags |= RQST_DEBUG_LABEL; |
PC_Connected = 2000; |
break; |
case 'g':// get extern control data |
RequestFlags |= RQST_EXTERN_CTRL; |
PC_Connected = 2000; |
break; |
default: |
// unsupported command |
break; |
} |
break; // default: |
} |
// unlock the rxd buffer after processing |
pRxData = 0; |
RxDataLen = 0; |
rxd_buffer_locked = FALSE; |
} |
//--------------------------------------------------------------------------------------------- |
void USART0_TransmitTxData(void) |
{ |
if(!(UCSR0B & (1 << TXEN0))) return; |
if(!txd_complete) return; |
if((RequestFlags & RQST_DEBUG_LABEL) && txd_complete) |
{ |
uint8_t label[16]; |
memcpy_P(label, ANALOG_LABEL[RequestDebugLabel], 16); // read lable from flash to sram buffer |
SendOutData('A', MK3MAG_ADDRESS, 2, (uint8_t *)&RequestDebugLabel, sizeof(RequestDebugLabel), label, 16); |
RequestDebugLabel = 0xFF; |
RequestFlags &= ~RQST_DEBUG_LABEL; |
} |
else if(ConfirmFrame && txd_complete) |
{ |
SendOutData('B', MK3MAG_ADDRESS, 1, (uint8_t *) &ConfirmFrame, sizeof(ConfirmFrame)); |
ConfirmFrame = 0; |
} |
else if(( ((DebugData_Interval > 0) && CheckDelay(DebugData_Timer)) || (RequestFlags & RQST_DEBUG_DATA)) && txd_complete) |
{ |
SetDebugValues(); |
SendOutData('D', MK3MAG_ADDRESS, 1, (uint8_t *) &DebugOut, sizeof(DebugOut)); |
DebugData_Timer = SetDelay(DebugData_Interval); |
RequestFlags &= ~RQST_DEBUG_DATA; |
} |
else if((RequestFlags & RQST_DISPLAY_DATA) && txd_complete) |
{ |
LCD_PrintMenu(); |
SendOutData('H', FC_ADDRESS, 2, &DisplayLine, sizeof(DisplayLine), &DisplayBuff[DisplayLine * 20], 20); |
DisplayLine++; |
if(DisplayLine >= 4) DisplayLine = 0; |
RequestFlags &= ~RQST_DISPLAY_DATA; |
} |
else if((RequestFlags & RQST_EXTERN_CTRL) && txd_complete) |
{ |
SendOutData('G', MK3MAG_ADDRESS, 1, (uint8_t *) &ExternControl,sizeof(ExternControl)); |
RequestFlags &= ~RQST_EXTERN_CTRL; |
} |
else if((RequestFlags & RQST_COMPASS_HEADING) && txd_complete) |
{ |
SendOutData('K', FC_ADDRESS, 1, (uint8_t *) &Heading, sizeof(Heading)); // send compass heading to FC |
RequestFlags &= ~RQST_COMPASS_HEADING; |
} |
else if((RequestFlags & RQST_VERSION_INFO) && txd_complete) |
{ |
SendOutData('V', MK3MAG_ADDRESS, 1, (uint8_t *) &UART_VersionInfo, sizeof(UART_VersionInfo)); |
RequestFlags &= ~RQST_VERSION_INFO; |
} |
} |
void USART0_Print(int8_t *msg) |
{ |
uint8_t i = 0; |
while(msg[i] != 0) |
{ |
USART0_putchar(msg[i++]); |
} |
} |
/tags/V0.22c/uart.h |
---|
0,0 → 1,76 |
#ifndef _UART_H_ |
#define _UART_H_ |
#include <inttypes.h> |
#define NICK 0 |
#define ROLL 1 |
#define BAUD_RATE 57600 |
extern uint16_t DebugData_Timer; |
void USART0_Init (void); |
void USART0_EnableTXD(void); |
void USART0_DisableTXD(void); |
void USART0_TransmitTxData(void); |
void USART0_ProcessRxData(void); |
int16_t USART0_putchar(int8_t c); |
void USART0_Print(int8_t *msg); |
typedef struct |
{ |
uint8_t Digital[2]; |
uint16_t Analog[32]; // Debugvalues |
} DebugOut_t; |
extern DebugOut_t DebugOut; |
typedef struct |
{ |
int16_t Attitude[2]; // nick and roll angle in 0.1 deg |
uint8_t UserParam[2]; |
uint8_t CalState; |
uint8_t Orientation; |
} ExternData_t; |
extern ExternData_t ExternData; |
typedef struct |
{ |
uint8_t Digital[2]; |
uint8_t RemoteButtons; |
int8_t Nick; |
int8_t Roll; |
int8_t Yaw; |
uint8_t Gas; |
int8_t Height; |
uint8_t free; |
uint8_t Frame; |
uint8_t Config; |
} ExternControl_t; |
extern ExternControl_t ExternControl; |
typedef struct |
{ |
uint8_t SWMajor; |
uint8_t SWMinor; |
uint8_t ProtoMajor; |
uint8_t ProtoMinor; |
uint8_t SWPatch; |
uint8_t Reserved[5]; |
} UART_VersionInfo_t; |
extern uint16_t PC_Connected; |
extern uint16_t FC_Connected; |
#endif //_UART_H_ |
/tags/V0.22c |
---|
Property changes: |
Added: tsvn:logminsize |
+8 |
\ No newline at end of property |
/tags/V0.23a/Compass.pnproj |
---|
0,0 → 1,0 |
<Project name="avr_ctrl"><File path="uart.h"></File><File path="main.c"></File><File path="main.h"></File><File path="makefile"></File><File path="uart.c"></File><File path="timer0.c"></File><File path="timer0.h"></File><File path="analog.h"></File><File path="analog.c"></File><File path="twislave.c"></File><File path="twislave.h"></File><File path="menu.c"></File></Project> |
/tags/V0.23a/Compassl.pnps |
---|
0,0 → 1,0 |
<pd><ViewState><e p="avr_ctrl" x="true"></e></ViewState></pd> |
/tags/V0.23a/Hex-Files/BootLoader_MEGA168_8MHZ_V0.2.hex |
---|
0,0 → 1,61 |
:1038000011241FBECFEFD4E0DEBFCDBF11E0A0E09A |
:10381000B1E0EEEAFBE302C005900D92A030B107E3 |
:10382000D9F711E0A0E0B1E001C01D92A238B107C4 |
:10383000E1F70C943B1C0C941D1C0895982F80916B |
:10384000C00085FFFCCF9093C60008958091C00012 |
:103850008823E4F78091C600992708958DE40E949B |
:103860001E1C8BE40E941E1C82E40E941E1C8CE421 |
:103870000E941E1C0895CFEFD4E0DEBFCDBFE0E074 |
:10388000F0E004917F01992494BE98E10FB6F8947A |
:1038900090936000109260000FBE9092C50080E18E |
:1038A0008093C4008091C00082608093C000909398 |
:1038B000C10086E08093C200EF01192D8091C00005 |
:1038C00087FF0DC0113031F48091C6008A3A89F12A |
:1038D00010E005C08091C6008B3109F411E0CE01E3 |
:1038E00021968436910500F10F3F41F0002331F01D |
:1038F000E0910001F0910101099516C08AE00E9453 |
:103900001E1C8DE00E941E1C86E50E941E1C80E38A |
:103910000E941E1C8EE20E941E1C82E30E941E1C3E |
:103920008AE30E941E1C05C080E29EE40197F1F725 |
:10393000C5CF0E942E1C0E94261C813611F489E5F9 |
:1039400033C1813471F40E94261CE82EFF24FE2C22 |
:10395000EE240E94261C9927E82AF92AF694E79477 |
:10396000F1C0823641F489E50E941E1C80E00E946D |
:103970001E1C80E819C1823409F075C00E94261C03 |
:103980000E94261CD82E0E94261C082FB2E0AB2EC7 |
:10399000B1E0BB2E10E0E5010894A11CB11C1D157F |
:1039A00018F40E94261C01C08FEF88831F5F17FF49 |
:1039B000F2CF38E7931609F0D4C0063409F03DC0C1 |
:1039C0008FEFE81687E3F80608F033C0CD2DA70186 |
:1039D00066277727440F551F661F771F6A017B01F3 |
:1039E000A2E0B1E011E08D9199272D913327322F7C |
:1039F0002227822B932B0C01FA0110935700E89594 |
:103A000011244E5F5F4F6F4F7F4FC25061F785E0CB |
:103A1000F60180935700E89507B600FCFDCF81E1E1 |
:103A200080935700E89576956795579547957A0165 |
:103A300089C080E00E941E1C85C0053409F082C048 |
:103A4000F7012D2DA2E0B1E0E1BD8F2F992782BDB6 |
:103A50008D9180BD3196FA9AF99AF999FECF21504D |
:103A600099F77F016FC0873609F03DC00E94261C80 |
:103A70000E94261CC82F0E94261C863419F5C701F7 |
:103A8000AA27BB276C017D01CC0CDD1CEE1CFF1CA2 |
:103A9000F60105911491802F0E941E1C812F9927F9 |
:103AA0000E941E1C82E090E0A0E0B0E0C80ED91E8B |
:103AB000EA1EFB1EC25061F7F694E794D794C794B0 |
:103AC000760139CF853409F036CFE1BC8F2D9927A7 |
:103AD00082BDF89A0894E11CF11C80B50E941E1C5E |
:103AE000C15099F728CF853601F598E7991651F519 |
:103AF00080E090E0A0E0B0E023E0FC0120935700DC |
:103B0000E89507B600FCFDCF80589F4FAF4FBF4FE1 |
:103B10008F3F37E3930730E0A30730E0B30768F344 |
:103B200081E180935700E8950DC0853469F488E100 |
:103B300090E02CE00FB6F894A895809360000FBE3B |
:103B4000209360008DE030C08035E1F38C34D1F3F8 |
:103B5000803711F483E528C0843729F488E70E9470 |
:103B60001E1C80E021C0843521F40E94261C982E62 |
:103B7000E9CF8B3109F4DDCE8A3A09F4DACE863505 |
:103B800029F480E30E941E1C82E30EC0833741F4B7 |
:103B900086E00E941E1C84E90E941E1C8EE104C067 |
:0E3BA0008B3109F4C8CE8FE30E941E1CC4CEE8 |
:0400000300003800C1 |
:00000001FF |
/tags/V0.23a/Hex-Files/MK3Mag_MEGA168_V0_23a_SVN72.hex |
---|
0,0 → 1,856 |
:100000000C94FA010C9415020C9415020C94150230 |
:100010000C9415020C9415020C9415020C94150204 |
:100020000C9415020C9415020C9415020C941502F4 |
:100030000C9415020C9415020C9415020C941502E4 |
:100040000C94410F0C9415020C94A50A0C94150203 |
:100050000C946C0A0C9415020C9415020C94150265 |
:100060000C944A100C94150207BAA57A2C3BDA902E |
:10007000C5BC8BFC663CFD10F8BD4D83923DB63A85 |
:100080009EBE5BBFCA3FC90FDA000829573F9F2DAC |
:1000900049CBA5310F76C73493F27E37D00D013AA4 |
:1000A000B60B613D2AAAAB3F0000003F8000000074 |
:1000B000083B3BD74ABC846E023D2FC1FEBD9A313E |
:1000C000743DDA3D83BE117FC73E4CBBE5BEAAAA94 |
:1000D0006C3F800000004D61676E657420582020E1 |
:1000E0002020202020204D61676E6574205920203B |
:1000F0002020202020204D61676E6574205A20202A |
:100100002020202020205261774D61676E65742089 |
:100110005820202020205261774D61676E65742041 |
:100120005920202020205261774D61676E65742030 |
:100130005A20202020204174746974756465204E13 |
:1001400069636B2020204174746974756465205262 |
:100150006F6C6C2020204D61676E65742058204FB5 |
:100160006666736574204D61676E65742058205211 |
:10017000616E676520204D61676E65742059204F60 |
:100180006666736574204D61676E657420592052F0 |
:10019000616E676520204D61676E6574205A204F3F |
:1001A0006666736574204D61676E6574205A2052CF |
:1001B000616E6765202043616C73746174652020F3 |
:1001C00020202020202048656164696E672020205F |
:1001D000202020202020202020202020202020201F |
:1001E000202020202020202020202020202020200F |
:1001F0002020202020204163632058202020202020 |
:10020000202020202020416363205920202020200E |
:10021000202020202020416363205A2020202020FD |
:100220002020202020205261774163632058202025 |
:100230002020202020205261774163632059202014 |
:10024000202020202020526177416363205A202003 |
:1002500020202020202053657269616C20506F742B |
:1002600069312020202053657269616C20506F74C1 |
:1002700069322020202053657269616C20506F74B0 |
:1002800069332020202048656164696E672058200A |
:1002900020202020202048656164696E6720592055 |
:1002A00020202020202041747469747564652053D7 |
:1002B0006F7572636520493243204572726F7220F8 |
:1002C000202020202020493243204F6B61792020BC |
:1002D00020202020202021212120494E434F4D5015 |
:1002E000415449424C4520212121005B25695D0094 |
:1002F0005B25695D002B2B2020204D4B334D414762 |
:100300002020202B2B200020562025642E2564251C |
:1003100063002041434320537570706F7274202036 |
:100320000020202020202020202020202020002805 |
:10033000632920427573732C204275736B6572209C |
:100340002020004D61676E65742053656E736F7277 |
:10035000733A2000583A252B3464202020417474CD |
:10036000697475646500593A252B34642020206235 |
:1003700079005A3A252B3464200049324300554114 |
:10038000525400414343003F3F3F0043616C696268 |
:10039000726174696E673A2000537465703A202563 |
:1003A00031642000202D2D200020706175736520A0 |
:1003B000006D65617375726520686F72697A6F6E22 |
:1003C00074616C006D656173757265207665727419 |
:1003D0006963616C0073746F72652064617461009D |
:1003E0002873746172742900284553432928737453 |
:1003F0006570290011241FBECFEFD4E0DEBFCDBF52 |
:1004000011E0A0E0B1E0ECE7F4E302C005900D924A |
:10041000A43EB107D9F713E0A4EEB1E001C01D92EC |
:10042000A838B107E1F70C943E080C9400000F9334 |
:100430001F93CF93DF93409170025091710280918E |
:10044000510290915202481B590B509379024093EC |
:100450007802C0915502D091560280914F0290913E |
:100460005002C81BD90BD0935402C0935302009181 |
:100470007402109175028091760290917702081BA8 |
:10048000190B10937302009372022091570230915E |
:1004900058022115310509F46CC0809159029091E0 |
:1004A0005A02481B590BCA01AA2797FDA095BA2FDB |
:1004B0005AE0880F991FAA1FBB1F5A95D1F74427EE |
:1004C00037FD4095542FBC01CD010E94051A309391 |
:1004D00007022093060220915B0230915C022115F5 |
:1004E000310509F452C080915D0290915E02C81BF3 |
:1004F000D90BCE01AA2797FDA095BA2F4AE0880F05 |
:10050000991FAA1FBB1F4A95D1F7442737FD409575 |
:10051000542FBC01CD010E94051A3093050220938F |
:1005200004028091610290916202081B190BC801BC |
:10053000AA2797FDA095BA2F2AE0880F991FAA1F16 |
:10054000BB1F2A95D1F720915F02309160024427AA |
:1005500037FD4095542FBC01CD010E94051A309300 |
:1005600003022093020280910501823009F0D7C076 |
:1005700019C0309307022093060220915B0230914C |
:100580005C022115310509F0AECF309305022093AE |
:10059000040230930302209302028091050182300D |
:1005A00009F0BDC0C0910002D091010280916502A6 |
:1005B00090916602C81BD90BD093FB01C093FA013E |
:1005C0004091FE015091FF018091690290916A0271 |
:1005D000481B590B5093F9014093F80180916D022B |
:1005E00090916E022091FC013091FD01821B930BD2 |
:1005F0009093F7018093F60149385105A4F48FEFE9 |
:100600004837580704F580EE9CEF9093F5018093EE |
:10061000F401C938D10584F080E293E09093F301AE |
:100620008093F2017CC080E293E09093F501809387 |
:10063000F401C938D10584F78FEFC837D807CCF556 |
:1006400080EE9CEFEBCFCA01AA2797FDA095BA2FA9 |
:10065000BC01CD010E940218DC01CB0120E030E09A |
:100660004AE053E4BC01CD010E949F17DC01CB019D |
:10067000BC01CD010E942C17DC01CB0120E030E051 |
:1006800041EE54E4BC01CD010E94EE18DC01CB0127 |
:100690002BED3FE049E450E4BC01CD010E949F17DF |
:1006A000DC01CB01BC01CD010E94E517DC01CB01CF |
:1006B000ACCFCE01AA2797FDA095BA2FBC01CD01E2 |
:1006C0000E940218DC01CB0120E030E04AE053E454 |
:1006D000BC01CD010E949F17DC01CB01BC01CD0103 |
:1006E0000E942C17DC01CB0120E030E041EE54E405 |
:1006F000BC01CD010E94EE18DC01CB012BED3FE0E7 |
:1007000049E450E4BC01CD010E949F17DC01CB01FC |
:10071000BC01CD010E94E517DC01CB017FCFDF9149 |
:10072000CF911F910F9108952F923F924F925F9218 |
:100730006F927F928F929F92AF92BF92CF92DF92F1 |
:10074000EF92FF920F931F93CF93DF93CDB7DEB756 |
:1007500024970FB6F894DEBF0FBECDBF0F2EF0E08A |
:100760002F2EF0E03F2EF0E04F2EF0E05F2EF02D28 |
:100770008201710129823A824B825C828091080257 |
:10078000909109020E94A80F882389F080916F023E |
:10079000813009F456C18BB190E889278BB986E97D |
:1007A00090E00E949F0F909309028093080280912D |
:1007B0006F028130A9F02FEF3FEFF894C9018859FB |
:1007C0009E4F815D924028F43093030120930201F3 |
:1007D00060C18FEF9FEF909303018093020159C195 |
:1007E000809104019927009709F005C180910602C4 |
:1007F00090910702AA2797FDA095BA2FBC01CD01C1 |
:100800000E9402187B018C018091040290910502E4 |
:10081000AA2797FDA095BA2FBC01CD010E9402180E |
:100820001B012C018091020290910302AA2797FDDF |
:10083000A095BA2FBC01CD010E94021869837A836A |
:100840008B839C838091050199278130910509F460 |
:10085000FAC0823091050CF40EC1029709F402C16E |
:1008600088249924C401AA2797FDA095BA2FBC011A |
:10087000CD010E940218DC01CB012BED3FE049E4E1 |
:1008800050E4BC01CD010E94EE18DC01CB0120E058 |
:1008900030E041EE54E4BC01CD010E949F175B01A2 |
:1008A0006C01C401AA2797FDA095BA2FBC01CD0108 |
:1008B0000E940218DC01CB012BED3FE049E450E43B |
:1008C000BC01CD010E94EE18DC01CB0120E030E03C |
:1008D00041EE54E4BC01CD010E949F173B014C0145 |
:1008E000C601B5010E949917DC01CB01A80197014F |
:1008F000BC01CD010E94EE187B018C01C601B5013F |
:100900000E943619DC01CB0129813A814B815C813F |
:10091000BC01CD010E94EE18DC01CB019C01AD01B0 |
:10092000C801B7010E94E9165B016C01C401B30163 |
:100930000E949917DC01CB01A2019101BC01CD01FC |
:100940000E94EE187B018C01C401B3010E9436198C |
:10095000DC01CB0129813A814B815C81BC01CD0155 |
:100960000E94EE18DC01CB019C01AD01C801B7016A |
:100970000E94EA167B018C01C601B5010E94E517B1 |
:10098000DC01CB019093F2028093F102C801B70120 |
:100990000E94E517DC01CB019093F4028093F302EF |
:1009A000A6019501C801B7010E946617DC01CB01C1 |
:1009B00020E030E044E353E4BC01CD010E94EE1896 |
:1009C000DC01CB012BED3FE049E450E4BC01CD015B |
:1009D0000E949F17DC01CB01BC01CD010E94E517ED |
:1009E000DC01CB019C0197FD39C088E691E0821BB8 |
:1009F000930B9C01E2CE019709F024CF8091040271 |
:100A000090910502AA2797FDA095BA2FBC01CD01B0 |
:100A10000E9402187B018C018091060290910702CE |
:100A2000AA2797FDA095BA2FBC01CD010E940218FC |
:100A3000DC01CB011C012D0157FA509457F850945A |
:100A4000F1CE5F9AACCEF8948091B1029091B2024F |
:100A50008090B3029090B402789405CF30952195A0 |
:100A60003F4FABCE8091F4019091F5018090F2015F |
:100A70009090F301F8CE892B09F0F2CEF894809192 |
:100A800078039091790380907A0390907B03789417 |
:100A9000EACE789424960FB6F894DEBF0FBECDBF91 |
:100AA000DF91CF911F910F91FF90EF90DF90CF904A |
:100AB000BF90AF909F908F907F906F905F904F907E |
:100AC0003F902F9008954091F001463008F44DC0BA |
:100AD0001092F00140E080911802882309F083C051 |
:100AE0005F98842F99278330910509F479C0843069 |
:100AF00091050CF07AC08130910509F4E1C00297AC |
:100B000009F063C1209178023091790280910B0243 |
:100B100090910C02281739070CF42FC180910D0217 |
:100B200090910E028217930724F430930E022093C3 |
:100B30000D02209153023091540280910F02909146 |
:100B400010022817390724F43093100220930F0263 |
:100B50008091110290911202821793070CF0FFC04E |
:100B60003093120220931102FAC0442309F4B3CF48 |
:100B700080910802909109020E94A80F882309F031 |
:100B8000F2C04091F00180910A02481709F4A9CF00 |
:100B90005091170250FFEAC080911802882309F093 |
:100BA000EAC05F98252F33272F5F3F4F842F992767 |
:100BB000880F991F281739070CF4E6C01092170206 |
:100BC0008CED95E00E949F0F90930902809308029C |
:100BD0004091F001842F99278330910509F087CF48 |
:100BE00010921802F2C05F9A7CCF8430910509F40C |
:100BF0009CC0059709F0E9C080910A02481781F36B |
:100C0000E7E5F2E020910D0230910E0280910B0297 |
:100C100090910C02D901A81BB90BB0935802A09374 |
:100C20005702820F931F97FDADC0959587959093BE |
:100C30005A02809359022091110230911202809140 |
:100C40000F0290911002B901681B790B70935C023E |
:100C500060935B02820F931F97FD9EC095958795C9 |
:100C600090935E0280935D022091150230911602EE |
:100C70008091130290911402A901481B590B5093C3 |
:100C8000600240935F02820F931F97FD83C095958A |
:100C900087959093620280936102A739B1053CF079 |
:100CA0006739710524F0473951050CF077C0A0E091 |
:100CB000B0E089E1182E0E94201A4091F00190CFF7 |
:100CC00020E137E230930C0220930B0280EF98ED85 |
:100CD00090930E0280930D023093100220930F0226 |
:100CE0009093120280931102309314022093130206 |
:100CF0009093160280931502809100029091010258 |
:100D000090936602809365028091FE019091FF01AD |
:100D100090936A02809369028091FC019091FD0199 |
:100D200090936E0280936D025BCF2091720230919E |
:100D3000730280911302909114022817390724F44A |
:100D400030931402209313028091150290911602A1 |
:100D50008217930724F4309316022093150281E042 |
:100D60008093180232C04091F00112CF8091180296 |
:100D7000882309F016CF5F9A15CF30930C02209389 |
:100D80000B02CCCE019651CF5F5F5093170284E6E1 |
:100D900090E018CF01967BCF019660CF81E08093E1 |
:100DA0006F025F98A0E0B0E089E1182E0E94251A3A |
:100DB00080ED97E00E949F0F9093090280930802B4 |
:100DC000109217024091F0010BCF40930A02089550 |
:100DD00080910602909107029093BC028093BB021F |
:100DE00080910402909105029093BE028093BD020F |
:100DF00080910202909103029093C0028093BF02FF |
:100E000080917802909179029093C2028093C102FE |
:100E100080915302909154029093C4028093C30234 |
:100E200080917202909173029093C6028093C502E2 |
:100E300020910501822F99278130910561F0823040 |
:100E400091051CF10297A1F08FEF9FEF9093C802DC |
:100E50008093C70228C08091B1029091B202909312 |
:100E6000C8028093C7028091B3029091B4021BC064 |
:100E70008091F4019091F5019093C8028093C7028C |
:100E80008091F2019091F3010EC0892BE9F68091D7 |
:100E90007803909179039093C8028093C702809160 |
:100EA0007A0390917B039093CA028093C902809148 |
:100EB000590290915A029093CC028093CB02809178 |
:100EC0005702909158029093CE028093CD02809168 |
:100ED0005D0290915E029093D0028093CF02809148 |
:100EE0005B0290915C029093D2028093D102809138 |
:100EF0006102909162029093D4028093D302809118 |
:100F00005F02909160029093D6028093D502809107 |
:100F1000F00199279093D8028093D7028091020123 |
:100F2000909103019093DA028093D9021092DC022F |
:100F30001092DB021092DE021092DD028091FA0123 |
:100F40009091FB019093E0028093DF028091F80181 |
:100F50009091F9019093E2028093E1028091F60171 |
:100F60009091F7019093E4028093E3028091000254 |
:100F7000909101029093E6028093E5028091FE0138 |
:100F80009091FF019093E8028093E7028091FC0129 |
:100F90009091FD019093EA028093E9028091E4012F |
:100FA000992787FD90959093EC028093EB028091B6 |
:100FB000E501992787FD90959093EE028093ED02CD |
:100FC0008091E601992787FD90959093F002809398 |
:100FD000EF02822F99279093F6028093F5020895ED |
:100FE00080913802882369F4109201021092000265 |
:100FF0001092FF011092FE011092FD011092FC016F |
:10100000089582E00E94C00F2091000230910102F9 |
:10101000280F391F37FD29C03595279530930102D8 |
:101020002093000283E00E94C00F2091FE013091C6 |
:10103000FF01280F391F37FD1EC0359527953093C6 |
:10104000FF012093FE0186E00E94C00F2091FC0169 |
:101050003091FD01280F391F37FD0AC035952795BE |
:101060003093FD012093FC0108952F5F3F4FD4CFB3 |
:101070002F5F3F4FF3CF2F5F3F4FDFCFCFEFD4E056 |
:10108000DEBFCDBF3E98469A0E94B2110E942B0F40 |
:101090000E949C090E94D50F0E941110789486E04E |
:1010A00091E00E940F0F85E591E00E940F0F809163 |
:1010B0003802882309F02FC15F9A88EC90E00E94E3 |
:1010C0009F0F9093090280930802E7E5F2E0A0E009 |
:1010D000B0E089E1182E0E94201A1092F1011092BE |
:1010E000B702109275031092F00180E090E00E9428 |
:1010F0009F0F90931B0280931A0280911902C82FB0 |
:10110000DD27C130D10531F1C230D1050CF45BC00F |
:10111000C230D10509F472C0239709F486C080E07B |
:1011200090E00E949F0F90931B0280931A021092EE |
:1011300019020E94BB0C8091200290912102892B00 |
:10114000E9F50E94600A80911902C82FDD27C1309D |
:10115000D105D1F680911A0290911B020E94A80F2E |
:10116000882339F380E00E94C00F9093710280932E |
:10117000700281E00E94C00F909581959F4F9093DF |
:1011800075028093740287E00E94C00F909356020C |
:10119000809355020E94F007CE010E949F0F90930A |
:1011A0001B0280931A0282E0809319020E94BB0CFA |
:1011B0008091200290912102892B19F20E94580AF5 |
:1011C0000E94920D9ACFCD2B09F0A9CF80911A02DF |
:1011D00090911B020E94A80F882309F4AACF8BB11B |
:1011E0008F798BB982E090E00E949F0F90931B0251 |
:1011F00080931A0281E080931902D8CF80911A025D |
:1012000090911B020E94A80F882309F492CF8BB102 |
:1012100080668BB9CE010E949F0F90931B02809332 |
:101220001A0283E080931902C1CF80911A02909133 |
:101230001B020E94A80F882309F47BCF80E00E9444 |
:10124000C00F909352028093510281E00E94C00F20 |
:10125000909581959F4F909377028093760287E0D7 |
:101260000E94C00F9093500280934F020E94F0079B |
:1012700081E090E00E949F0F90931B0280931A02DE |
:10128000109219020E9417028091F101882331F413 |
:1012900080917503882311F48091B7028093F00147 |
:1012A0008091F001882391F10E94630540913902F9 |
:1012B000442319F041504093390220911E0230918D |
:1012C0001F022115310531F02150304030931F02AB |
:1012D00020931E028091200290912102009729F014 |
:1012E00001979093210280932002232B09F021CFB4 |
:1012F000442309F01ECF80913802882351F082E008 |
:101300008093050181E08093040113CF0E94940330 |
:10131000CDCF83E0F5CF8FE791E00E940F0FCCCEC9 |
:10132000982F8091C10083FF06C08091C00085FF87 |
:10133000FCCF9093C6000895CF93CFB720E130E063 |
:10134000F8948091C1008F778093C1008091C10093 |
:101350008F7B8093C10050985898519A5998832F49 |
:1013600099278093C5002093C4008091C0008260BB |
:101370008093C0008091C2008F778093C2008091DB |
:10138000C2008F7B8093C2008091C2008F7D8093CA |
:10139000C2008091C2008F7E8093C2008091C20003 |
:1013A000877F8093C2008091C1008B7F8093C100B2 |
:1013B0008091C20084608093C2008091C2008260EC |
:1013C0008093C2008091C10080618093C1008091B0 |
:1013D000C10088608093C1008091C00087FF0CC06D |
:1013E0008091C6008091C000882334F48091C600AB |
:1013F0008091C0008823A4F38091C100806880930D |
:10140000C1008091C10080648093C10080918F01F0 |
:10141000909190010E949F0F9093740380937303A7 |
:1014200080918D0190918E010E949F0F9093AE024A |
:101430008093AD0210922B02109229021092280282 |
:101440001092270281E0809391011092980287E127 |
:101450008093990210929C028BE080939A021092E2 |
:101460009B028DE00E9490098AE00E94900983E42B |
:101470000E94900980E50E9490098AE30E949009E9 |
:1014800086E50E94900980E30E9490098EE20E9406 |
:10149000900982E30E94900983E30E94900981E60B |
:1014A0000E9490098AE00E949009CFBFCF910895D1 |
:1014B000519A59988091C10088608093C100089525 |
:1014C000809191018823E1F38091C100877F80930F |
:1014D000C1005198599808951F920F920FB60F921C |
:1014E00011248F939F93EF93FF9380919101882311 |
:1014F000A9F480912C0290912D020196FC01E550F7 |
:10150000FD4FE081ED3079F08837910561F09093DF |
:101510002D0280932C02E093C6000EC010922D0283 |
:1015200010922C0209C010922D0210922C0281E020 |
:1015300080939101E093C600FF91EF919F918F916D |
:101540000F900FBE0F901F9018951F920F920FB61D |
:101550000F9211242F933F934F935F938F939F93F9 |
:10156000AF93BF93CF93DF93EF93FF935091C60058 |
:1015700080912B02882309F073C0409130024423EC |
:10158000B9F45332E1F05D3011F1E42FFF27E65852 |
:10159000FD4F50834F5F4093300280912E02909117 |
:1015A0002F02850F911D90932F0280932E0258C019 |
:1015B0004E3148F38093300280932B0251C05093F8 |
:1015C0007A0281E08093300283E290E0ECCFA42F96 |
:1015D000BB27A658BD4FFD013297808120912E0276 |
:1015E00030912F02281B3109ED0121978881281B9A |
:1015F0003109C9019F7090932F0280932E0200241D |
:10160000880F991F001C880F991F001C892F902D8F |
:10161000982F935C2F733070235C8081891729F099 |
:1016200010922B02109230021BC088818217C1F7E2 |
:101630005C934F5F40932A0281E080932B0280915C |
:101640007C02823579F788E190E02CE00FB6F894BF |
:10165000A895809360000FBE209360001092300226 |
:10166000FF91EF91DF91CF91BF91AF919F918F91BA |
:101670005F914F913F912F910F900FBE0F901F9050 |
:101680001895AC01A0E0B0E09D01A817B90748F497 |
:10169000EBEFF2E08191280F311D1196A417B507E9 |
:1016A000C8F33F70FD01E550FD4FC9010024880FCC |
:1016B000991F001C880F991F001C892F902D835C97 |
:1016C00080831196FD01E550FD4F2F733070822FFE |
:1016D000835C8083A450BD4F8DE08C931092910168 |
:1016E0008091FB028093C6000895BF92CF92DF9253 |
:1016F000EF92FF920F931F93CF93DF93CDB7DEB797 |
:101700002C859D857E85BB2483E28093FB029F59B7 |
:101710009093FC022093FD0203E010E0772309F48C |
:10172000ADC0CF84D88843E1E42EF12CEC0EFD1E31 |
:10173000A989BA897150109709F4A0C0109709F4CB |
:101740003CC0F601EB0DF11DB3949081119789F423 |
:101750007723A1F1F70122E030E0E20EF31ED7017A |
:10176000C080D180E20EF31E0D90BC91A02DBB2451 |
:101770007150109719F1F601EB0DF11DB3944081F2 |
:10178000119709F466C01097D1F0F601EB0DF11D29 |
:10179000B39460811197A1F4772391F0F701329609 |
:1017A000D701CD90DC9032E0E32EF12CEE0EFF1E3F |
:1017B000A081B181BB24715003C090E040E060E0A3 |
:1017C000F801E550FD4F892F86958695835C8083CF |
:1017D0000F5F1F4FF801E550FD4F892F9927837048 |
:1017E000907082959295907F9827807F98275527B3 |
:1017F0009A01329522952F7023273F702327822B41 |
:10180000835C80830F5F1F4FF801E550FD4F4F70E1 |
:101810005070440F551F440F551F862F99270024E1 |
:10182000880F991F001C880F991F001C892F902D6D |
:10183000842B835C80830F5F1F4FF801E550FD4FC1 |
:101840006F73635C60830F5F1F4F109709F076CF53 |
:1018500015C0772309F4B3CFF701A2E0B0E0EA0E98 |
:10186000FB1ED701C080D18022E030E0E20EF31EE3 |
:101870000D90BC91A02DBB24715085CFC8010E9452 |
:10188000410BDF91CF911F910F91FF90EF90DF906F |
:10189000CF90BF900895A3E07A2F40912A0246503E |
:1018A00009F45FC0E72FFF27E658FD4F80818D5375 |
:1018B0007F5FE72FFF27E658FD4F20812D537F5F85 |
:1018C000E72FFF27E658FD4F30813D537F5FE72F1D |
:1018D000FF27E658FD4F60816D537F5F9927880F82 |
:1018E000991F880F991F522F52955F70582B822F86 |
:1018F00099278F70907082959295907F9827807F1E |
:101900009827232F26952695282B832F9927837098 |
:1019100090700024969587950794969587950794DF |
:10192000982F802D682B41504F3FD9F0EA2FFF2789 |
:10193000E658FD4F5083AF5F41504F3F91F0EA2F83 |
:10194000FF27E658FD4F2083AF5F41504F3F49F0DE |
:10195000EA2FFF27E658FD4F6083AF5F442309F06D |
:10196000A1CF8DE792E09093290280932802A350A3 |
:10197000A0932702089580912B02882309F40895EB |
:101980000E944B0C80917B02843609F446C0809102 |
:101990007C0299278436910559F1853691058CF49E |
:1019A0008136910509F47FC08236910509F488C01B |
:1019B00010922902109228021092270210922B02F4 |
:1019C00008958836910509F45AC0893691050CF0BE |
:1019D0004CC08736910561F7809126028061809323 |
:1019E000260280ED97E09093210280932002E0CFC1 |
:1019F000E0912802F091290290818AE0989FC0012D |
:101A000011249093900180938F01892B51F3809141 |
:101A10002602826080932602E4CF80917C0299277F |
:101A20008B36910521F08737910509F0B0CFA09151 |
:101A30002802B091290288E0E1EBF2E00D900192DA |
:101A40008A95E1F78091260288608093260281E0E2 |
:101A5000809305018091B802809304018FEF90E09C |
:101A600090931F0280931E0292CF8637910509F052 |
:101A70009FCF80912602816080932602B2CFE091B1 |
:101A80002802F0912902808187FD35C082E0809391 |
:101A9000220210921D0210921C0280912602806286 |
:101AA000809326029ECFE0912802F0912902808146 |
:101AB000809325028091260284608093260291CF34 |
:101AC000A0912802B09129028BE0E2EAF2E00D90A9 |
:101AD00001928A95E1F78091A40281FF07C080916D |
:101AE000B7028F5F8630D9F08093B7028091AB0246 |
:101AF0008093240276CF8081809590912302892B58 |
:101B00008093230291818AE0989FC00111249093D1 |
:101B10001D0280931C0284E080932202BECF1092AB |
:101B2000B702E4CFCF93DF93CDB7DEB760970FB6A0 |
:101B3000F894DEBF0FBECDBF8091C10083FF66C1A8 |
:101B400080919101882309F461C12091260222FD30 |
:101B500039C080912402882309F06BC080918F01E5 |
:101B600090919001892B09F0C7C021FF7DC00E9490 |
:101B7000E80682E490E09F938F9389EB92E09F9335 |
:101B80008F9381E08F9383E08F9384E48F930E94FF |
:101B9000750B80918F01909190010E949F0F9093FF |
:101BA000740380937303809126028D7F80932602B5 |
:101BB0002DB73EB7295F3F4F0FB6F8943EBF0FBE1B |
:101BC0002DBF24C180912502992782959295907FFF |
:101BD0009827807F98278A529F4F40E150E0BC01B0 |
:101BE000CE0101960E94CF1680E190E09F938F93E3 |
:101BF000CE0101969F938F9381E090E09F938F9306 |
:101C000085E292E09F938F9382E08F9383E08F939E |
:101C100081E48F930E94750B8FEF80932502809152 |
:101C200026028B7F809326022DB73EB7255F3F4F5C |
:101C3000C3CF81E090E09F938F9384E292E09F93E3 |
:101C40008F9381E08F9383E08F9382E48F930E9440 |
:101C5000750B109224028DB79EB707960FB6F894B5 |
:101C60009EBF0FBE8DBFD2C080911C0290911D02FD |
:101C7000892BB9F5822F992785FF4AC080912202CE |
:101C8000843008F461C0809123020E94CB1110922D |
:101C9000230280E590E09F938F9382E991E09F93E8 |
:101CA0008F9381E08F9383E08F9388E48F930E94DA |
:101CB000750B8DB79EB707960FB6F8949EBF0FBEF3 |
:101CC0008DBF80911C0290911D020E949F0F9093E6 |
:101CD000B0028093AF02809126028F7D809326020E |
:101CE00095C08091AF029091B0020E94A80F882306 |
:101CF00029F620912602BECF809173039091740340 |
:101D00000E94A80F882309F032CF209126022DCF00 |
:101D100084FD53C083FD67C080FF78C08AE090E0F7 |
:101D20009F938F9388E992E09F938F9381E08F93A5 |
:101D300083E08F9386E58F930E94750B8091260236 |
:101D40008E7F8093260287CF10924D0286ED92E01F |
:101D50009F938F9385EB91E19F938F930E94201423 |
:101D600084E190E09F938F9382E991E09F938F931A |
:101D700081E090E09F938F9382E292E09F938F9314 |
:101D800082E08F9383E08F9388E48F930E94750B9A |
:101D900080912202982F9F5F2DB73EB7215F3F4F62 |
:101DA0000FB6F8943EBF0FBE2DBF843018F01092CE |
:101DB000220287CF9093220284CF8BE090E09F9302 |
:101DC0008F9382EA92E09F938F9381E08F9383E0D9 |
:101DD0008F9387E48F930E94750B809126028F7EEC |
:101DE0008093260238CF82E090E09F938F9382E029 |
:101DF00091E09F938F9381E08F938F938BE48F93E8 |
:101E00000E94750B80912602877FD0CE60960FB618 |
:101E1000F894DEBF0FBECDBFDF91CF9108951F9321 |
:101E2000CF93DF93EC0110E08881882381F0A0E05C |
:101E3000B0E0AC0FBD1F1F5F8C910E949009A12FD5 |
:101E4000BB27FE01EA0FFB1F8081882391F7DF91FA |
:101E5000CF911F910895229A2A9884B58C7084BDE1 |
:101E600085B5837385BD82E085BD16BC80916E000B |
:101E7000897F80936E0080916E00816080936E00F8 |
:101E800008951F920F920FB60F9211242F933F9334 |
:101E90004F938F939F9386B5855686BD20910201FF |
:101EA0003091030137FD3FC0809136029091370297 |
:101EB000019641E08C37940728F12A9A1092370254 |
:101EC0001092360280913502815051F58AE080935C |
:101ED000350280913302909134020196909334023E |
:101EE000809333028091310290913202892BE9F084 |
:101EF0008091310290913202019790933202809347 |
:101F0000310213C09093370280933602265F3F4F11 |
:101F100082179307B8F22A98809135028150B1F266 |
:101F20008093350202C02A98C9CF9F918F914F911B |
:101F30003F912F910F900FBE0F901F9018952091F9 |
:101F4000330230913402280F391FC90101970895D7 |
:101F50002091330230913402821B930B892F990F09 |
:101F6000990B80780895CF93DF930E949F0FEC0127 |
:101F7000CE010E94A80F8823D9F3DF91CF91089555 |
:101F800080937C0080917A00806180937A008091B8 |
:101F90007A00806480937A0080917A0084FFFCCF7D |
:101FA0008091780090917900089587B1807F87B9FA |
:101FB00088B1807F88B98AB180668AB98BB18F7900 |
:101FC0008BB910927C0080917A00877980937A0097 |
:101FD00080917A00876980937A0010927C008091CA |
:101FE0007A00806480937A0088B18C6088B980E23E |
:101FF0009EE40197F1F782E00E94C00F895E934052 |
:1020000020F481E08093380208C083E00E94C00F72 |
:10201000895E9340B0F31092380288B1837F88B90B |
:1020200008959FB7F89484B18F7C84B985B180639B |
:1020300085B987B18F7C87B988B18F7C88B91092B8 |
:102040003D0210923C0210923E0210923B0210920E |
:102050003A0210923F028FED8093BC008091BC0049 |
:1020600085648093BC0080E58093BA008091BC00B9 |
:10207000856D8093BC0010927E0387E180937F037F |
:102080001092800383E08093810385EC8093BC00F1 |
:102090009FBF08951F920F920FB60F9211242F9396 |
:1020A0003F938F939F93AF93BF93EF93FF93809151 |
:1020B000B9009927887F907080389105A9F0813800 |
:1020C00091054CF0883A910509F444C0883B91058C |
:1020D00061F185EC38C10097D9F080369105C9F7D8 |
:1020E0008FEF80934202F5CF3091BB0020914202E6 |
:1020F0002F3F09F44CC080913F02281758F080917F |
:102100003F02281709F488C02F5F20934202E1CFD5 |
:1021100085ED19C1E22FFF27ED5BFD4F30838091E4 |
:102120004002830F80934002EFCFE0913C02F09198 |
:102130003D02309709F04CC09091410280913E02DF |
:10214000981709F4A2C030E09F5F9093410230934A |
:10215000BB00BFCF1092410210924002E0913C02BE |
:10216000F0913D02309729F080913E02823008F0D4 |
:1021700051C030E080914002830F809340028091F3 |
:1021800041028F5F809341023093BB00A2CF832F27 |
:1021900099278230910509F450C08330910544F1AC |
:1021A0008330910509F49EC0049709F4BCC01092D5 |
:1021B0003B0210923A0210923F0210923D0210929E |
:1021C0003C0210923E02109242023093400281CFB4 |
:1021D0009091410280913E02981708F0AFCFE90F2D |
:1021E000F11D308180914002830F80934002ACCF7B |
:1021F0000197E9F68EE793E090933D0280933C02CD |
:1022000084E080933E0210923B0210923A021092B8 |
:102210003F02D9CF3081AECF80914002809580932C |
:1022200040028317B1F18091F7029091F802019674 |
:102230009093F8028093F70267CF82E893E090933F |
:102240003D0280933C0286E080933E0210923B0266 |
:1022500010923A0210923F0280910602909107027A |
:1022600090938303809382038091040290910502EE |
:1022700090938503809384038091020290910302DE |
:1022800090938703809386039ECF309140023095D0 |
:102290005BCFA0913A02B0913B021097C9F030E0B9 |
:1022A00080913F02381728F013C0A0913A02B091F4 |
:1022B0003B02E32FFF27AE0FBF1FED5BFD4F808179 |
:1022C0008C933F5F80913F02381778F32091420250 |
:1022D0008091F9029091FA0201969093FA0280930C |
:1022E000F90212CF8CE793E090933D0280933C0279 |
:1022F00082E080933E0288E793E090933B028093D4 |
:102300003A0284E080933F028091020190910301A0 |
:1023100090937D0380937C03109205011092040139 |
:102320002093390250CF85E793E090933D0280934C |
:102330003C0223E020933E0290933B0280933A02BA |
:1023400020933F0240CF8093BC00FF91EF91BF915B |
:10235000AF919F918F913F912F910F900FBE0F9052 |
:102360001F901895579A5F98089590914D02903557 |
:1023700040F4E92FFF27EE56FE4F80839F5F909336 |
:102380004D02089590E2E2E9F1E08FE491938150EB |
:1023900087FFFCCF0895EF92FF920F931F93CF9387 |
:1023A000DF93082F112700FF08C080914E02882379 |
:1023B00009F459C0815080934E0201FF0AC09091E8 |
:1023C0004E028091E201981709F455C09F5F9093E7 |
:1023D0004E0200FF02C001FD4BC00E94C21190914D |
:1023E0004E028091E201891718F480934E02982FD3 |
:1023F0009A3078F581E180934D02892F99279F9338 |
:102400008F938BEE92E09F938F9385EBE82E81E183 |
:10241000F82EFF92EF920E9420148DB79EB7069679 |
:102420000FB6F8949EBF0FBE8DBF90914E02C92F7C |
:10243000DD27C130D10509F46AC0C230D105F4F0FE |
:10244000229709F4DDC091509093E20110924E0260 |
:102450008CC180E180934D02892F99279F938F93A0 |
:1024600080EF92E0D0CF8091E20180934E02A5CF21 |
:1024700010924E02B2CF10924E02ABCF209719F7B6 |
:1024800010924D0285EF92E09F938F93FF92EF920F |
:102490000E94201484E180934D020F900F900F90C2 |
:1024A0000F9081E690E09F938F9387E190E09F9358 |
:1024B0008F93DF93CF9387E093E09F938F93FF9267 |
:1024C000EF920E9420148DB79EB70A960FB6F8942B |
:1024D0009EBF0FBE8DBF80913802882309F00AC1CC |
:1024E00088E280934D0281E293E09F938F9385EB86 |
:1024F00091E19F938F930E9420140F900F900F9063 |
:102500000F908CE380934D028FE293E06EC01092A7 |
:102510004D0283E493E09F938F93C5EBD1E1FF924B |
:10252000EF920E94201484E180934D020F900F904F |
:102530000F900F9080910602909107029F938F93C6 |
:1025400084E593E09F938F93FF92EF920E94201473 |
:1025500088E280934D028DB79EB706960FB6F89429 |
:102560009EBF0FBE8DBF80910402909105029F9384 |
:102570008F9386E693E09F938F93FF92EF920E9452 |
:1025800020148CE380934D028DB79EB706960FB64C |
:10259000F8949EBF0FBE8DBF8091020290910302FE |
:1025A0009F938F9382E793E09F938F93FF92EF9295 |
:1025B0000E9420148DB79EB706960FB6F8949EBF62 |
:1025C0000FBE8DBF8091050199278130910509F4D7 |
:1025D000B4C0823091050CF4A3C0029709F4B3C0D3 |
:1025E00084E380934D0287E893E09F938F93FF925B |
:1025F000EF920E9420140F900F900F900F90B5C093 |
:1026000010924D028BE893E09F938F93C5EBD1E13D |
:10261000FF92EF920E94201484E180934D020F906C |
:102620000F900F900F908091F00199279F938F93B7 |
:1026300089E993E09F938F93FF92EF920E94201479 |
:102640008DB79EB706960FB6F8949EBF0FBE8DBF8E |
:102650008091F00199278330910509F45BC08430A3 |
:102660009105CCF18430910509F473C0059709F404 |
:1026700076C088E280934D0284EA93E09F938F9323 |
:10268000FF92EF920E9420140F900F900F900F90E6 |
:102690008091F0018823C1F589E480934D0280EE9A |
:1026A00093E09F938F93FF92EF920E9420140F90DC |
:1026B0000F900F900F9003FF05C08091F1018F5F85 |
:1026C0008093F1018091F001853010F402FF4DC03C |
:1026D0001092F1014AC081309105E1F0029749F66C |
:1026E00088E280934D0281EB93E09F938F93DF9379 |
:1026F000CF93C8CF88E280934D0282E193E09F930D |
:102700008F93FF92EF92F7CE85E480934D0288EE8F |
:1027100093E0C7CF88E280934D0289EA93E0AECF81 |
:10272000892B09F05DCF84E380934D028AE793E023 |
:102730009F938F93DF93CF935CCF84E380934D027D |
:102740008EE793E0F5CF84E380934D0283E893E036 |
:10275000EFCF88E280934D0284EC93E0C6CF88E20D |
:1027600080934D0285ED93E0C0CFDF91CF911F9113 |
:102770000F91FF90EF900895EF92FF920F931F93A8 |
:10278000CF93DF937C018B01EA01452B71F0F801B7 |
:1027900081918F01F7010995219739F0F801819115 |
:1027A0008F01F7010995219791F7DF91CF911F9143 |
:1027B0000F91FF90EF900895EF92FF920F931F9368 |
:1027C000CF93DF937C018B01EA01452B81F0F80167 |
:1027D0000F5F1F4F8491F7010995219741F0F80190 |
:1027E0000F5F1F4F8491F7010995219781F7DF91C2 |
:1027F000CF911F910F91FF90EF9008950F931F932A |
:10280000CF938C01C62F161634F480E2F801099597 |
:10281000C1501C16D4F3CF911F910F9108950F93BF |
:102820001F93CF938C01C62F161634F480E3F80162 |
:102830000995C1501C16D4F3CF911F910F910895A3 |
:102840002F923F924F925F926F927F928F929F92C0 |
:10285000AF92BF92CF92DF92EF92FF920F931F93AE |
:10286000CF93DF93CDB7DEB7E0970FB6F894DEBF16 |
:102870000FBECDBF88249924540149E4C42ED12C25 |
:10288000CC0EDD1E2996EEACFFAC2997B701F701FF |
:102890001491112331F0153221F00894E11CF11C40 |
:1028A000F6CFA701461B570B09F095C0112309F479 |
:1028B0005DC20894E11CF11C1FA63FA4232C0FEF5E |
:1028C00039A6F7010894E11CF11C14911537C9F1E0 |
:1028D000812F80628837A9F1103209F440C0133289 |
:1028E00009F491C01A3209F47DC01D3209F47AC08E |
:1028F0001B32C9F11E32C9F1103309F48EC0812F89 |
:102900008153893008F082C040E050E0CA01880F4E |
:10291000991F880F991F880F991F840F951F480FC3 |
:10292000591F410F511D40535040F7010894E11CBD |
:10293000F11C1491812F80538A3040F3242E1537D7 |
:1029400039F630FE3DC0F60184E090E0C80ED91E95 |
:1029500080809180A280B380103209F0C0CF89A519 |
:10296000882309F0AECF19A7ACCFF7010894E11C7A |
:10297000F11C14911A3209F455C040E050E014C023 |
:10298000CA01880F991F880F991F880F991F840FFC |
:10299000951F480F591F410F511D40535040F701DB |
:1029A0000894E11CF11C1491812F80538A3040F36C |
:1029B000EFEF4F3F5E0714F44FEF5FEF042F86CF2A |
:1029C000F60182E090E0C80ED91E808191814C0111 |
:1029D000AA24BB2481CF27968EAD9FAD27970E9456 |
:1029E000DC1364CF1A3251F4F60182E090E0C80E95 |
:1029F000D91E208022200CF064CF219490E1392A46 |
:102A0000EFED3E225ECF98E0392A5BCF1836C9F051 |
:102A10001C36D1F481E0382A54CF34FC52CFF0E296 |
:102A20003F2A4FCFF60182E090E0C80ED91E4081C8 |
:102A300051819FEF4F3F590714F44FEF5FEF042F81 |
:102A400040CF24E0322A3DCF133609F459C1143463 |
:102A500009F42BC1143609F428C1193609F425C12B |
:102A60001F3409F41BC11F3609F418C1103709F4CB |
:102A700005C1133709F4BEC0153509F4F8C0153780 |
:102A800009F4F5C0183509F450C0183709F44DC0E1 |
:102A9000112309F46BC1CE0101969DA78CA7198360 |
:102AA00081E0482E19A6632C7724042D5FA45418C6 |
:102AB00057FC39C029A5222391F10F5F050DC301F1 |
:102AC00080739070892B09F446C1222309F03DC11F |
:102AD00066FC2CC1C30180739070809709F41CC1FF |
:102AE000652D27968EAD9FAD27970E940F14842DDC |
:102AF000992787FD9095AC016CA57DA527968EAD95 |
:102B00009FAD27970E94BC1364FEC0CE201A622D91 |
:102B100027968EAD9FAD27970E94FE13B7CE66FE17 |
:102B2000CDCF0E5FCBCF5524C5CFE0E1EEA733FE6E |
:102B300007C081149104A104B10411F0F0E43F2A0C |
:102B400019A60FA707FD02C02FED3222CE018996EC |
:102B50009DA78CA781149104A104B10419F49FA529 |
:102B6000992361F1EEA54E2E55246624772418AAE8 |
:102B700084149504A604B70410F0F1E0F8ABC50185 |
:102B8000B401A30192010E94E319DC01CB01082FDB |
:102B90008A30F0F4005DECA5FDA50293FDA7ECA73B |
:102BA000C501B401A30192010E94E31949015A0130 |
:102BB000F8A9FF23E1F62EA5283079F0632C7724BD |
:102BC000CE010196482EFCA54F1A28E2420E6DCF89 |
:102BD000095A183501F70F7DDECF632C772463FE89 |
:102BE000EFCF003369F380E3ECA5FDA58293FDA749 |
:102BF000ECA7E6CFF60182E090E0C80ED91E019066 |
:102C0000F081E02DFDA7ECA7EF2B81F4FE013196BA |
:102C1000FDA7ECA788E289838EE6818385E78B8315 |
:102C20008CE68C838D8389E28E831F8207FD15C01D |
:102C3000802F992787FD9095AC0160E070E08CA50E |
:102C40009DA50E94DC16009731F0482EFCA54F1A76 |
:102C500004150CF027CF402E25CFECA5FDA5019043 |
:102C60000020E9F731974E2E2CA5421A1BCF1535BF |
:102C700011F481E0382A9AE09EA762CFF60182E043 |
:102C800090E0C80ED91E808191814C01AA24BB24FA |
:102C900090E19EA7E0E43E2A18E752CF1F3411F4DA |
:102CA000E1E03E2AF8E0FEA74BCF143411F491E0A6 |
:102CB000392A30FE18C0F60184E090E0C80ED91E13 |
:102CC00080809180A280B380B7FE0AC0B094A094A7 |
:102CD00090948094811C911CA11CB11C8DE289A749 |
:102CE0009AE09EA72ECFF60182E090E0C80ED91E92 |
:102CF000808191814C01AA2497FCA094BA2CE4CF46 |
:102D0000FE013196FDA7ECA7F60182E090E0C80E27 |
:102D1000D91E80818983C4CE822D801B682F27967F |
:102D20008EAD9FAD27970E940F14DACE80E38AA75D |
:102D30001BA742E050E0BE01665D7F4F27968EAD37 |
:102D40009FAD27970E94BC13C5CE41E050E0BE0165 |
:102D5000675D7F4FF3CF822D801B682F27968EAD46 |
:102D60009FAD27970E94FE1329A5AFCEE0960FB620 |
:102D7000F894DEBF0FBECDBFDF91CF911F910F91B1 |
:102D8000FF90EF90DF90CF90BF90AF909F908F908B |
:102D90007F906F905F904F903F902F900895FB0130 |
:102DA000DC0140FF05C002C005900D9205900D9218 |
:102DB00042505040C8F70895FC014150504030F057 |
:102DC00001900616D1F73197CF01089588279927EA |
:102DD00008955058192EA4D101D054C1BA176207D2 |
:102DE000730784079507B1F188F40EF410940B2E45 |
:102DF000BA2FA02D062E622F202D072E732F302DD7 |
:102E0000082E842F402D092E952F502DFF27552356 |
:102E1000B9F0591B49F0573E98F0469537952795DC |
:102E2000A795F0405395C9F776F0BA0F621F731F4C |
:102E3000841F30F4879577956795B795F040939503 |
:102E400017FA0F2E0895BF1BBB27BA0B620B730B2B |
:102E5000840BF6CFDEF690C1AA2797FDA160AF9351 |
:102E60009F775FE340E8613071058407950720F0A4 |
:102E70000E945A18AF9108959F938F937F936F93F9 |
:102E8000E8E6F0E00E945D182F913F914F915F912D |
:102E90009F938F937F936F939FE380E877276627B5 |
:102EA00050680E94EA160E9449192F913F914F9154 |
:102EB0005F910E94EE185FE349EC3FE02BED9068D4 |
:102EC0000E94EA16AF91A0FD90680895552319F06D |
:102ED000992351F018C09923A1F097FB6BED7FE087 |
:102EE00089EC9FE397F90895552359F02AF46BED87 |
:102EF0007FE089E490E4089566277727882799275B |
:102F000008950C945A181F93112797FD116057FDCF |
:102F100012600E949F170E948B1911FF08C02BEDB1 |
:102F20003FE049E450E410FD50680E94EA161F910A |
:102F3000089550E449EC3FE02BED6ED080C0F0D016 |
:102F400001D0A0C0552359F0992369F09F575F57CE |
:102F5000951B33F442F4903811F4915805C0AAC07F |
:102F600091589F3F09F408C1BB27112462177307CA |
:102F7000840730F4660F771F881FBB1F915098F3AA |
:102F800011D00F920FD00F920DD0A0E8261737075F |
:102F900048071B0609F0A048BA2F602D7F918F913A |
:102FA00000240895A0E80024621773078407B10580 |
:102FB00028F0621B730B840BB1090A2A660F771F76 |
:102FC000881FBB1FA69581F7089597FBB5D09F3743 |
:102FD00038F0FEE9F91B982F872F762F6B2F05C04D |
:102FE000C8C09695879577956795F150D0F73EF4D0 |
:102FF00090958095709561957F4F8F4F9F4F089565 |
:10300000E89403C097FB0EF4F3DFB62F672F782FF9 |
:10301000892F9EE9002436C05F77552319F4442395 |
:103020000AF048C02F933F934F935F9388DF552753 |
:103030004427A4D05F914F913F912F91CFC01F9310 |
:103040009F7750EC49E43FE02BEDC4DE10E89F771A |
:103050005FE349EC3FE02BED6217730784079507A8 |
:1030600020F050EC49E4B6DE112751D19068EAE82F |
:10307000F0E023D091271F9108959A95BB0F661F0A |
:10308000771F881F11249923A1F08823B2F79F3F4F |
:1030900059F0BB0F48F421F4002011F460FF04C084 |
:1030A0006F5F7F4F8F4F9F4F881F9795879597F939 |
:1030B00008955FC09FEF80EC0895FF92EF92DF923A |
:1030C000CF92BF926B017C01B59016D0B590BB201A |
:1030D00069F09F938F937F936F93B601C7010CD0D4 |
:1030E0002F913F914F915F910E949F17BF90CF907A |
:1030F000DF90EF90FF9008953DD102C09601A701A7 |
:10310000EF93FF930E94EE18FF91EF9133D1EF936D |
:10311000FF930E94EA16FF91EF91BA9479F7089510 |
:10312000052E092607FA440F551F5F3F79F0AA279D |
:10313000A51708F051E04795880F991F9F3F31F080 |
:10314000BB27B91708F091E0879508959F919F914B |
:103150001124B0CF97FB880F991F9F3F31F0BB27F9 |
:10316000B91708F091E0879508959F919F911124D8 |
:10317000A1CF66277727882799270895EBDFCF937C |
:10318000DF93D52FC42F5527442733272227992390 |
:10319000D9F09F37C8F0F92F75DF592F482F372FF7 |
:1031A000262FF63968F411DF2DDFC030CD0721F06E |
:1031B00069937993899399939058DF91CF910ACE2F |
:1031C0009927882777276627C030CD0721F02993D4 |
:1031D000399349935993DF91CF9154CFA1DF01D017 |
:1031E00051CF992339F0552329F09F575F57950FF9 |
:1031F00013F49AF1C1CF91589F3FE1F3629FA12D43 |
:103200000F92BB27639FA00DB11DEE27729FA00DEB |
:10321000B11DEE1FAF93AA27649FB00DE11D739FF0 |
:10322000B00DE11DAA1F6627829FB00DE11DA61FEC |
:103230005527749FE00DA11D551F839FE00DA11D13 |
:10324000561F849FA00D511D852F7A2F6E2F1F9022 |
:103250000F9088231AF4939539F42CCF000C111C8D |
:10326000BB1F661F771F881F012808959F939F77B4 |
:10327000993358F050E449EC3FE02BEDCDDE5FEBA5 |
:1032800049EC3FE02BEDA6DDDADE5F915078952723 |
:10329000089597FD0FCF992309F40895482F5ADF19 |
:1032A000F92FFF57F5959F1B9F1BFF93EBDEFF92B6 |
:1032B000EF92DF92CF92BF92AF929F928F926B016B |
:1032C0007C01405847953327222740685FE3B601C9 |
:1032D000C70149015A010E949F179401A5010E944C |
:1032E000EA164FEF5FEF53D09B01AC0182169306B5 |
:1032F000A406B50661F78F909F90AF90BF90CF90D6 |
:10330000DF90EF90FF905F9125DF950FBBCE9B0183 |
:10331000AC010C94EE181F930F930027192F10780F |
:103320009F775FE340E8613071058407950718F0E7 |
:1033300000680E94BF19912B6F937F938F939F9387 |
:103340000E948719E0EBF0E0B8DE5F914F913F916A |
:103350002F910E94EE18002351F02BED3FE049EC35 |
:103360005FE300E8902717FD50680E94EA160F916E |
:103370001F910895559145913591259108959B018F |
:10338000AC019FE380E8772766270C949F17E2DE65 |
:10339000992359F0AA27940FA51F43F032F04FEF5D |
:1033A00050E09417A50714F46DCEE3CE0EF006C0DE |
:1033B00000C09FEF80E870E060E008959FE780E83C |
:1033C00070E060E00895A1E21A2EAA1BBB1BFD016C |
:1033D0000DC0AA1FBB1FEE1FFF1FA217B307E407F4 |
:1033E000F50720F0A21BB30BE40BF50B661F771F4C |
:1033F000881F991F1A9469F760957095809590952C |
:103400009B01AC01BD01CF01089597FB092E052654 |
:103410000ED057FD04D0D7DF0AD0001C38F45095E9 |
:103420004095309521953F4F4F4F5F4F0895F6F7E8 |
:1034300090958095709561957F4F8F4F9F4F089520 |
:1034400009D001921A94E1F7089501900BD01A94D3 |
:10345000E1F70895F999FECFB2BDA1BDF89A119692 |
:1034600000B40895F999FECFB2BDA1BD00BC11967C |
:0C3470000FB6F894FA9AF99A0FBE08956E |
:10347C00B400FFFF01020A0D7468652075736520A6 |
:10348C006F66207468697320736F667477617265F8 |
:10349C00206973206F6E6C79207065726D6974741D |
:1034AC0065640A0D6F6E206F726967696E616C20BE |
:1034BC004D696B726F4B6F707465722D48617264DD |
:1034CC0077617265000A0D7777772E4D696B726F95 |
:1034DC004B6F707465722E646520286329204869CF |
:1034EC0053797374656D7320476D62480A0A000D39 |
:1034FC000D4143432070726573656E740032008811 |
:10350C00130148656C6C6F20576F726C640000007F |
:10351C00000000000000000000000000000000009F |
:10352C00000000000000000000000000000000008F |
:10353C00000000000000000000000000000000007F |
:10354C00000000000000000000000000000000006F |
:04355C000000020069 |
:00000001FF |
/tags/V0.23a/License.txt |
---|
0,0 → 1,59 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
/tags/V0.23a/analog.c |
---|
0,0 → 1,120 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <util/delay.h> |
#include "analog.h" |
uint8_t AccPresent = 0; |
void ADC_Init(void) |
{ |
// The analog inputs have a VREF of 5V and a resolution of 10 bit (0...1024 counts) |
// i.e. 4.88mV/Count |
// set PortC 0,1,2,3 as input |
DDRC &= ~((1<<DDC3)|(1<<DDC2)|(1<<DDC1)|(1<<DDC0)); |
// set PortC 0,1,2,3 as tri state |
PORTC &= ~((1<<PORTC3)|(1<<PORTC2)|(1<<PORTC1)|(1<<PORTC0)); |
// port PD5 and PD6 control the current direction of the test coils of the sensors |
DDRD |= ((1<<DDD5)|(1<<DDD6)); |
FLIP_LOW; |
// disable internal reference voltage and right adjust bits in ADCW |
ADMUX = 0x00; |
// clear start conversion bit (ADSC = 0) |
// disable ADC Auto Trigger Enable (ADATE = 0) |
// disable interrupt (ADIE = 0) |
ADCSRA &= ~((1<<ADSC)|(1<<ADATE)|(1<<ADIE)); |
// Enable ADC (ADEN = 1) with SYSCLK/128 (ADPS2 = 1, ADPS1 = 1, ADPS0 = 1) and clear ready flag (ADIF = 1) |
ADCSRA |= ((1<<ADEN)|(1<<ADIF)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0)); |
ADMUX = 0x00; // select ADC0 |
ADCSRA |= (1<<ADSC); // start conversion |
// Check if acceleration sensor is present |
// The output of the LIS3L02AL (MK3MAG V1.0) and the LIS344ALH (MK3MAG V1.1) is Vdd/5 +/- 10% per 1g. |
// The Vdd is 3.0V at this board therefore the sensitivity is 0.6V/g +/-10% that corresponds to 123 counts. |
// The offsets at 0g is VDD/2 (1.5V) that is 307 counts. |
// that yields to an ADC range of 184 to 430 counts. |
// pullup PC2(AccX) and PC3 (AccY) |
PORTC |= ((1<<PORTC3)|(1<<PORTC2)); |
_delay_ms(10.0); |
// if ADC2 and ADC 3 is larger than 1000 counts (4.88V) no load is at the pins |
if((ADC_GetValue(ADC2) > 1000) && (ADC_GetValue(ADC3) > 1000)) AccPresent = 0; |
else AccPresent = 1; |
// set port back to tristate |
PORTC &= ~((1<<PORTC3)|(1<<PORTC2)); |
} |
uint16_t ADC_GetValue(ADChannel_t channel) |
{ |
uint16_t value = 0; |
ADMUX = channel; // set muxer bits |
ADCSRA |= (1<<ADIF); // clear ready-flag |
ADCSRA |= (1<<ADSC); // start conversion |
while (((ADCSRA & (1<<ADIF)) == 0)); // wait for end of conversion |
value = ADCW; // read adc result |
return(value); |
} |
/tags/V0.23a/analog.h |
---|
0,0 → 1,39 |
#ifndef _ANALOG_H_ |
#define _ANALOG_H_ |
#include <inttypes.h> |
#include <avr/io.h> |
#define FLIP_HIGH PORTD |= ((1<<PORTD5)|(1<<PORTD6)) |
#define FLIP_LOW PORTD &= ~((1<<PORTD5)|(1<<PORTD6)) |
typedef enum |
{ |
ADC0 = 0, |
ADC1 = 1, |
ADC2 = 2, |
ADC3 = 3, |
ADC4 = 4, |
ADC5 = 5, |
ADC6 = 6, |
ADC7 = 7, |
REF1V1 = 14, |
AGND = 15 |
} ADChannel_t; |
#define MAG_X ADC0 |
#define MAG_Y ADC1 |
#define MAG_Z ADC7 |
#define ACC_X ADC2 |
#define ACC_Y ADC3 |
#define ACC_Z ADC6 |
extern uint8_t AccPresent; |
void ADC_Init(void); |
uint16_t ADC_GetValue(ADChannel_t channel); |
#endif // _ANALOG_H_ |
/tags/V0.23a/led.c |
---|
0,0 → 1,73 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "led.h" |
void LED_Init(void) |
{ |
// Set PD7 as output |
DDRD |= (1<<DDD7); |
// set port pon to GND |
PORTD &= ~((1<<PORTD7)); |
} |
/tags/V0.23a/led.h |
---|
0,0 → 1,12 |
#ifndef _LED_H_ |
#define _LED_H_ |
#include <avr/io.h> |
#define LED_GRN_ON PORTD |= (1<<PORTD7) |
#define LED_GRN_OFF PORTD &= ~(1<<PORTD7) |
#define LED_GRN_TOGGLE PORTD ^= (1<<PORTD7) |
void LED_Init(void); |
#endif //_LED_H_ |
/tags/V0.23a/main.c |
---|
0,0 → 1,572 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <avr/interrupt.h> |
#include <math.h> |
#include <stdlib.h> |
#include <stdio.h> |
#include "main.h" |
#include "timer0.h" |
#include "twislave.h" |
#include "led.h" |
#include "analog.h" |
#include "uart.h" |
#define CALIBRATION_VERSION 1 |
AttitudeSource_t AttitudeSource = ATTITUDE_SOURCE_ACC; |
Orientation_t Orientation = ORIENTATION_FC; |
uint16_t Led_Timer = 0; |
typedef struct |
{ |
int16_t Range; |
int16_t Offset; |
} Scaling_t; |
typedef struct |
{ |
Scaling_t MagX; |
Scaling_t MagY; |
Scaling_t MagZ; |
Scaling_t AccX; |
Scaling_t AccY; |
Scaling_t AccZ; |
uint8_t Version; |
} Calibration_t; |
Calibration_t eeCalibration EEMEM; // calibration data in EEProm |
Calibration_t Calibration; // calibration data in RAM |
// magnet sensor variable |
int16_t RawMagnet1a, RawMagnet1b; // raw magnet sensor data |
int16_t RawMagnet2a, RawMagnet2b; |
int16_t RawMagnet3a, RawMagnet3b; |
int16_t UncalMagX, UncalMagY, UncalMagZ; // sensor signal difference without Scaling |
int16_t MagX = 0, MagY = 0, MagZ = 0; // rescaled magnetic field readings |
// acceleration sensor variables |
int16_t RawAccX = 0, RawAccY = 0, RawAccZ = 0; // raw acceleration readings |
int16_t AccX = 0, AccY = 0, AccZ = 0; // rescaled acceleration readings |
int16_t AccAttitudeNick = 0, AccAttitudeRoll = 0; // nick and roll angle from acc |
int16_t Heading = -1; // the current compass heading in deg |
int16_t ZeroHeading = 180; |
uint8_t InternalCalstate = 0, ActualCalstate = 0; |
int8_t PotiToFC[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; |
void CalcFields(void) |
{ |
UncalMagX = (RawMagnet1a - RawMagnet1b); |
UncalMagY = (RawMagnet3a - RawMagnet3b); |
UncalMagZ = (RawMagnet2a - RawMagnet2b); |
if(Calibration.MagX.Range != 0) MagX = (1024L * (int32_t)(UncalMagX - Calibration.MagX.Offset)) / (Calibration.MagX.Range); |
else MagX = 0; |
if(Calibration.MagY.Range != 0) MagY = (1024L * (int32_t)(UncalMagY - Calibration.MagY.Offset)) / (Calibration.MagY.Range); |
else MagY = 0; |
if(Calibration.MagY.Range != 0) MagZ = (1024L * (int32_t)(UncalMagZ - Calibration.MagZ.Offset)) / (Calibration.MagZ.Range); |
else MagZ = 0; |
if(AttitudeSource == ATTITUDE_SOURCE_ACC) |
{ |
AccX = (RawAccX - Calibration.AccX.Offset); |
AccY = (RawAccY - Calibration.AccY.Offset); |
AccZ = (Calibration.AccZ.Offset - RawAccZ); |
#if (BOARD == 10) // the hardware 1.0 has the LIS3L02AL |
// acc mode assumes orientation like FC |
if(AccX > 136) AccAttitudeNick = -800; |
else |
if(AccX < -136) AccAttitudeNick = 800; |
else AccAttitudeNick = (int16_t)(-1800.0 * asin((double) AccX / 138.0) / M_PI); |
if(AccY > 136) AccAttitudeRoll = 800; |
else |
if(AccY < -136) AccAttitudeRoll = -800; |
else AccAttitudeRoll = (int16_t)( 1800.0 * asin((double) AccY / 138.0) / M_PI); |
#else // the hardware 1.1 has the LIS344ALH with a different axis definition (X -> -Y, Y -> X, Z -> Z) |
// acc mode assumes orientation like FC |
if(AccY > 136) AccAttitudeNick = 800; |
else |
if(AccY < -136) AccAttitudeNick = -800; |
else AccAttitudeNick = (int16_t)( 1800.0 * asin((double) AccY / 138.0) / M_PI); |
if(AccX > 136) AccAttitudeRoll = 800; |
else |
if(AccX < -136) AccAttitudeRoll = -800; |
else AccAttitudeRoll = (int16_t)( 1800.0 * asin((double) AccX / 138.0) / M_PI); |
#endif |
} |
} |
void CalcHeading(void) |
{ |
double nick_rad, roll_rad, Cx = 0, Cy = 0, Cz = 0, Hx = 0, Hy = 0; |
int16_t nick, roll; |
int16_t heading = -1; |
// blink code for normal operation |
if(CheckDelay(Led_Timer)) |
{ |
if(Calibration.Version != CALIBRATION_VERSION) LED_GRN_TOGGLE; |
else LED_GRN_ON; |
Led_Timer = SetDelay(150); |
} |
if(Calibration.Version != CALIBRATION_VERSION) heading = -1; // Version of the calibration Data does not match |
else |
{ |
switch(Orientation) |
{ |
case ORIENTATION_NC: |
Cx = (double)MagX; |
Cy = (double)MagY; |
Cz = (double)MagZ; |
break; |
case ORIENTATION_FC: |
// rotation of 90 deg compared to NC setup |
Cx = (double)MagY; |
Cy = -(double)MagX; |
Cz = (double)MagZ; |
break; |
} |
#ifdef HEADTRACKER |
AttitudeSource = ATTITUDE_SOURCE_ACC; |
#endif |
// calculate nick and roll angle in rad |
switch(AttitudeSource) |
{ |
case ATTITUDE_SOURCE_I2C: |
cli(); // stop interrupts |
nick = I2C_WriteAttitude.Nick; |
roll = I2C_WriteAttitude.Roll; |
sei(); // start interrupts |
break; |
case ATTITUDE_SOURCE_UART: |
cli(); // stop interrupts |
nick = ExternData.Attitude[NICK]; |
roll = ExternData.Attitude[ROLL]; |
sei(); // start interrupts |
break; |
case ATTITUDE_SOURCE_ACC: |
nick = AccAttitudeNick; |
roll = AccAttitudeRoll; |
break; |
default: |
nick = 0; |
roll = 0; |
break; |
} |
nick_rad = ((double)nick * M_PI) / 1800.0; |
roll_rad = ((double)roll * M_PI) / 1800.0; |
// calculate attitude correction |
Hx = Cx * cos(nick_rad) - Cz * sin(nick_rad); |
Hy = Cy * cos(roll_rad) + Cz * sin(roll_rad); |
DebugOut.Analog[27] = (int16_t)Hx; |
DebugOut.Analog[28] = (int16_t)Hy; |
// calculate Heading |
heading = (int16_t)((180.0 * atan2(Hy, Hx)) / M_PI); |
// atan2 returns angular range from -180 deg to 180 deg in counter clockwise notation |
// but the compass course is defined in a range from 0 deg to 360 deg clockwise notation. |
if (heading < 0) heading = -heading; |
else heading = 360 - heading; |
} |
// stop interrrupts during heading update to avoid transmitting heading between the update of both bytes of the int16_t |
cli(); // stop interrupts |
if(abs(heading) < 361) Heading = heading; |
else (Heading = -1); |
sei(); // start interrupts |
} |
void Calibrate(void) |
{ |
static uint8_t calold = 0; |
static int16_t Xmin = 0, Xmax = 0, Ymin = 0, Ymax = 0, Zmin = 0, Zmax = 0; |
static uint8_t blinkcount = 0; |
static uint8_t invert_blinking = 0; |
if(ActualCalstate > 5) ActualCalstate = 0; |
// blink code for current calibration state |
if(ActualCalstate) |
{ |
if(CheckDelay(Led_Timer) || (ActualCalstate != calold)) |
{ |
if(blinkcount & 0x01) if(invert_blinking) LED_GRN_ON; else LED_GRN_OFF; |
else if(invert_blinking) LED_GRN_OFF; else LED_GRN_ON; |
// end of blinkcount sequence |
if((blinkcount + 1 ) >= (2 * ActualCalstate)) |
{ |
blinkcount = 0; |
Led_Timer = SetDelay(1500); |
} |
else |
{ |
blinkcount++; |
Led_Timer = SetDelay(100); |
} |
} |
} |
else |
{ |
if(invert_blinking) LED_GRN_ON; else LED_GRN_OFF; |
} |
// calibration state machine |
switch(ActualCalstate) |
{ |
case 1: // 1st step of calibration |
// initialize ranges |
// used to change the orientation of the MK3MAG in the horizontal plane |
Xmin = 10000; |
Xmax = -10000; |
Ymin = 10000; |
Ymax = -10000; |
Zmin = 10000; |
Zmax = -10000; |
Calibration.AccX.Offset = RawAccX; |
Calibration.AccY.Offset = RawAccY; |
Calibration.AccZ.Offset = RawAccZ; |
invert_blinking = 0; |
break; |
case 2: // 2nd step of calibration |
// find Min and Max of the X- and Y-Sensors during rotation in the horizontal plane |
if(UncalMagX < Xmin) Xmin = UncalMagX; |
if(UncalMagX > Xmax) Xmax = UncalMagX; |
if(UncalMagY < Ymin) Ymin = UncalMagY; |
if(UncalMagY > Ymax) Ymax = UncalMagY; |
invert_blinking = 1; |
break; |
case 3: // 3rd step of calibration |
// used to change the orientation of the MK3MAG vertical to the horizontal plane |
invert_blinking = 0; |
break; |
case 4: |
// find Min and Max of the Z-Sensor |
if(UncalMagZ < Zmin) Zmin = UncalMagZ; |
if(UncalMagZ > Zmax) Zmax = UncalMagZ; |
invert_blinking = 1; |
break; |
case 5: |
// Save values |
if(ActualCalstate != calold) // avoid continously writing of eeprom! |
{ |
Calibration.MagX.Range = Xmax - Xmin; |
Calibration.MagX.Offset = (Xmin + Xmax) / 2; |
Calibration.MagY.Range = Ymax - Ymin; |
Calibration.MagY.Offset = (Ymin + Ymax) / 2; |
Calibration.MagZ.Range = Zmax - Zmin; |
Calibration.MagZ.Offset = (Zmin + Zmax) / 2; |
if((Calibration.MagX.Range > 150) && (Calibration.MagY.Range > 150) && (Calibration.MagZ.Range > 150)) |
{ |
Calibration.Version = CALIBRATION_VERSION; |
// indicate write process by setting the led off for 2 seconds |
LED_GRN_OFF; |
eeprom_write_block(&Calibration, &eeCalibration, sizeof(Calibration)); |
Led_Timer = SetDelay(2000); |
// reset blinkcode |
blinkcount = 0; |
} |
else |
{ |
// restore old calibration data from eeprom |
eeprom_read_block(&Calibration, &eeCalibration, sizeof(Calibration)); |
} |
} |
invert_blinking = 0; |
break; |
default: |
break; |
} |
calold = ActualCalstate; |
} |
void SetDebugValues(void) |
{ |
DebugOut.Analog[0] = MagX; |
DebugOut.Analog[1] = MagY; |
DebugOut.Analog[2] = MagZ; |
DebugOut.Analog[3] = UncalMagX; |
DebugOut.Analog[4] = UncalMagY; |
DebugOut.Analog[5] = UncalMagZ; |
switch(AttitudeSource) |
{ |
case ATTITUDE_SOURCE_ACC: |
DebugOut.Analog[6] = AccAttitudeNick; |
DebugOut.Analog[7] = AccAttitudeRoll; |
break; |
case ATTITUDE_SOURCE_UART: |
DebugOut.Analog[6] = ExternData.Attitude[NICK]; |
DebugOut.Analog[7] = ExternData.Attitude[ROLL]; |
break; |
case ATTITUDE_SOURCE_I2C: |
DebugOut.Analog[6] = I2C_WriteAttitude.Nick; |
DebugOut.Analog[7] = I2C_WriteAttitude.Roll; |
break; |
default: |
DebugOut.Analog[6] = -1; |
DebugOut.Analog[7] = -1; |
break; |
} |
DebugOut.Analog[8] = Calibration.MagX.Offset; |
DebugOut.Analog[9] = Calibration.MagX.Range; |
DebugOut.Analog[10] = Calibration.MagY.Offset; |
DebugOut.Analog[11] = Calibration.MagY.Range; |
DebugOut.Analog[12] = Calibration.MagZ.Offset; |
DebugOut.Analog[13] = Calibration.MagZ.Range; |
DebugOut.Analog[14] = ActualCalstate; |
DebugOut.Analog[15] = Heading; |
DebugOut.Analog[16] = 0; |
DebugOut.Analog[17] = 0; |
DebugOut.Analog[18] = AccX; |
DebugOut.Analog[19] = AccY; |
DebugOut.Analog[20] = AccZ; |
DebugOut.Analog[21] = RawAccX; |
DebugOut.Analog[22] = RawAccY; |
DebugOut.Analog[23] = RawAccZ; |
DebugOut.Analog[24] = PotiToFC[0]; |
DebugOut.Analog[25] = PotiToFC[1]; |
DebugOut.Analog[26] = PotiToFC[2]; |
DebugOut.Analog[29] = AttitudeSource; |
} |
void AccMeasurement(void) |
{ |
if(AccPresent) |
{ |
RawAccX = (RawAccX + (int16_t)ADC_GetValue(ACC_X))/2; |
RawAccY = (RawAccY + (int16_t)ADC_GetValue(ACC_Y))/2; |
RawAccZ = (RawAccZ + (int16_t)ADC_GetValue(ACC_Z))/2; |
} |
else |
{ |
RawAccX = 0; |
RawAccY = 0; |
RawAccZ = 0; |
} |
} |
#ifdef HEADTRACKER |
void CalcFcPotis(void) |
{ |
int16_t tmp0, tmp1, tmp2; |
if(AccPresent) |
{ |
tmp0 = AccAttitudeNick/4; |
tmp1 = AccAttitudeRoll/4; |
tmp2 = (360 + Heading - ZeroHeading) % 360; |
tmp2 -= 180; |
tmp2 *= 2; |
if(tmp0 > 127) tmp0 = 127; else if(tmp0 < -127) tmp0 = -127; |
if(tmp1 > 127) tmp1 = 127; else if(tmp1 < -127) tmp1 = -127; |
if(tmp2 > 127) tmp2 = 127; else if(tmp2 < -127) tmp2 = -127; |
PotiToFC[0] = (PotiToFC[0] + tmp0) / 2; |
PotiToFC[1] = (PotiToFC[1] + tmp1) / 2; |
PotiToFC[2] = (PotiToFC[2] + tmp2) / 2; |
} |
} |
#endif |
int main (void) |
{ |
static uint8_t state = 0; |
static uint16_t statetimer; |
// reset input pullup |
DDRC &=~((1<<DDC6)); |
PORTC |= (1<<PORTC6); |
LED_Init(); |
TIMER0_Init(); |
USART0_Init(); |
ADC_Init(); |
I2C_Init(); |
sei(); // enable globale interrupts |
USART0_Print("\n\rthe use of this software is only permitted\n\ron original MikroKopter-Hardware"); |
USART0_Print("\n\rwww.MikroKopter.de (c) HiSystems GmbH\n\n"); |
#ifdef HEADTRACKER |
USART0_Print("\n\rHead-Tracker"); |
#endif |
if(AccPresent) |
{ |
USART0_Print("\r\rACC present"); |
} |
#ifdef HEADTRACKER |
else USART0_Print("\n\rERROR: NO ACC"); |
#endif |
LED_GRN_ON; |
Led_Timer = SetDelay(200); |
// read calibration info from eeprom |
eeprom_read_block(&Calibration, &eeCalibration, sizeof(Calibration)); |
InternalCalstate = 0; |
ExternData.CalState = 0; |
I2C_WriteCal.CalByte = 0; |
ActualCalstate = 0; |
statetimer = SetDelay(0); |
// main loop |
while (1) |
{ |
switch(state) |
{ |
case 0: |
if(CheckDelay(statetimer)) |
{ |
FLIP_LOW; |
statetimer = SetDelay(2); |
state = 1; |
} |
break; |
case 1: |
if(CheckDelay(statetimer)) |
{ |
RawMagnet1a = ADC_GetValue(MAG_X); |
RawMagnet2a = -ADC_GetValue(MAG_Y); |
RawMagnet3a = ADC_GetValue(MAG_Z); |
AccMeasurement(); |
statetimer = SetDelay(1); |
state = 2; |
} |
break; |
case 2: |
if(CheckDelay(statetimer)) |
{ |
FLIP_HIGH; |
statetimer = SetDelay(2); |
state = 3; |
} |
break; |
case 3: |
if(CheckDelay(statetimer)) |
{ |
RawMagnet1b = ADC_GetValue(MAG_X); |
RawMagnet2b = -ADC_GetValue(MAG_Y); |
RawMagnet3b = ADC_GetValue(MAG_Z); |
AccMeasurement(); |
statetimer = SetDelay(1); |
state = 0; |
CalcFields(); |
// check both sources of communication for calibration request |
if(InternalCalstate) ActualCalstate = InternalCalstate; |
else |
if(I2C_WriteCal.CalByte) ActualCalstate = I2C_WriteCal.CalByte; |
else ActualCalstate = ExternData.CalState; |
if(ActualCalstate) Calibrate(); |
else CalcHeading(); |
if(NC_Connected) NC_Connected--; |
if(FC_Connected) FC_Connected--; |
if(PC_Connected) PC_Connected--; |
// fall back to attitude estimation from onboard acc sensor if NC or FC does'nt send attitude data |
#ifdef HEADTRACKER |
CalcFcPotis(); |
if(AccPresent) AttitudeSource = ATTITUDE_SOURCE_ACC; |
#else |
if(!FC_Connected && ! NC_Connected) |
{ |
if(AccPresent) AttitudeSource = ATTITUDE_SOURCE_ACC; |
else AttitudeSource = ATTITUDE_SOURCE_NONE; |
Orientation = ORIENTATION_FC; |
} |
#endif |
} |
break; |
default: // should never happen |
statetimer = SetDelay(0); |
state = 0; |
break; |
} // one full state cylce is 6 ms |
// check data from USART |
USART0_ProcessRxData(); |
#ifdef HEADTRACKER |
USART0_TransmitTxData(); |
#else |
if(PC_Connected) |
{ |
USART0_EnableTXD(); |
USART0_TransmitTxData(); |
} |
else |
{ |
USART0_DisableTXD(); |
} |
#endif |
} // while(1) |
} |
/tags/V0.23a/main.h |
---|
0,0 → 1,36 |
#ifndef _MAIN_H_ |
#define _MAIN_H_ |
#include <avr/eeprom.h> |
#include <inttypes.h> |
typedef enum |
{ |
ATTITUDE_SOURCE_I2C = 0, |
ATTITUDE_SOURCE_UART = 1, |
ATTITUDE_SOURCE_ACC = 2, |
ATTITUDE_SOURCE_NONE = 3 |
} AttitudeSource_t; |
typedef enum |
{ |
ORIENTATION_NC = 0, |
ORIENTATION_FC = 1 |
} Orientation_t; |
extern int16_t Heading; |
extern AttitudeSource_t AttitudeSource; |
extern Orientation_t Orientation; |
extern uint8_t InternalCalstate, ActualCalstate; |
extern int16_t MagX, MagY, MagZ; |
extern int8_t PotiToFC[12]; |
void SetDebugValues(void); |
#endif //_MAIN_H_ |
/tags/V0.23a/makefile |
---|
0,0 → 1,429 |
#-------------------------------------------------------------------- |
# MCU name |
MCU = atmega168 |
F_CPU = 8000000 |
#------------------------------------------------------------------- |
#BOARD = 10 |
BOARD = 11 |
#OPTION = HEADTRACKER |
VERSION_MAJOR = 0 |
VERSION_MINOR = 23 |
VERSION_PATCH = 0 |
VERSION_SERIAL_MAJOR = 11 # Serial Protocol Major Version |
VERSION_SERIAL_MINOR = 0 # Serial Protocol Minor Version |
NC_I2C_COMPATIBLE = 3 # I2C Protocol Version |
#------------------------------------------------------------------- |
# get SVN revision |
REV := $(shell sh -c "cat .svn/entries | sed -n '4p'") |
# Output format. (can be srec, ihex, binary) |
FORMAT = ihex |
# Target file name (without extension). |
ifeq ($(VERSION_PATCH), 0) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)a_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 1) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)b_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 2) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)c_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 3) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)d_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 4) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)e_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 5) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)f_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 6) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)g_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 7) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)h_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 8) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)i_SVN$(REV) |
endif |
ifeq ($(VERSION_PATCH), 9) |
TARGET = MK3Mag_MEGA168_V$(VERSION_MAJOR)_$(VERSION_MINOR)j_SVN$(REV) |
endif |
# Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. |
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
OPT = s |
########################################################################################################## |
# List C source files here. (C dependencies are automatically generated.) |
SRC = main.c uart.c timer0.c analog.c twislave.c led.c menu.c printf_P.c |
########################################################################################################## |
# List Assembler source files here. |
# Make them always end in a capital .S. Files ending in a lowercase .s |
# will not be considered source files but generated files (assembler |
# output from the compiler), and will be deleted upon "make clean"! |
# Even though the DOS/Win* filesystem matches both .s and .S the same, |
# it will preserve the spelling of the filenames, and gcc itself does |
# care about how the name is spelled on its command-line. |
ASRC = |
# List any extra directories to look for include files here. |
# Each directory must be seperated by a space. |
EXTRAINCDIRS = |
CDEFS = -DF_CPU=$(F_CPU)UL |
# Optional compiler flags. |
# -g: generate debugging information (for GDB, or for COFF conversion) |
# -O*: optimization level |
# -f...: tuning, see gcc manual and avr-libc documentation |
# -Wall...: warning level |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create assembler listing |
CFLAGS = -O$(OPT) \ |
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ |
-Wall -Wstrict-prototypes \ |
-Wa,-adhlns=$(<:.c=.lst) \ |
$(patsubst %,-I%,$(EXTRAINCDIRS)) |
# Set a "language standard" compiler flag. |
# Unremark just one line below to set the language standard to use. |
# gnu99 = C99 + GNU extensions. See GCC manual for more information. |
#CFLAGS += -std=c89 |
#CFLAGS += -std=gnu89 |
#CFLAGS += -std=c99 |
CFLAGS += -std=gnu99 |
CFLAGS += $(CDEFS) |
# shrink code size |
CFLAGS += -mtiny-stack |
#CFLAGS += -fno-inline-functions |
CFLAGS += -mcall-prologues |
CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_PATCH=$(VERSION_PATCH) -DVERSION_SERIAL_MAJOR=$(VERSION_SERIAL_MAJOR) -DVERSION_SERIAL_MINOR=$(VERSION_SERIAL_MINOR) -DBOARD=$(BOARD) -DNC_I2C_COMPATIBLE=$(NC_I2C_COMPATIBLE) |
ifeq ($(OPTION), HEADTRACKER) |
CFLAGS += -DHEADTRACKER |
endif |
# Optional assembler flags. |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create listing |
# -gstabs: have the assembler create line number information; note that |
# for use in COFF files, additional information about filenames |
# and function names needs to be present in the assembler source |
# files -- see avr-libc docs [FIXME: not yet described there] |
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
# Optional linker flags. |
# -Wl,...: tell GCC to pass this to linker. |
# -Map: create map file |
# --cref: add cross reference to map file |
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref |
# Additional libraries |
# Minimalistic printf version |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_min |
# Floating point printf version (requires -lm below) |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt |
# -lm = math library |
LDFLAGS += -lm |
# Programming support using avrdude. Settings and variables. |
# Programming hardware: alf avr910 avrisp bascom bsd |
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 |
# |
# Type: avrdude -c ? |
# to get a full listing. |
# |
AVRDUDE_PROGRAMMER = dt006 |
#AVRDUDE_PROGRAMMER = stk200 |
#AVRDUDE_PORT = com1 # programmer connected to serial device |
AVRDUDE_PORT = lpt1 # programmer connected to parallel port |
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex |
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
AVRDUDE_FLAGS = -F -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) |
# Uncomment the following if you want avrdude's erase cycle counter. |
# Note that this counter needs to be initialized first using -Yn, |
# see avrdude manual. |
#AVRDUDE_ERASE += -y |
# Uncomment the following if you do /not/ wish a verification to be |
# performed after programming the device. |
#AVRDUDE_FLAGS += -V -E noreset |
# Increase verbosity level. Please use this when submitting bug |
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> |
# to submit bug reports. |
#AVRDUDE_FLAGS += -v -v |
# --------------------------------------------------------------------------- |
# Define directories, if needed. |
DIRAVR = c:/winavr |
DIRAVRBIN = $(DIRAVR)/bin |
DIRAVRUTILS = $(DIRAVR)/utils/bin |
DIRINC = . |
DIRLIB = $(DIRAVR)/avr/lib |
# Define programs and commands. |
SHELL = sh |
CC = avr-gcc |
OBJCOPY = avr-objcopy |
OBJDUMP = avr-objdump |
SIZE = avr-size |
# Programming support using avrdude. |
AVRDUDE = avrdude |
REMOVE = rm -f |
COPY = cp |
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
ELFSIZE = $(SIZE) -A $(TARGET).elf |
LIMITS = $(SIZE) --mcu=$(MCU) -C $(TARGET).elf |
# Define Messages |
# English |
MSG_ERRORS_NONE = Errors: none |
MSG_BEGIN = -------- begin -------- |
MSG_END = -------- end -------- |
MSG_SIZE_BEFORE = Size before: |
MSG_SIZE_AFTER = Size after: |
MSG_COFF = Converting to AVR COFF: |
MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
MSG_FLASH = Creating load file for Flash: |
MSG_EEPROM = Creating load file for EEPROM: |
MSG_EXTENDED_LISTING = Creating Extended Listing: |
MSG_SYMBOL_TABLE = Creating Symbol Table: |
MSG_LINKING = Linking: |
MSG_COMPILING = Compiling: |
MSG_ASSEMBLING = Assembling: |
MSG_CLEANING = Cleaning project: |
# Define all object files. |
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) |
# Define all listing files. |
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) |
# Combine all necessary flags and optional flags. |
# Add target processor to flags. |
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
# Default target. |
all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ |
$(TARGET).lss $(TARGET).sym sizeafter finished end |
# Eye candy. |
# AVR Studio 3.x does not check make's exit code but relies on |
# the following magic strings to be generated by the compile job. |
begin: |
@echo |
@echo $(MSG_BEGIN) |
finished: |
@echo $(MSG_ERRORS_NONE) |
end: |
@echo $(MSG_END) |
@echo |
# Display size of file. |
sizebefore: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); $(LIMITS); echo; fi |
sizeafter: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); $(LIMITS); echo; fi |
# Display compiler version information. |
gccversion : |
@$(CC) --version |
# Convert ELF to COFF for use in debugging / simulating in |
# AVR Studio or VMLAB. |
COFFCONVERT=$(OBJCOPY) --debugging \ |
--change-section-address .data-0x800000 \ |
--change-section-address .bss-0x800000 \ |
--change-section-address .noinit-0x800000 \ |
--change-section-address .eeprom-0x810000 |
coff: $(TARGET).elf |
@echo |
@echo $(MSG_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof |
extcoff: $(TARGET).elf |
@echo |
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof |
# Program the device. |
program: $(TARGET).hex $(TARGET).eep |
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
# Create final output files (.hex, .eep) from ELF output file. |
%.hex: %.elf |
@echo |
@echo $(MSG_FLASH) $@ |
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ |
%.eep: %.elf |
@echo |
@echo $(MSG_EEPROM) $@ |
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ |
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@ |
# Create extended listing file from ELF output file. |
%.lss: %.elf |
@echo |
@echo $(MSG_EXTENDED_LISTING) $@ |
$(OBJDUMP) -h -S $< > $@ |
# Create a symbol table from ELF output file. |
%.sym: %.elf |
@echo |
@echo $(MSG_SYMBOL_TABLE) $@ |
avr-nm -n $< > $@ |
# Link: create ELF output file from object files. |
.SECONDARY : $(TARGET).elf |
.PRECIOUS : $(OBJ) |
%.elf: $(OBJ) |
@echo |
@echo $(MSG_LINKING) $@ |
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) |
# Compile: create object files from C source files. |
%.o : %.c |
@echo |
@echo $(MSG_COMPILING) $< |
$(CC) -c $(ALL_CFLAGS) $< -o $@ |
# Compile: create assembler files from C source files. |
%.s : %.c |
$(CC) -S $(ALL_CFLAGS) $< -o $@ |
# Assemble: create object files from assembler source files. |
%.o : %.S |
@echo |
@echo $(MSG_ASSEMBLING) $< |
$(CC) -c $(ALL_ASFLAGS) $< -o $@ |
# Target: clean project. |
clean: begin clean_list finished end |
clean_list : |
@echo |
@echo $(MSG_CLEANING) |
$(REMOVE) MK3Mag_*.hex |
$(REMOVE) MK3Mag_*.eep |
$(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).cof |
$(REMOVE) MK3Mag_*.elf |
$(REMOVE) MK3Mag_*.map |
$(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).a90 |
$(REMOVE) MK3Mag_*.sym |
$(REMOVE) $(TARGET).lnk |
$(REMOVE) MK3Mag_*.lss |
$(REMOVE) $(OBJ) |
$(REMOVE) $(LST) |
$(REMOVE) $(SRC:.c=.s) |
$(REMOVE) $(SRC:.c=.d) |
# Automatically generate C source code dependencies. |
# (Code originally taken from the GNU make user manual and modified |
# (See README.txt Credits).) |
# |
# Note that this will work with sh (bash) and sed that is shipped with WinAVR |
# (see the SHELL variable defined above). |
# This may not work with other shells or other seds. |
# |
%.d: %.c |
set -e; $(CC) -MM $(ALL_CFLAGS) $< \ |
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ |
[ -s $@ ] || rm -f $@ |
# Remove the '-' if you want to see the dependency files generated. |
-include $(SRC:.c=.d) |
# Listing of phony targets. |
.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ |
clean clean_list program |
/tags/V0.23a/menu.c |
---|
0,0 → 1,127 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + only for non-profit use |
// + www.MikroKopter.com |
// + see the File "License.txt" for further Informations |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <stdlib.h> |
#include <inttypes.h> |
#include "menu.h" |
#include "uart.h" |
#include "printf_P.h" |
#include "analog.h" |
#include "main.h" |
uint8_t MaxMenuItem = 2; |
uint8_t MenuItem = 0; |
int8_t DisplayBuff[DISPLAYBUFFSIZE] = "Hello World"; |
uint8_t DispPtr = 0; |
/************************************/ |
/* Put Character to LCD Buffer */ |
/************************************/ |
void Menu_Putchar(char c) |
{ |
if(DispPtr < DISPLAYBUFFSIZE) DisplayBuff[DispPtr++] = c; |
} |
/************************************/ |
/* Clear LCD Buffer */ |
/************************************/ |
void Menu_Clear(void) |
{ |
uint8_t i; |
for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' '; |
} |
/************************************/ |
/* Update Menu on LCD */ |
/************************************/ |
// Display with 20 characters in 4 lines |
void Menu_Update(uint8_t Keys) |
{ |
if(Keys & KEY1) |
{ |
if(MenuItem) MenuItem--; |
else MenuItem = MaxMenuItem; |
} |
if(Keys & KEY2) |
{ |
if(MenuItem == MaxMenuItem) MenuItem = 0; |
else MenuItem++; |
} |
if((Keys & KEY1) && (Keys & KEY2)) MenuItem = 0; |
Menu_Clear(); |
if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
// print menu item number in the upper right corner |
if(MenuItem < 10) |
{ |
LCD_printfxy(17,0,"[%i]",MenuItem); |
} |
else |
{ |
LCD_printfxy(16,0,"[%i]",MenuItem); |
} |
switch(MenuItem) |
{ |
case 0:// Version Info Menu Item |
LCD_printfxy(0,0,"++ MK3MAG ++ "); |
LCD_printfxy(0,1," V %d.%d%c", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH + 'a'); |
if(AccPresent) |
{ |
LCD_printfxy(0,2, " ACC Support "); |
} |
else |
{ |
LCD_printfxy(0,2, " "); |
} |
LCD_printfxy(0,3,"(c) Buss, Busker "); |
break; |
case 1: // Magnet readings |
LCD_printfxy(0,0,"Magnet Sensors: "); |
LCD_printfxy(0,1,"X:%+4d Attitude", MagX); |
LCD_printfxy(0,2,"Y:%+4d by", MagY); |
LCD_printfxy(0,3,"Z:%+4d ", MagZ); |
switch(AttitudeSource) |
{ |
case ATTITUDE_SOURCE_I2C: LCD_printfxy(12,2,"I2C"); break; |
case ATTITUDE_SOURCE_UART: LCD_printfxy(12,2,"UART"); break; |
case ATTITUDE_SOURCE_ACC: LCD_printfxy(12,2,"ACC"); break; |
default: LCD_printfxy(12,2,"???"); break; |
break; |
} |
break; |
case 2: // Calcstate |
LCD_printfxy(0,0,"Calibrating: "); |
LCD_printfxy(0,1,"Step: %1d ",ActualCalstate); |
switch(ActualCalstate) |
{ |
default: |
case 0: LCD_printfxy(0,2," -- "); break; |
case 3: |
case 1: LCD_printfxy(0,2," pause "); break; |
case 2: LCD_printfxy(0,2,"measure horizontal"); break; |
case 4: LCD_printfxy(0,2,"measure vertical"); break; |
case 5: LCD_printfxy(0,2,"store data"); break; |
} |
if(!ActualCalstate) LCD_printfxy(13,3,"(start)") |
else LCD_printfxy(9,3,"(ESC)(step)"); |
if(Keys & KEY4) InternalCalstate++; |
if(ActualCalstate >= 5 || (Keys & KEY3)) InternalCalstate = 0; |
break; |
default: |
MaxMenuItem = MenuItem - 1; |
MenuItem = 0; |
break; |
} |
} |
/tags/V0.23a/menu.h |
---|
0,0 → 1,30 |
#ifndef _MENU_H |
#define _MENU_H |
#include <inttypes.h> |
#include "printf_P.h" |
#define DISPLAYBUFFSIZE 80 |
#define KEY1 0x01 |
#define KEY2 0x02 |
#define KEY3 0x04 |
#define KEY4 0x08 |
extern int8_t DisplayBuff[DISPLAYBUFFSIZE]; |
extern uint8_t DispPtr; |
extern uint8_t MenuItem; |
extern uint8_t MaxMenuItem; |
extern void Menu_Update(uint8_t Keys); |
extern void Menu_Putchar(char c); |
extern void Menu_Clear(void); |
#define LCD_printfxy(x,y,format, args...) { DispPtr = y * 20 + x; _printf_P(&Menu_Putchar, PSTR(format) , ## args);} |
#define LCD_printf(format, args...) { _printf_P(&Menu_Putchar, PSTR(format) , ## args);} |
#endif //_MENU_H |
/tags/V0.23a/old_macros.h |
---|
0,0 → 1,47 |
/* |
For backwards compatibility only. |
Ingo Busker ingo@mikrocontroller.com |
*/ |
#ifndef cbi |
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) |
#endif |
#ifndef sbi |
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) |
#endif |
#ifndef inb |
#define inb(sfr) _SFR_BYTE(sfr) |
#endif |
#ifndef outb |
#define outb(sfr, val) (_SFR_BYTE(sfr) = (val)) |
#endif |
#ifndef inw |
#define inw(sfr) _SFR_WORD(sfr) |
#endif |
#ifndef outw |
#define outw(sfr, val) (_SFR_WORD(sfr) = (val)) |
#endif |
#ifndef outp |
#define outp(val, sfr) outb(sfr, val) |
#endif |
#ifndef inp |
#define inp(sfr) inb(sfr) |
#endif |
#ifndef BV |
#define BV(bit) _BV(bit) |
#endif |
#ifndef PRG_RDB |
#define PRG_RDB pgm_read_byte |
#endif |
/tags/V0.23a/printf_P.c |
---|
0,0 → 1,469 |
// Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist nicht von der Lizenz für den MikroKopter-Teil unterstellt |
/* |
Copyright (C) 1993 Free Software Foundation |
This file is part of the GNU IO Library. This library is free |
software; you can redistribute it and/or modify it under the |
terms of the GNU General Public License as published by the |
Free Software Foundation; either version 2, or (at your option) |
any later version. |
This library is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
You should have received a copy of the GNU General Public License |
along with this library; see the file COPYING. If not, write to the Free |
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
As a special exception, if you link this library with files |
compiled with a GNU compiler to produce an executable, this does not cause |
the resulting executable to be covered by the GNU General Public License. |
This exception does not however invalidate any other reasons why |
the executable file might be covered by the GNU General Public License. */ |
/* |
* Copyright (c) 1990 Regents of the University of California. |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. [rescinded 22 July 1999] |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
*/ |
/****************************************************************************** |
This file is a patched version of printf called _printf_P |
It is made to work with avr-gcc for Atmel AVR MCUs. |
There are some differences from standard printf: |
1. There is no floating point support (with fp the code is about 8K!) |
2. Return type is void |
3. Format string must be in program memory (by using macro printf this is |
done automaticaly) |
4. %n is not implemented (just remove the comment around it if you need it) |
5. If LIGHTPRINTF is defined, the code is about 550 bytes smaller and the |
folowing specifiers are disabled : |
space # * . - + p s o O |
6. A function void uart_sendchar(char c) is used for output. The UART must |
be initialized before using printf. |
Alexander Popov |
sasho@vip.orbitel.bg |
******************************************************************************/ |
/* |
* Actual printf innards. |
* |
* This code is large and complicated... |
*/ |
#include <string.h> |
#ifdef __STDC__ |
#include <stdarg.h> |
#else |
#include <varargs.h> |
#endif |
#include "old_macros.h" |
#include "printf_P.h" |
void PRINT(pVoidFnctChar pPutchar, const char * ptr, unsigned int len) |
{ |
for(;len;len--) (*pPutchar)(*ptr++); |
} |
void PRINTP(pVoidFnctChar pPutchar, const char * ptr, unsigned int len) |
{ |
for(;len;len--) (*pPutchar)(pgm_read_byte(ptr++)); |
} |
void PAD_SP(pVoidFnctChar pPutchar, signed char howmany) |
{ |
for(;howmany>0;howmany--) (*pPutchar)(' '); |
} |
void PAD_0(pVoidFnctChar pPutchar, signed char howmany) |
{ |
for(;howmany>0;howmany--) (*pPutchar)('0'); |
} |
#define BUF 40 |
/* |
* Macros for converting digits to letters and vice versa |
*/ |
#define to_digit(c) ((c) - '0') |
#define is_digit(c) ((c)<='9' && (c)>='0') |
#define to_char(n) ((n) + '0') |
/* |
* Flags used during conversion. |
*/ |
#define LONGINT 0x01 /* long integer */ |
#define LONGDBL 0x02 /* long double; unimplemented */ |
#define SHORTINT 0x04 /* short integer */ |
#define ALT 0x08 /* alternate form */ |
#define LADJUST 0x10 /* left adjustment */ |
#define ZEROPAD 0x20 /* zero (as opposed to blank) pad */ |
#define HEXPREFIX 0x40 /* add 0x or 0X prefix */ |
void _printf_P (pVoidFnctChar pPutchar, char const *fmt0, ...) /* Works with string from FLASH */ |
{ |
va_list ap; |
register const char *fmt; /* format string */ |
register char ch; /* character from fmt */ |
register int n; /* handy integer (short term usage) */ |
register char *cp; /* handy char pointer (short term usage) */ |
const char *fmark; /* for remembering a place in fmt */ |
register unsigned char flags; /* flags as above */ |
signed char width; /* width from format (%8d), or 0 */ |
signed char prec; /* precision from format (%.3d), or -1 */ |
char sign; /* sign prefix (' ', '+', '-', or \0) */ |
unsigned long _ulong=0; /* integer arguments %[diouxX] */ |
#define OCT 8 |
#define DEC 10 |
#define HEX 16 |
unsigned char base; /* base for [diouxX] conversion */ |
signed char dprec; /* a copy of prec if [diouxX], 0 otherwise */ |
signed char dpad; /* extra 0 padding needed for integers */ |
signed char fieldsz; /* field size expanded by sign, dpad etc */ |
/* The initialization of 'size' is to suppress a warning that |
'size' might be used unitialized. It seems gcc can't |
quite grok this spaghetti code ... */ |
signed char size = 0; /* size of converted field or string */ |
char buf[BUF]; /* space for %c, %[diouxX], %[eEfgG] */ |
char ox[2]; /* space for 0x hex-prefix */ |
va_start(ap, fmt0); |
fmt = fmt0; |
/* |
* Scan the format for conversions (`%' character). |
*/ |
for (;;) { |
for (fmark = fmt; (ch = pgm_read_byte(fmt)) != '\0' && ch != '%'; fmt++) |
/* void */; |
if ((n = fmt - fmark) != 0) { |
PRINTP(pPutchar, fmark, n); |
} |
if (ch == '\0') |
goto done; |
fmt++; /* skip over '%' */ |
flags = 0; |
dprec = 0; |
width = 0; |
prec = -1; |
sign = '\0'; |
rflag: ch = PRG_RDB(fmt++); |
reswitch: |
#ifdef LIGHTPRINTF |
if (ch=='o' || ch=='u' || (ch|0x20)=='x') { |
#else |
if (ch=='u' || (ch|0x20)=='x') { |
#endif |
if (flags&LONGINT) { |
_ulong=va_arg(ap, unsigned long); |
} else { |
register unsigned int _d; |
_d=va_arg(ap, unsigned int); |
_ulong = flags&SHORTINT ? (unsigned long)(unsigned short)_d : (unsigned long)_d; |
} |
} |
#ifndef LIGHTPRINTF |
if(ch==' ') { |
/* |
* ``If the space and + flags both appear, the space |
* flag will be ignored.'' |
* -- ANSI X3J11 |
*/ |
if (!sign) |
sign = ' '; |
goto rflag; |
} else if (ch=='#') { |
flags |= ALT; |
goto rflag; |
} else if (ch=='*'||ch=='-') { |
if (ch=='*') { |
/* |
* ``A negative field width argument is taken as a |
* - flag followed by a positive field width.'' |
* -- ANSI X3J11 |
* They don't exclude field widths read from args. |
*/ |
if ((width = va_arg(ap, int)) >= 0) |
goto rflag; |
width = -width; |
} |
flags |= LADJUST; |
flags &= ~ZEROPAD; /* '-' disables '0' */ |
goto rflag; |
} else if (ch=='+') { |
sign = '+'; |
goto rflag; |
} else if (ch=='.') { |
if ((ch = PRG_RDB(fmt++)) == '*') { |
n = va_arg(ap, int); |
prec = n < 0 ? -1 : n; |
goto rflag; |
} |
n = 0; |
while (is_digit(ch)) { |
n = n*10 + to_digit(ch); |
ch = PRG_RDB(fmt++); |
} |
prec = n < 0 ? -1 : n; |
goto reswitch; |
} else |
#endif /* LIGHTPRINTF */ |
if (ch=='0') { |
/* |
* ``Note that 0 is taken as a flag, not as the |
* beginning of a field width.'' |
* -- ANSI X3J11 |
*/ |
if (!(flags & LADJUST)) |
flags |= ZEROPAD; /* '-' disables '0' */ |
goto rflag; |
} else if (ch>='1' && ch<='9') { |
n = 0; |
do { |
n = 10 * n + to_digit(ch); |
ch = PRG_RDB(fmt++); |
} while (is_digit(ch)); |
width = n; |
goto reswitch; |
} else if (ch=='h') { |
flags |= SHORTINT; |
goto rflag; |
} else if (ch=='l') { |
flags |= LONGINT; |
goto rflag; |
} else if (ch=='c') { |
*(cp = buf) = va_arg(ap, int); |
size = 1; |
sign = '\0'; |
} else if (ch=='D'||ch=='d'||ch=='i') { |
if(ch=='D') |
flags |= LONGINT; |
if (flags&LONGINT) { |
_ulong=va_arg(ap, long); |
} else { |
register int _d; |
_d=va_arg(ap, int); |
_ulong = flags&SHORTINT ? (long)(short)_d : (long)_d; |
} |
if ((long)_ulong < 0) { |
_ulong = -_ulong; |
sign = '-'; |
} |
base = DEC; |
goto number; |
} else |
/* |
if (ch=='n') { |
if (flags & LONGINT) |
*va_arg(ap, long *) = ret; |
else if (flags & SHORTINT) |
*va_arg(ap, short *) = ret; |
else |
*va_arg(ap, int *) = ret; |
continue; // no output |
} else |
*/ |
#ifndef LIGHTPRINTF |
if (ch=='O'||ch=='o') { |
if (ch=='O') |
flags |= LONGINT; |
base = OCT; |
goto nosign; |
} else if (ch=='p') { |
/* |
* ``The argument shall be a pointer to void. The |
* value of the pointer is converted to a sequence |
* of printable characters, in an implementation- |
* defined manner.'' |
* -- ANSI X3J11 |
*/ |
/* NOSTRICT */ |
_ulong = (unsigned int)va_arg(ap, void *); |
base = HEX; |
flags |= HEXPREFIX; |
ch = 'x'; |
goto nosign; |
} else if (ch=='s') { // print a string from RAM |
if ((cp = va_arg(ap, char *)) == NULL) { |
cp=buf; |
cp[0] = '('; |
cp[1] = 'n'; |
cp[2] = 'u'; |
cp[4] = cp[3] = 'l'; |
cp[5] = ')'; |
cp[6] = '\0'; |
} |
if (prec >= 0) { |
/* |
* can't use strlen; can only look for the |
* NUL in the first `prec' characters, and |
* strlen() will go further. |
*/ |
char *p = (char*)memchr(cp, 0, prec); |
if (p != NULL) { |
size = p - cp; |
if (size > prec) |
size = prec; |
} else |
size = prec; |
} else |
size = strlen(cp); |
sign = '\0'; |
} else |
#endif /* LIGHTPRINTF */ |
if(ch=='U'||ch=='u') { |
if (ch=='U') |
flags |= LONGINT; |
base = DEC; |
goto nosign; |
} else if (ch=='X'||ch=='x') { |
base = HEX; |
/* leading 0x/X only if non-zero */ |
if (flags & ALT && _ulong != 0) |
flags |= HEXPREFIX; |
/* unsigned conversions */ |
nosign: sign = '\0'; |
/* |
* ``... diouXx conversions ... if a precision is |
* specified, the 0 flag will be ignored.'' |
* -- ANSI X3J11 |
*/ |
number: if ((dprec = prec) >= 0) |
flags &= ~ZEROPAD; |
/* |
* ``The result of converting a zero value with an |
* explicit precision of zero is no characters.'' |
* -- ANSI X3J11 |
*/ |
cp = buf + BUF; |
if (_ulong != 0 || prec != 0) { |
register unsigned char _d,notlastdigit; |
do { |
notlastdigit=(_ulong>=base); |
_d = _ulong % base; |
if (_d<10) { |
_d+='0'; |
} else { |
_d+='a'-10; |
if (ch=='X') _d&=~0x20; |
} |
*--cp=_d; |
_ulong /= base; |
} while (notlastdigit); |
#ifndef LIGHTPRINTF |
// handle octal leading 0 |
if (base==OCT && flags & ALT && *cp != '0') |
*--cp = '0'; |
#endif |
} |
size = buf + BUF - cp; |
} else { //default |
/* "%?" prints ?, unless ? is NUL */ |
if (ch == '\0') |
goto done; |
/* pretend it was %c with argument ch */ |
cp = buf; |
*cp = ch; |
size = 1; |
sign = '\0'; |
} |
/* |
* All reasonable formats wind up here. At this point, |
* `cp' points to a string which (if not flags&LADJUST) |
* should be padded out to `width' places. If |
* flags&ZEROPAD, it should first be prefixed by any |
* sign or other prefix; otherwise, it should be blank |
* padded before the prefix is emitted. After any |
* left-hand padding and prefixing, emit zeroes |
* required by a decimal [diouxX] precision, then print |
* the string proper, then emit zeroes required by any |
* leftover floating precision; finally, if LADJUST, |
* pad with blanks. |
*/ |
/* |
* compute actual size, so we know how much to pad. |
*/ |
fieldsz = size; |
dpad = dprec - size; |
if (dpad < 0) |
dpad = 0; |
if (sign) |
fieldsz++; |
else if (flags & HEXPREFIX) |
fieldsz += 2; |
fieldsz += dpad; |
/* right-adjusting blank padding */ |
if ((flags & (LADJUST|ZEROPAD)) == 0) |
PAD_SP(pPutchar, width - fieldsz); |
/* prefix */ |
if (sign) { |
PRINT(pPutchar, &sign, 1); |
} else if (flags & HEXPREFIX) { |
ox[0] = '0'; |
ox[1] = ch; |
PRINT(pPutchar, ox, 2); |
} |
/* right-adjusting zero padding */ |
if ((flags & (LADJUST|ZEROPAD)) == ZEROPAD) |
PAD_0(pPutchar, width - fieldsz); |
/* leading zeroes from decimal precision */ |
PAD_0(pPutchar, dpad); |
/* the string or number proper */ |
PRINT(pPutchar, cp, size); |
/* left-adjusting padding (always blank) */ |
if (flags & LADJUST) |
PAD_SP(pPutchar, width - fieldsz); |
} |
done: |
va_end(ap); |
} |
/tags/V0.23a/printf_P.h |
---|
0,0 → 1,11 |
#ifndef _PRINTF_P_H_ |
#define _PRINTF_P_H_ |
#include <avr/pgmspace.h> |
// function pointer to external callback put character function |
typedef void (*pVoidFnctChar) (char ); |
void _printf_P (pVoidFnctChar pPutchar, char const *fmt0, ...); |
#endif //_PRINTF_P_H_ |
/tags/V0.23a/timer0.c |
---|
0,0 → 1,170 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <inttypes.h> |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include "main.h" |
volatile uint16_t CountMilliseconds = 0; |
volatile uint16_t I2C_Timeout = 0; |
/*****************************************************/ |
/* Initialize Timer 0 */ |
/*****************************************************/ |
void TIMER0_Init(void) |
{ |
// set PB2 as output for the PWM used to signal compass heading |
DDRB |= (1<<DDB2); |
PORTB &= ~(1<<PORTB2); |
// Timer/Counter 0 Control Register A |
// Normal Timer Counter Mode (Bits WGM02 = 0, WGM01 = 0, WGM00 = 0) |
// OC0A disconnected (Bits COM0A1 = 0, COM0A0 = 0) |
// OC0B disconnected (Bits COM0B1 = 0, COM0B0 = 0) |
TCCR0A &= ~((1<<COM0A1)|(1<<COM0A0)|(1<<COM0B1)|(1<<COM0B0)|(1<<WGM01)|(1<<WGM00)); |
// Timer/Counter 0 Control Register B |
// set clock devider for timer 0 to SYSKLOCK/8 = 8MHz / 8 = 1MHz |
// i.e. the timer increments from 0x00 to 0xFF with an update rate of 2.5 MHz |
// hence the timer overflow interrupt frequency is 2.5 MHz / 256 = 9.765 kHz |
// divider 8 (Bits CS02 = 0, CS01 = 1, CS00 = 0) |
TCCR0B &= ~((1<<FOC0A)|(1<<FOC0B)|(1<<WGM02)|(1<<CS02)); |
TCCR0B = (1<<CS01)|(0<<CS00); |
// init Timer/Counter 0 Register |
TCNT0 = 0; |
// Timer/Counter 0 Interrupt Mask Register |
// enable timer overflow interrupt only |
TIMSK0 &= ~((1<<OCIE0B)|(1<<OCIE0A)); |
TIMSK0 |= (1<<TOIE0); |
} |
// ----------------------------------------------------------------------- |
ISR(TIMER0_OVF_vect) |
{ |
static uint8_t cnt; |
static uint16_t cmps_cnt; |
// reload timer register so that overflow occurs after 100 increments at 1 MHz |
// resulting in a calling rate of this ISR of 10kHz or 0.1 ms. |
TCNT0 -= 101; |
// disable PWM when bad compass heading value |
if(Heading < 0) |
{ |
PORTB &= ~(1<<PORTB2); |
cmps_cnt = 0; |
} |
else |
{ |
// if a periode of 38.0 ms is over |
if(++cmps_cnt >= 380) |
{ |
// set PWM out to high |
PORTB |= (1<<PORTB2); |
// reset periode counter |
cmps_cnt = 0; |
} |
// if the delay in 0.1 ms is equal to Heading + 10 |
else if(cmps_cnt >= (Heading + 10)) |
{ |
// set PWM out to low |
PORTB &= ~(1<<PORTB2); |
} |
} |
if(!--cnt) |
{ |
// every 10th run (1kHz or 1ms) |
cnt = 10; |
CountMilliseconds++; |
if(I2C_Timeout) I2C_Timeout--; |
} |
} |
// ----------------------------------------------------------------------- |
uint16_t SetDelay (uint16_t t) |
{ |
return(CountMilliseconds + t - 1); |
} |
// ----------------------------------------------------------------------- |
int8_t CheckDelay(uint16_t t) |
{ |
return(((t - CountMilliseconds) & 0x8000) >> 8); // check sign bit |
} |
// ----------------------------------------------------------------------- |
void Delay_ms(uint16_t wait) |
{ |
uint16_t t_stop; |
t_stop = SetDelay(wait); |
while (!CheckDelay(t_stop)); |
} |
/tags/V0.23a/timer0.h |
---|
0,0 → 1,17 |
#ifndef _TIMER0_H |
#define _TIMER0_H |
#include <inttypes.h> |
extern volatile uint16_t CountMilliseconds; |
extern volatile uint16_t I2C_Timeout; |
void TIMER0_Init(void); |
uint16_t SetDelay (uint16_t t); |
int8_t CheckDelay(uint16_t t); |
void Delay_ms(uint16_t wait); |
#endif //_TIMER0_H |
/tags/V0.23a/twislave.c |
---|
0,0 → 1,289 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
/// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <util/twi.h> |
#include "twislave.h" |
#include "uart.h" |
#include "main.h" |
#include "timer0.h" |
#include "led.h" |
volatile uint8_t I2C_RxBufferSize = 0, I2C_TxBufferSize = 0; |
volatile uint8_t *I2C_TxBuffer = 0, *I2C_RxBuffer = 0; |
uint8_t NC_Connected = 0; |
I2C_Heading_t I2C_Heading; |
I2C_WriteAttitude_t I2C_WriteAttitude; |
I2C_Mag_t I2C_Mag; |
I2C_Version_t I2C_Version; |
I2C_WriteCal_t I2C_WriteCal; |
// send ACK after recieving a byte / ACK is expected after transmitting a byte |
#define TWCR_ACK TWCR = (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(1<<TWEA)|(0<<TWSTA)|(0<<TWSTO)|(0<<TWWC) |
// send no ACK after recieving a byte / No ACK is expected after transmitting a byte |
#define TWCR_NACK TWCR = (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(0<<TWEA)|(0<<TWSTA)|(0<<TWSTO)|(0<<TWWC) |
// switched to the non adressed slave mode |
#define TWCR_RESET TWCR = (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(1<<TWEA)|(0<<TWSTA)|(0<<TWSTO)|(0<<TWWC) |
// The bit pattern for TWCR_ACK and TWCR_RESET are equal. This is no errro but used for better understanding. |
#define TWCR_CLEARBUS TWCR = (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(1<<TWEA)|(0<<TWSTA)|(1<<TWSTO)|(0<<TWWC) |
void I2C_Init(void) |
{ |
uint8_t sreg; |
// backup status register |
sreg = SREG; |
// disable global interrupts |
cli(); |
// SCK/SCL and MISO/SDA are at put together on the same connector pin in the schematic |
// set PB4 (SCK) and PB5 (MISO) as input pull up |
DDRB &= ~((1<<DDB4)|(1<<DDB5)); |
PORTB |= ((1<<PORTB4)|(1<<PORTB5)); |
// set PC4 (SDA) and PC5 (SCL) as input tristate |
DDRC &= ~((1<<DDC4)|(1<<DDC5)); |
PORTC &= ~((1<<PORTC4)|(1<<PORTC5)); |
I2C_TxBuffer = 0; |
I2C_TxBufferSize = 0; |
I2C_RxBuffer = 0; |
I2C_RxBufferSize = 0; |
TWCR = ~(1<<TWSTA)|(1<<TWSTO); |
TWCR|= (1<<TWEA) | (1<<TWEN)|(1<<TWIE); |
// set own address |
// set own address in the upper 7 bits |
TWAR = I2C_SLAVE_ADDRESS; // set own address only the upper 7 bits are relevant |
// TWI Control Register |
// enable TWI Acknowledge Bit (TWEA = 1) |
// disable TWI START Condition Bit (TWSTA = 0), SLAVE |
// disable TWI STOP Condition Bit (TWSTO = 0), SLAVE |
// enable TWI (TWEN = 1) |
// enable TWI Interrupt (TWIE = 1) |
TWCR |= (1<<TWEN)|(1<<TWIE)|(1<<TWINT)|(1<<TWEA)|(0<<TWSTA)|(1<<TWSTO)|(0<<TWWC); |
// update version info |
I2C_Version.Major = VERSION_MAJOR; |
I2C_Version.Minor = VERSION_MINOR; |
I2C_Version.Patch = VERSION_PATCH; |
I2C_Version.Compatible = NC_I2C_COMPATIBLE; |
TWCR_RESET; |
// resore status register |
SREG = sreg; |
} |
ISR (TWI_vect) |
{ |
uint8_t data; |
static uint8_t crc, Tx_Idx = 0, Rx_Idx = 0; |
static uint8_t I2C_PrimRxBuffer[10]; |
// check event |
switch (TW_STATUS) |
{ |
case TW_SR_SLA_ACK: // slave addressed in receiver mode and ack has been returned |
Rx_Idx = 0xFF; // reset rx buffer pointer |
TWCR_ACK; // trigger receiving of first data byte and send ack afterwards |
return; |
case TW_SR_DATA_ACK: // data has been received and ack has been returned |
data = TWDR; |
if (Rx_Idx == 0xFF) |
{ // if the first byte after slave addressing was received |
switch(data) |
{ |
case I2C_CMD_VERSION: |
I2C_TxBuffer = (uint8_t *)&I2C_Version; |
I2C_TxBufferSize = sizeof(I2C_Version); |
I2C_RxBuffer = 0; |
I2C_RxBufferSize = 0; |
break; |
case I2C_CMD_WRITE_CAL: |
I2C_TxBuffer = (uint8_t *)&I2C_WriteCal; |
I2C_TxBufferSize = sizeof(I2C_WriteCal); |
I2C_RxBuffer = (uint8_t *)&I2C_WriteCal; |
I2C_RxBufferSize = sizeof(I2C_WriteCal); |
break; |
case I2C_CMD_READ_MAG: |
I2C_TxBuffer = (uint8_t *)&I2C_Mag; |
I2C_TxBufferSize = sizeof(I2C_Mag); |
I2C_RxBuffer = 0; |
I2C_RxBufferSize = 0; |
I2C_Mag.MagX = MagX; |
I2C_Mag.MagY = MagY; |
I2C_Mag.MagZ = MagZ; |
break; |
case I2C_CMD_READ_HEADING: |
I2C_TxBuffer = (uint8_t *)&I2C_Heading; |
I2C_TxBufferSize = sizeof(I2C_Heading); |
I2C_RxBuffer = (uint8_t *)&I2C_WriteAttitude; |
I2C_RxBufferSize = sizeof(I2C_WriteAttitude); |
I2C_Heading.Heading = Heading; // get heading |
AttitudeSource = ATTITUDE_SOURCE_I2C; |
Orientation = ORIENTATION_NC; |
NC_Connected = 255; |
break; |
default: // unknown command id |
I2C_RxBuffer = 0; |
I2C_RxBufferSize = 0; |
I2C_TxBuffer = 0; |
I2C_TxBufferSize = 0; |
break; |
} |
Rx_Idx = 0; // set rx buffer index to start of the buffer |
crc = data; |
} |
else // Rx_Idx != 0xFF |
{ |
// fill receiver buffer with the byte that has been received |
// if buffer exist and there is still some free space |
if(Rx_Idx < I2C_RxBufferSize) |
{ |
I2C_PrimRxBuffer[Rx_Idx] = data; |
crc += data; |
} |
else if (Rx_Idx == I2C_RxBufferSize) // crc byte was transfered |
{ // if checksum matched |
crc = ~crc; //flip all bits inthe checksum |
if(crc == data) |
{ // and RxBuffer exist |
if(I2C_RxBuffer != 0) |
{ // copy data to rx buffer |
for(data = 0; data < I2C_RxBufferSize; data++) |
{ |
I2C_RxBuffer[data] = I2C_PrimRxBuffer[data]; |
} |
} |
DebugOut.Analog[31]++; |
} |
else |
{ |
DebugOut.Analog[30]++; |
} |
} |
// else ignore data |
Rx_Idx++; |
} |
TWCR_ACK; |
return; |
case TW_ST_SLA_ACK: // slave transmitter selected |
// reset index to start of tx buffer |
Tx_Idx = 0; |
crc = 0; |
// if tx buffer exist and there is at least one byte to transfer |
if((I2C_TxBuffer != 0) && (I2C_TxBufferSize > 1)) |
{ |
data = I2C_TxBuffer[Tx_Idx]; |
} |
else |
{ // send 0x00 if no tx buffer exist or all bytes of the tx buffer have been transmitted |
data = 0x00; |
} |
crc += data; |
Tx_Idx++; |
TWDR = data; |
TWCR_ACK; |
return; |
case TW_ST_DATA_ACK: // data byte has been transmitted ack has been received |
// put next byte from tx buffer to the data register |
if((I2C_TxBuffer != 0) && (Tx_Idx < I2C_TxBufferSize)) |
{ |
data = I2C_TxBuffer[Tx_Idx]; |
crc += data; |
} |
else if (Tx_Idx == I2C_TxBufferSize) |
{ // send crc byte at the end |
data = ~crc; |
} |
else |
{ |
data = 0x00; |
} |
Tx_Idx++; |
TWDR = data; |
TWCR_ACK; |
return; |
case TW_BUS_ERROR: // Bus-Error |
TWCR_CLEARBUS; // free bus, reset to nonselected slave |
return; |
case TW_ST_DATA_NACK: // data transmitted, NACK received |
case TW_ST_LAST_DATA: // last data byte transmitted, ACK received |
case TW_SR_STOP: // stop or repeated start condition received while selected |
default: |
TWCR_RESET; // switch to the not addressed slave mode, own SLA will be recognized |
return; |
} |
} |
/tags/V0.23a/twislave.h |
---|
0,0 → 1,63 |
#ifndef _TWI_SLAVE_H_ |
#define _TWI_SLAVE_H_ |
#include <inttypes.h> |
#define I2C_SLAVE_ADDRESS 0x50 |
#define I2C_CMD_VERSION 0x01 |
#define I2C_CMD_READ_MAG 0x02 |
#define I2C_CMD_READ_HEADING 0x03 |
#define I2C_CMD_WRITE_CAL 0x04 |
#define I2C_CMD_WRITE_EEPROM 0x0A |
#define I2C_CMD_READ_EEPROM 0x0B |
typedef struct |
{ |
uint8_t Major; |
uint8_t Minor; |
uint8_t Patch; |
uint8_t Compatible; |
} I2C_Version_t; |
typedef struct |
{ |
int16_t MagX; |
int16_t MagY; |
int16_t MagZ; |
} I2C_Mag_t; |
typedef struct |
{ |
int16_t Nick; |
int16_t Roll; |
} I2C_WriteAttitude_t; |
typedef struct |
{ |
uint8_t CalByte; |
uint8_t Dummy1; |
uint8_t Dummy2; |
} I2C_WriteCal_t; |
typedef struct |
{ |
int16_t Heading; |
} I2C_Heading_t; |
extern uint8_t NC_Connected; |
extern I2C_Heading_t I2C_Heading; |
extern I2C_WriteAttitude_t I2C_WriteAttitude; |
extern I2C_Mag_t I2C_Mag; |
extern I2C_Version_t I2C_Version; |
extern I2C_WriteCal_t I2C_WriteCal; |
void I2C_Init(void); |
#endif // _TWI_SLAVE_H_ |
/tags/V0.23a/uart.c |
---|
0,0 → 1,682 |
/*####################################################################################### |
MK3Mag 3D-Magnet sensor |
!!! THIS IS NOT FREE SOFTWARE !!! |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 05.2008 Holger Buss |
// + Thanks to Ilja Fähnrich (P_Latzhalter) |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + AUSNAHME: Ein bei www.mikrokopter.de erworbener vorbestückter MK3Mag darf als Baugruppe auch in kommerziellen Systemen verbaut werden |
// + Im Zweifelsfall bitte anfragen bei: info@mikrokopter.de |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + Exception: A preassembled MK3Mag, purchased from www.mikrokopter.de may be used as a part of commercial systems |
// + In case of doubt please contact: info@MikroKopter.de |
// + * If sources or documentations are redistributet on other webpages, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/wdt.h> |
#include <avr/pgmspace.h> |
#include <stdarg.h> |
#include <string.h> |
#include "main.h" |
#include "menu.h" |
#include "uart.h" |
#include "timer0.h" |
#include "twislave.h" |
// slave addresses |
#define FC_ADDRESS 1 |
#define NC_ADDRESS 2 |
#define MK3MAG_ADDRESS 3 |
#define FALSE 0 |
#define TRUE 1 |
// keep buffers as small as possible |
#define TXD_BUFFER_LEN 120 |
#define RXD_BUFFER_LEN 30 |
volatile uint8_t txd_buffer[TXD_BUFFER_LEN]; |
volatile uint8_t rxd_buffer_locked = FALSE; |
volatile uint8_t rxd_buffer[RXD_BUFFER_LEN]; |
volatile uint8_t txd_complete = TRUE; |
volatile uint8_t ReceivedBytes = 0; |
volatile uint8_t *pRxData = 0; |
volatile uint8_t RxDataLen = 0; |
// send flags |
#define RQST_VERSION_INFO 0x01 |
#define RQST_DEBUG_DATA 0x02 |
#define RQST_DEBUG_LABEL 0x04 |
#define RQST_COMPASS_HEADING 0x08 |
#define RQST_EXTERN_CTRL 0x10 |
#define RQST_DISPLAY_DATA 0x20 |
uint8_t RequestFlags = 0x00; |
uint8_t RequestDebugLabel = 0; |
uint8_t ConfirmFrame = 0; |
uint8_t RemoteKeys = 0; |
uint8_t DisplayLine = 0; |
uint16_t PC_Connected = 0; |
uint16_t FC_Connected = 0; |
DebugOut_t DebugOut; |
ExternData_t ExternData; |
ExternControl_t ExternControl; |
UART_VersionInfo_t UART_VersionInfo; |
uint16_t DebugData_Timer; |
uint16_t DebugData_Interval = 5000; |
uint16_t Display_Timer; |
uint16_t Display_Interval = 0; |
uint16_t PotiIntervall = 50; |
uint16_t PotiTimer; |
const prog_uint8_t ANALOG_LABEL[32][16] = |
{ |
//1234567890123456 |
"Magnet X ", //0 |
"Magnet Y ", |
"Magnet Z ", |
"RawMagnet X ", |
"RawMagnet Y ", |
"RawMagnet Z ", //5 |
"Attitude Nick ", |
"Attitude Roll ", |
"Magnet X Offset ", |
"Magnet X Range ", |
"Magnet Y Offset ", //10 |
"Magnet Y Range ", |
"Magnet Z Offset ", |
"Magnet Z Range ", |
"Calstate ", |
"Heading ", //15 |
" ", |
" ", |
"Acc X ", |
"Acc Y ", |
"Acc Z ", //20 |
"RawAcc X ", |
"RawAcc Y ", |
"RawAcc Z ", |
"Serial Poti1 ", |
"Serial Poti2 ", //25 |
"Serial Poti3 ", |
"Heading X ", |
"Heading Y ", |
"Attitude Source ", |
"I2C Error ", //30 |
"I2C Okay " |
}; |
/****************************************************************/ |
/* Initialization of the USART0 */ |
/****************************************************************/ |
void USART0_Init (void) |
{ |
uint8_t sreg = SREG; |
uint16_t ubrr = (uint16_t) ((uint32_t) F_CPU/(8 * BAUD_RATE) - 1); |
// disable all interrupts before configuration |
cli(); |
// disable RX-Interrupt |
UCSR0B &= ~(1 << RXCIE0); |
// disable TX-Interrupt |
UCSR0B &= ~(1 << TXCIE0); |
// set direction of RXD0 and TXD0 pins |
// set RXD0 (PD0) as an input pin tristate |
DDRD &= ~(1 << DDD0); |
PORTD &= ~(1 << PORTD0); |
// set TXD0 (PD1) as an output pin |
DDRD |= (1 << DDD1); |
PORTD &= ~(1 << PORTD1); |
// USART0 Baud Rate Register |
// set clock divider |
UBRR0H = (uint8_t)(ubrr >> 8); |
UBRR0L = (uint8_t)ubrr; |
// USART0 Control and Status Register A, B, C |
// enable double speed operation |
UCSR0A |= (1 << U2X0); |
// set asynchronous mode |
UCSR0C &= ~(1 << UMSEL01); |
UCSR0C &= ~(1 << UMSEL00); |
// no parity |
UCSR0C &= ~(1 << UPM01); |
UCSR0C &= ~(1 << UPM00); |
// 1 stop bit |
UCSR0C &= ~(1 << USBS0); |
// 8-bit |
UCSR0B &= ~(1 << UCSZ02); |
UCSR0C |= (1 << UCSZ01); |
UCSR0C |= (1 << UCSZ00); |
// enable receiver and transmitter |
UCSR0B |= (1 << RXEN0); |
UCSR0B |= (1 << TXEN0); |
// flush receive buffer |
while ( UCSR0A & (1<<RXC0) ) UDR0; |
// enable RX-Interrupt |
UCSR0B |= (1 << RXCIE0); |
// enable TX-Interrupt |
UCSR0B |= (1 << TXCIE0); |
// initialize the debug timer |
DebugData_Timer = SetDelay(DebugData_Interval); |
PotiTimer = SetDelay(PotiIntervall); |
// unlock rxd_buffer |
rxd_buffer_locked = FALSE; |
pRxData = 0; |
RxDataLen = 0; |
// no bytes to send |
txd_complete = TRUE; |
UART_VersionInfo.SWMajor = VERSION_MAJOR; |
UART_VersionInfo.SWMinor = VERSION_MINOR; |
UART_VersionInfo.SWPatch = VERSION_PATCH; |
UART_VersionInfo.ProtoMajor = VERSION_SERIAL_MAJOR; |
UART_VersionInfo.ProtoMinor = VERSION_SERIAL_MINOR; |
// send version info at startup |
USART0_Putchar ('\r'); |
USART0_Putchar ('\n'); |
USART0_Putchar ('C'); |
USART0_Putchar ('P'); |
USART0_Putchar (':'); |
USART0_Putchar ('V'); |
USART0_Putchar ('0' + VERSION_MAJOR); |
USART0_Putchar ('.'); |
USART0_Putchar ('0' + VERSION_MINOR/10); |
USART0_Putchar ('0' + VERSION_MINOR%10); |
USART0_Putchar ('a' + VERSION_PATCH); |
USART0_Putchar ('\n'); |
// restore global interrupt flags |
SREG = sreg; |
} |
// --------------------------------------------------------------------------------- |
void USART0_EnableTXD(void) |
{ |
DDRD |= (1<<DDD1); // set TXD pin as output |
PORTD &= ~(1 << PORTD1); |
UCSR0B |= (1 << TXEN0); // enable TX in USART |
//changing the interrupt flag yields to strange effects |
//UCSR0B |= (1 << TXCIE0); // enable TX-Interrupt |
} |
// --------------------------------------------------------------------------------- |
void USART0_DisableTXD(void) |
{ |
while(!txd_complete){ }; |
//changing the interrupt flag yields to strange effects |
//UCSR0B &= ~(1 << TXCIE0); // disable TX-Interrupt |
UCSR0B &= ~(1 << TXEN0); // disable TX in USART |
DDRD &= ~(1<<DDD1); // set TXD pin as input |
PORTD &= ~(1 << PORTD1); |
} |
/****************************************************************/ |
/* USART0 transmitter ISR */ |
/****************************************************************/ |
ISR(USART_TX_vect) |
{ |
static uint16_t ptr_txd_buffer = 0; |
uint8_t tmp_tx; |
if(!txd_complete) // transmission not completed |
{ |
ptr_txd_buffer++; // die [0] wurde schon gesendet |
tmp_tx = txd_buffer[ptr_txd_buffer]; |
// if terminating character or end of txd buffer was reached |
if((tmp_tx == '\r') || (ptr_txd_buffer == TXD_BUFFER_LEN)) |
{ |
ptr_txd_buffer = 0; // reset txd pointer |
txd_complete = TRUE; // stop transmission |
} |
UDR0 = tmp_tx; // send current byte will trigger this ISR again |
} |
// transmission completed |
else ptr_txd_buffer = 0; |
} |
/****************************************************************/ |
/* USART0 receiver ISR */ |
/****************************************************************/ |
ISR(USART_RX_vect) |
{ |
static uint16_t crc; |
uint8_t crc1, crc2; |
uint8_t c; |
static uint8_t ptr_rxd_buffer = 0; |
c = UDR0; // catch the received byte |
if(rxd_buffer_locked) return; // if rxd buffer is locked immediately return |
// the rxd buffer is unlocked |
if((ptr_rxd_buffer == 0) && (c == '#')) // if rxd buffer is empty and syncronisation character is received |
{ |
rxd_buffer[ptr_rxd_buffer++] = c; // copy 1st byte to buffer |
crc = c; // init crc |
} |
#if 0 |
else if (ptr_rxd_buffer == 1) // handle address |
{ |
rxd_buffer[ptr_rxd_buffer++] = c; // copy byte to rxd buffer |
crc += c; // update crc |
} |
#endif |
else if (ptr_rxd_buffer < RXD_BUFFER_LEN) // collect incomming bytes |
{ |
if(c != '\r') // no termination character |
{ |
rxd_buffer[ptr_rxd_buffer++] = c; // copy byte to rxd buffer |
crc += c; // update crc |
} |
else // termination character was received |
{ |
// the last 2 bytes are no subject for checksum calculation |
// they are the checksum itself |
crc -= rxd_buffer[ptr_rxd_buffer-2]; |
crc -= rxd_buffer[ptr_rxd_buffer-1]; |
// calculate checksum from transmitted data |
crc %= 4096; |
crc1 = '=' + crc / 64; |
crc2 = '=' + crc % 64; |
// compare checksum to transmitted checksum bytes |
if((crc1 == rxd_buffer[ptr_rxd_buffer-2]) && (crc2 == rxd_buffer[ptr_rxd_buffer-1])) |
{ // checksum valid |
rxd_buffer[ptr_rxd_buffer] = '\r'; // set termination character |
ReceivedBytes = ptr_rxd_buffer + 1;// store number of received bytes |
rxd_buffer_locked = TRUE; // lock the rxd buffer |
// if 2nd byte is an 'R' enable watchdog that will result in an reset |
if(rxd_buffer[2] == 'R') {wdt_enable(WDTO_250MS);} // Reset-Commando |
} |
else |
{ // checksum invalid |
rxd_buffer_locked = FALSE; // unlock rxd buffer |
} |
ptr_rxd_buffer = 0; // reset rxd buffer pointer |
} |
} |
else // rxd buffer overrun |
{ |
ptr_rxd_buffer = 0; // reset rxd buffer |
rxd_buffer_locked = FALSE; // unlock rxd buffer |
} |
} |
// -------------------------------------------------------------------------- |
void AddCRC(uint16_t datalen) |
{ |
uint16_t tmpCRC = 0, i; |
for(i = 0; i < datalen; i++) |
{ |
tmpCRC += txd_buffer[i]; |
} |
tmpCRC %= 4096; |
txd_buffer[i++] = '=' + tmpCRC / 64; |
txd_buffer[i++] = '=' + tmpCRC % 64; |
txd_buffer[i++] = '\r'; |
txd_complete = FALSE; |
UDR0 = txd_buffer[0]; // initiates the transmission (continued in the TXD ISR) |
} |
// -------------------------------------------------------------------------- |
void SendOutData(uint8_t cmd, uint8_t address, uint8_t numofbuffers, ...) // uint8_t *pdata, uint8_t len, ... |
{ |
va_list ap; |
uint16_t pt = 0; |
uint8_t a,b,c; |
uint8_t ptr = 0; |
uint8_t *pdata = 0; |
int len = 0; |
txd_buffer[pt++] = '#'; // Start character |
txd_buffer[pt++] = 'a' + address; // Address (a=0; b=1,...) |
txd_buffer[pt++] = cmd; // Command |
va_start(ap, numofbuffers); |
if(numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
while(len) |
{ |
if(len) |
{ |
a = pdata[ptr++]; |
len--; |
if((!len) && numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
} |
else a = 0; |
if(len) |
{ |
b = pdata[ptr++]; |
len--; |
if((!len) && numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
} |
else b = 0; |
if(len) |
{ |
c = pdata[ptr++]; |
len--; |
if((!len) && numofbuffers) |
{ |
pdata = va_arg(ap, uint8_t*); |
len = va_arg(ap, int); |
ptr = 0; |
numofbuffers--; |
} |
} |
else c = 0; |
txd_buffer[pt++] = '=' + (a >> 2); |
txd_buffer[pt++] = '=' + (((a & 0x03) << 4) | ((b & 0xf0) >> 4)); |
txd_buffer[pt++] = '=' + (((b & 0x0f) << 2) | ((c & 0xc0) >> 6)); |
txd_buffer[pt++] = '=' + ( c & 0x3f); |
} |
va_end(ap); |
AddCRC(pt); // add checksum after data block and initates the transmission |
} |
// -------------------------------------------------------------------------- |
void Decode64(void) |
{ |
uint8_t a,b,c,d; |
uint8_t x,y,z; |
uint8_t ptrIn = 3; |
uint8_t ptrOut = 3; |
uint8_t len = ReceivedBytes - 6; |
while(len) |
{ |
a = rxd_buffer[ptrIn++] - '='; |
b = rxd_buffer[ptrIn++] - '='; |
c = rxd_buffer[ptrIn++] - '='; |
d = rxd_buffer[ptrIn++] - '='; |
//if(ptrIn > ReceivedBytes - 3) break; |
x = (a << 2) | (b >> 4); |
y = ((b & 0x0f) << 4) | (c >> 2); |
z = ((c & 0x03) << 6) | d; |
if(len--) rxd_buffer[ptrOut++] = x; else break; |
if(len--) rxd_buffer[ptrOut++] = y; else break; |
if(len--) rxd_buffer[ptrOut++] = z; else break; |
} |
pRxData = &rxd_buffer[3]; |
RxDataLen = ptrOut - 3; |
} |
// -------------------------------------------------------------------------- |
void USART0_Putchar (char c) |
{ |
// if tx is not enabled return immediatly |
if(!(UCSR0B & (1 << TXEN0))) return; |
// wait until previous character was send |
loop_until_bit_is_set(UCSR0A, UDRE0); |
// send character |
UDR0 = c; |
} |
// -------------------------------------------------------------------------- |
void USART0_ProcessRxData(void) |
{ |
// if data in the rxd buffer are not locked immediately return |
if(!rxd_buffer_locked) return; |
Decode64(); // decode data block in rxd_buffer |
switch(rxd_buffer[1]-'a') // check Slave Address |
{ |
case MK3MAG_ADDRESS: |
switch(rxd_buffer[2]) // check for CmdID |
{ |
case 'w': // old style |
case 'k': // Attitude info from FC |
memcpy(&ExternData, (uint8_t*)pRxData, sizeof(ExternData)); |
RequestFlags |= RQST_COMPASS_HEADING; |
#ifndef HEADTRACKER |
AttitudeSource = ATTITUDE_SOURCE_UART; |
#endif |
Orientation = ExternData.Orientation; |
FC_Connected = 255; |
break; |
default: |
// unsupported command |
break; |
} // case MK3MAG_ADDRESS: |
default: // any Slave Address |
switch(rxd_buffer[2]) // check for CmdID |
{ |
case 'b': // extern control |
memcpy(&ExternControl, (uint8_t*)pRxData, sizeof(ExternControl)); |
#define KEY1 0x01 |
#define KEY2 0x02 |
#define KEY3 0x04 |
#define KEY4 0x08 |
#define KEY5 0x10 |
// use right arrow at display for switching the calstate |
if(ExternControl.RemoteButtons & KEY2) |
{ |
ExternData.CalState++; |
if(ExternData.CalState == 6) ExternData.CalState = 0; |
} |
ConfirmFrame = ExternControl.Frame; |
PC_Connected = 2000; |
break; |
case 'd': // request for the debug data |
DebugData_Interval = (uint16_t) pRxData[0] * 10; |
if(DebugData_Interval>0) RequestFlags |= RQST_DEBUG_DATA; |
PC_Connected = 2000; |
break; |
case 'v': // request version and board release |
RequestFlags |= RQST_VERSION_INFO; |
PC_Connected = 2000; |
break; |
case 'h': // request display data |
if((pRxData[0] & 0x80) == 0x00) // old format |
{ |
DisplayLine = 2; |
Display_Interval = 0; |
} |
else |
{ |
RemoteKeys |= ~pRxData[0]; |
Display_Interval = (uint16_t) pRxData[1] * 10; |
DisplayLine = 4; |
} |
RequestFlags |= RQST_DISPLAY_DATA; |
PC_Connected = 2000; |
break; |
case 'a':// Labels of the Analog Debug outputs |
RequestDebugLabel = pRxData[0]; |
RequestFlags |= RQST_DEBUG_LABEL; |
PC_Connected = 2000; |
break; |
case 'g':// get extern control data |
RequestFlags |= RQST_EXTERN_CTRL; |
PC_Connected = 2000; |
break; |
default: |
// unsupported command |
break; |
} |
break; // default: |
} |
// unlock the rxd buffer after processing |
pRxData = 0; |
RxDataLen = 0; |
rxd_buffer_locked = FALSE; |
} |
//--------------------------------------------------------------------------------------------- |
void USART0_TransmitTxData(void) |
{ |
if(!(UCSR0B & (1 << TXEN0))) return; |
if(!txd_complete) return; |
if((RequestFlags & RQST_DEBUG_LABEL)) |
{ |
uint8_t label[16]; |
memcpy_P(label, ANALOG_LABEL[RequestDebugLabel], 16); // read lable from flash to sram buffer |
SendOutData('A', MK3MAG_ADDRESS, 2, (uint8_t *)&RequestDebugLabel, sizeof(RequestDebugLabel), label, 16); |
RequestDebugLabel = 0xFF; |
RequestFlags &= ~RQST_DEBUG_LABEL; |
} |
else if(ConfirmFrame) |
{ |
SendOutData('B', MK3MAG_ADDRESS, 1, (uint8_t *) &ConfirmFrame, sizeof(ConfirmFrame)); |
ConfirmFrame = 0; |
} |
else if((((DebugData_Interval > 0) && CheckDelay(DebugData_Timer)) || (RequestFlags & RQST_DEBUG_DATA))) |
{ |
SetDebugValues(); |
SendOutData('D', MK3MAG_ADDRESS, 1, (uint8_t *) &DebugOut, sizeof(DebugOut)); |
DebugData_Timer = SetDelay(DebugData_Interval); |
RequestFlags &= ~RQST_DEBUG_DATA; |
} |
else if(( ((Display_Interval > 0) && CheckDelay(Display_Timer)) || (RequestFlags & RQST_DISPLAY_DATA))) |
{ |
if(DisplayLine > 3)// new format |
{ |
Menu_Update(RemoteKeys); |
RemoteKeys = 0; |
SendOutData('H', MK3MAG_ADDRESS, 1, (uint8_t *)DisplayBuff, 80); |
} |
else // old format |
{ |
LCD_printfxy(0,0,"!!! INCOMPATIBLE !!!"); |
SendOutData('H', MK3MAG_ADDRESS, 2, &DisplayLine, sizeof(DisplayLine), (uint8_t *)DisplayBuff, 20); |
if(DisplayLine++ > 3) DisplayLine = 0; |
} |
Display_Timer = SetDelay(Display_Interval); |
RequestFlags &= ~RQST_DISPLAY_DATA; |
} |
else if((RequestFlags & RQST_EXTERN_CTRL)) |
{ |
SendOutData('G', MK3MAG_ADDRESS, 1, (uint8_t *) &ExternControl,sizeof(ExternControl)); |
RequestFlags &= ~RQST_EXTERN_CTRL; |
} |
else if((RequestFlags & RQST_COMPASS_HEADING)) |
{ |
SendOutData('K', FC_ADDRESS, 1, (uint8_t *) &Heading, sizeof(Heading)); // send compass heading to FC |
RequestFlags &= ~RQST_COMPASS_HEADING; |
} |
else if((RequestFlags & RQST_VERSION_INFO)) |
{ |
SendOutData('V', MK3MAG_ADDRESS, 1, (uint8_t *) &UART_VersionInfo, sizeof(UART_VersionInfo)); |
RequestFlags &= ~RQST_VERSION_INFO; |
} |
#ifdef HEADTRACKER |
else if((PotiIntervall > 0) && CheckDelay(PotiTimer)) |
{ |
SendOutData('y', FC_ADDRESS, 1, (uint8_t *) PotiToFC, sizeof(PotiToFC)); // send compass heading to FC |
PotiTimer = SetDelay(PotiIntervall); |
} |
#endif |
} |
void USART0_Print(int8_t *msg) |
{ |
uint8_t i = 0; |
while(msg[i] != 0) |
{ |
USART0_Putchar(msg[i++]); |
} |
} |
/tags/V0.23a/uart.h |
---|
0,0 → 1,78 |
#ifndef _UART_H_ |
#define _UART_H_ |
#include <inttypes.h> |
#include "printf_P.h" |
#define NICK 0 |
#define ROLL 1 |
#define BAUD_RATE 57600 |
extern uint16_t DebugData_Timer; |
void USART0_Init (void); |
void USART0_EnableTXD(void); |
void USART0_DisableTXD(void); |
void USART0_TransmitTxData(void); |
void USART0_ProcessRxData(void); |
void USART0_Putchar(char c); |
void USART0_Print(int8_t *msg); |
#define printf_P(format, args...) _printf_P(&USART0_Putchar, format , ## args) |
#define printf(format, args...) _printf_P(&USART0_Putchar, PSTR(format) , ## args) |
typedef struct |
{ |
uint8_t Digital[2]; |
uint16_t Analog[32]; // Debugvalues |
} DebugOut_t; |
extern DebugOut_t DebugOut; |
typedef struct |
{ |
int16_t Attitude[2]; // nick and roll angle in 0.1 deg |
uint8_t UserParam[2]; |
uint8_t CalState; |
uint8_t Orientation; |
} ExternData_t; |
extern ExternData_t ExternData; |
typedef struct |
{ |
uint8_t Digital[2]; |
uint8_t RemoteButtons; |
int8_t Nick; |
int8_t Roll; |
int8_t Yaw; |
uint8_t Gas; |
int8_t Height; |
uint8_t free; |
uint8_t Frame; |
uint8_t Config; |
} ExternControl_t; |
extern ExternControl_t ExternControl; |
typedef struct |
{ |
uint8_t SWMajor; |
uint8_t SWMinor; |
uint8_t ProtoMajor; |
uint8_t ProtoMinor; |
uint8_t SWPatch; |
uint8_t Reserved[5]; |
} UART_VersionInfo_t; |
extern uint16_t PC_Connected; |
extern uint16_t FC_Connected; |
#endif //_UART_H_ |
/tags/V0.23a |
---|
Property changes: |
Added: tsvn:logminsize |
+8 |
\ No newline at end of property |