/branches/MK3Mag V0.14 Code Redesign Killagreg/main.h |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg/Compass.pnproj |
---|
File deleted |
\ No newline at end of file |
/branches/MK3Mag V0.14 Code Redesign Killagreg/makefile |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg/twislave.c |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg/timer0.c |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg/analog.c |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg/Hex-Files/BootLoader_MEGA168_8MHZ_V0.2.hex |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg/twislave.h |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg/led.c |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg/timer0.h |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg/analog.h |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg/led.h |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg/uart.c |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg/License.txt |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg/Compassl.pnps |
---|
File deleted |
\ No newline at end of file |
/branches/MK3Mag V0.14 Code Redesign Killagreg/uart.h |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg/main.c |
---|
File deleted |
/branches/MK3Mag V0.14 Code Redesign Killagreg |
---|
Property changes: |
Deleted: tsvn:logminsize |
-8 |
\ No newline at end of property |
/tags/V0.21b/main.h |
---|
File deleted |
/tags/V0.21b/Compass.pnproj |
---|
File deleted |
\ No newline at end of file |
/tags/V0.21b/makefile |
---|
File deleted |
/tags/V0.21b/twislave.c |
---|
File deleted |
/tags/V0.21b/timer0.c |
---|
File deleted |
/tags/V0.21b/analog.c |
---|
File deleted |
/tags/V0.21b/Hex-Files/MK3Mag_MEGA168_V0_21b_SVN48.hex |
---|
File deleted |
/tags/V0.21b/Hex-Files/BootLoader_MEGA168_8MHZ_V0.2.hex |
---|
File deleted |
/tags/V0.21b/twislave.h |
---|
File deleted |
/tags/V0.21b/led.c |
---|
File deleted |
/tags/V0.21b/timer0.h |
---|
File deleted |
/tags/V0.21b/analog.h |
---|
File deleted |
/tags/V0.21b/led.h |
---|
File deleted |
/tags/V0.21b/uart.c |
---|
File deleted |
/tags/V0.21b/License.txt |
---|
File deleted |
/tags/V0.21b/Compassl.pnps |
---|
File deleted |
\ No newline at end of file |
/tags/V0.21b/uart.h |
---|
File deleted |
/tags/V0.21b/main.c |
---|
File deleted |
/tags/V0.21b |
---|
Property changes: |
Deleted: tsvn:logminsize |
-8 |
\ No newline at end of property |
/tags/V0.14/timer0.c |
---|
File deleted |
/tags/V0.14/analog.c |
---|
File deleted |
/tags/V0.14/Hex-Files/BootLoader_MEGA168_8MHZ_V0.2.hex |
---|
File deleted |
/tags/V0.14/Hex-Files/MK3Mag_MEGA168_V0_14.hex |
---|
File deleted |
/tags/V0.14/main.lss |
---|
File deleted |
/tags/V0.14/twislave.h |
---|
File deleted |
/tags/V0.14/timer0.h |
---|
File deleted |
/tags/V0.14/analog.h |
---|
File deleted |
/tags/V0.14/main.sym |
---|
File deleted |
/tags/V0.14/uart.c |
---|
File deleted |
/tags/V0.14/License.txt |
---|
File deleted |
/tags/V0.14/Compassl.pnps |
---|
File deleted |
\ No newline at end of file |
/tags/V0.14/main.map |
---|
File deleted |
/tags/V0.14/uart.h |
---|
File deleted |
/tags/V0.14/main.c |
---|
File deleted |
/tags/V0.14/old_macros.h |
---|
File deleted |
/tags/V0.14/main.h |
---|
File deleted |
/tags/V0.14/Compass.pnproj |
---|
File deleted |
\ No newline at end of file |
/tags/V0.14/makefile |
---|
File deleted |
/tags/V0.14/twislave.c |
---|
File deleted |
/tags/V0.14 |
---|
Property changes: |
Deleted: tsvn:logminsize |
-8 |
\ No newline at end of property |
/tags/V0.23a/uart.c |
---|
File deleted |
/tags/V0.23a/Compassl.pnps |
---|
File deleted |
\ No newline at end of file |
/tags/V0.23a/License.txt |
---|
File deleted |
/tags/V0.23a/uart.h |
---|
File deleted |
/tags/V0.23a/printf_P.c |
---|
File deleted |
/tags/V0.23a/main.c |
---|
File deleted |
/tags/V0.23a/printf_P.h |
---|
File deleted |
/tags/V0.23a/old_macros.h |
---|
File deleted |
/tags/V0.23a/main.h |
---|
File deleted |
/tags/V0.23a/Compass.pnproj |
---|
File deleted |
\ No newline at end of file |
/tags/V0.23a/makefile |
---|
File deleted |
/tags/V0.23a/twislave.c |
---|
File deleted |
/tags/V0.23a/timer0.c |
---|
File deleted |
/tags/V0.23a/analog.c |
---|
File deleted |
/tags/V0.23a/Hex-Files/BootLoader_MEGA168_8MHZ_V0.2.hex |
---|
File deleted |
/tags/V0.23a/Hex-Files/MK3Mag_MEGA168_V0_23a_SVN72.hex |
---|
File deleted |
/tags/V0.23a/twislave.h |
---|
File deleted |
/tags/V0.23a/menu.c |
---|
File deleted |
/tags/V0.23a/led.c |
---|
File deleted |
/tags/V0.23a/timer0.h |
---|
File deleted |
/tags/V0.23a/analog.h |
---|
File deleted |
/tags/V0.23a/led.h |
---|
File deleted |
/tags/V0.23a/menu.h |
---|
File deleted |
/tags/V0.23a |
---|
Property changes: |
Deleted: tsvn:logminsize |
-8 |
\ No newline at end of property |
/tags/V0.22c/printf_P.h |
---|
File deleted |
/tags/V0.22c/old_macros.h |
---|
File deleted |
/tags/V0.22c/main.h |
---|
File deleted |
/tags/V0.22c/Compass.pnproj |
---|
File deleted |
\ No newline at end of file |
/tags/V0.22c/makefile |
---|
File deleted |
/tags/V0.22c/twislave.c |
---|
File deleted |
/tags/V0.22c/timer0.c |
---|
File deleted |
/tags/V0.22c/analog.c |
---|
File deleted |
/tags/V0.22c/Hex-Files/BootLoader_MEGA168_8MHZ_V0.2.hex |
---|
File deleted |
/tags/V0.22c/Hex-Files/MK3Mag_MEGA168_V0_22c_SVN62.hex |
---|
File deleted |
/tags/V0.22c/twislave.h |
---|
File deleted |
/tags/V0.22c/menu.c |
---|
File deleted |
/tags/V0.22c/led.c |
---|
File deleted |
/tags/V0.22c/timer0.h |
---|
File deleted |
/tags/V0.22c/analog.h |
---|
File deleted |
/tags/V0.22c/led.h |
---|
File deleted |
/tags/V0.22c/menu.h |
---|
File deleted |
/tags/V0.22c/uart.c |
---|
File deleted |
/tags/V0.22c/Compassl.pnps |
---|
File deleted |
\ No newline at end of file |
/tags/V0.22c/License.txt |
---|
File deleted |
/tags/V0.22c/uart.h |
---|
File deleted |
/tags/V0.22c/printf_P.c |
---|
File deleted |
/tags/V0.22c/main.c |
---|
File deleted |
/tags/V0.22c |
---|
Property changes: |
Deleted: tsvn:logminsize |
-8 |
\ No newline at end of property |
/trunk/led.c |
---|
File deleted |
/trunk/led.h |
---|
File deleted |
/trunk/Hex-Files/BootLoader_MEGA168_8MHZ_V0.2.hex |
---|
File deleted |
/trunk/Hex-Files/MK3Mag_MEGA168_V0_23a_SVN72.hex |
---|
File deleted |
/trunk/menu.c |
---|
File deleted |
/trunk/printf_P.c |
---|
File deleted |
/trunk/menu.h |
---|
File deleted |
/trunk/printf_P.h |
---|
File deleted |
/trunk/License.txt |
---|
File deleted |
/trunk/Compass.pnproj |
---|
1,0 → 0,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> |
<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> |
/trunk/Compass_V0_4.hex |
---|
0,0 → 1,394 |
:100000000C945A000C9475000C9475000C947500B7 |
:100010000C9475000C9475000C9475000C9475008C |
:100020000C9475000C9475000C9475000C9475007C |
:100030000C9475000C9475000C9475000C9475006C |
:100040000C94A9070C9475000C94F9040C94750099 |
:100050000C9429040C9475000C9475000C94750094 |
:100060000C945E080C947500083B3BD74ABC846E28 |
:10007000023D2FC1FEBD9A31743DDA3D83BE117F32 |
:10008000C73E4CBBE5BEAAAA6C3F80000000082911 |
:10009000573F9F2D49CBA5310F76C73493F27E375A |
:1000A000D00D013AB60B613D2AAAAB3F0000003FDC |
:1000B0008000000011241FBECFEFD4E0DEBFCDBF13 |
:1000C00013E0A0E0B1E0EEE6F6E102C005900D928B |
:1000D000AA31B107D9F714E0AAE1B3E001C01D923B |
:1000E000A636B107E1F70C940A030C94000096B50C |
:1000F000980F86B5891B87FDFCCF0895EF92FF927C |
:100100000F931F934091410350914203440F551F99 |
:1001100080914D0390914E0320913F033091400315 |
:10012000821B930B23E0E22EF12C840F951FB70165 |
:100130000E94100B8B017093420360934103209146 |
:10014000550330915603220F331F80914503909140 |
:10015000460340913D0350913E03841B950B820F53 |
:10016000931FB7010E94100BFB017093560360931D |
:1001700055032091490330914A03220F331F809188 |
:100180005703909158034091590350915A03841B8F |
:10019000950B820F931FB7010E94100B9B01709368 |
:1001A0004A036093490380914B0390914C03081BD1 |
:1001B000190B1093520300935103809147039091C0 |
:1001C0004803E81BF90BF0935403E0935303809129 |
:1001D000430390914403281B390B30935003209321 |
:1001E0004F031F910F91FF90EF9008952F923F9230 |
:1001F0004F925F926F927F928F929F92AF92BF9237 |
:10020000CF92DF92EF92FF920F931F93CF93DF93E2 |
:10021000CDB7DEB72E970FB6F894DEBF0FBECDBFB9 |
:100220008091CF039091D003AA2797FDA095BA2F74 |
:10023000BC01CD010E949609DC01CB012BED3FE012 |
:1002400049E450E4BC01CD010E94AC0ADC01CB01C1 |
:1002500020E030E044E353E4BC01CD010E943309C7 |
:100260005B016C018091D1039091D203AA2797FD85 |
:10027000A095BA2FBC01CD010E949609DC01CB01EB |
:100280002BED3FE049E450E4BC01CD010E94AC0AF3 |
:10029000DC01CB0120E030E044E353E4BC01CD01BC |
:1002A0000E94330969837A838B839C8380915103F5 |
:1002B00090915203AA2797FDA095BA2FBC01CD01BA |
:1002C0000E9496097B018C01809153039091540305 |
:1002D000AA2797FDA095BA2FBC01CD010E949609CF |
:1002E0006D837E838F83988780914F039091500315 |
:1002F000909581959F4FAA2797FDA095BA2FBC0195 |
:10030000CD010E94960969877A878B879C87C601F1 |
:10031000B5010E942D09DC01CB019C01AD01C80192 |
:10032000B7010E94AC0A3B014C01C601B5010E9415 |
:10033000F40A5B016C019B01AC016D817E818F81B0 |
:1003400098850E94AC0A7B018C0169817A818B813E |
:100350009C810E94F40A1B012C019B01AC01C80185 |
:10036000B7010E94AC0ADC01CB019C01AD01C401C4 |
:10037000B3010E94BC083B014C01A60195016985AF |
:100380007A858B859C850E94AC0A7B018C016981F2 |
:100390007A818B819C810E942D095B016C019B01FC |
:1003A000AC01C801B7010E94AC0ADC01CB019C0181 |
:1003B000AD01C401B3010E94BB083B014C01A60181 |
:1003C00095016D817E818F8198850E94AC0A7B01A9 |
:1003D0008C01A201910169857A858B859C850E949B |
:1003E000AC0ADC01CB019C01AD01C801B7010E9440 |
:1003F000BC087B018C0120E030E040E050E0C4010B |
:10040000B3010E94B309882369F420E030E040E0A2 |
:1004100050E0C801B7010E94B30988231CF48AE5A3 |
:1004200090E0C8C020E030E040E050E0C401B301FB |
:100430000E94B309882379F420E030E040E050E0E6 |
:10044000C801B7010E94B60918162CF4EEE0F1E0DD |
:10045000FE87ED87B1C020E030E040E050E0C4010D |
:10046000B3010E94B30988234CF5A4019301C8018C |
:10047000B7010E943309DC01CB01BC01CD010E9410 |
:10048000FE08DC01CB0120E030E044E353E4BC0192 |
:10049000CD010E94AC0ADC01CB012BED3FE049E429 |
:1004A00050E4BC01CD010E943309DC01CB019C0169 |
:1004B000AD0160E070E084E393E472C020E030E0DE |
:1004C00040E050E0C401B3010E94B60918165CF583 |
:1004D00020E030E040E050E0C801B7010E94B309DD |
:1004E00088230CF5A4019301C801B7010E943309C8 |
:1004F000DC01CB01BC01CD010E94FE08DC01CB0177 |
:1005000020E030E044E353E4BC01CD010E94AC0A9A |
:10051000DC01CB012BED3FE049E450ECBC01CD0107 |
:100520000E9433093FC020E030E040E050E0C401C9 |
:10053000B3010E94B60918160CF03EC020E030E06E |
:1005400040E050E0C801B7010E94B6091816A4F5B2 |
:10055000A4019301C801B7010E943309DC01CB015A |
:10056000BC01CD010E94FE08DC01CB0120E030E09F |
:1005700044E353E4BC01CD010E94AC0ADC01CB0191 |
:100580002BED3FE049E450E4BC01CD010E9433096A |
:10059000DC01CB019C01AD0160E070E084EB93E4F1 |
:1005A0000E94BB08DC01CB01BC01CD010E9479098E |
:1005B000DC01CB019E878D878D859E85E1E08936A4 |
:1005C0009E0724F490936104809360048D859E853A |
:1005D00090935D0380935C030A9690931C03809331 |
:1005E0001B032E960FB6F894DEBF0FBECDBFDF9172 |
:1005F000CF911F910F91FF90EF90DF90CF90BF9020 |
:10060000AF909F908F907F906F905F904F903F90B2 |
:100610002F900895CFEFD4E0DEBFCDBF88E087B93B |
:1006200088B984EF8AB980EA8BB984E084B985E31C |
:1006300085B95F9A0E947A060E9408080E943608CF |
:10064000789484E690E00E9415089093C303809309 |
:10065000C20380E50E9458082091100130911101D9 |
:100660008091120190911301280F391F809114017C |
:1006700090911501280F391F809116019091170153 |
:10068000280F391F37FF02C02D5F3F4F3595279543 |
:100690003595279530934C0320934B032091080107 |
:1006A0003091090180910A0190910B01280F391FA7 |
:1006B00080910C0190910D01280F391F80910E013E |
:1006C00090910F01280F391F37FF02C02D5F3F4F58 |
:1006D0003595279535952795309348032093470303 |
:1006E000209100013091010180910201909103015C |
:1006F000280F391F8091040190910501280F391F9F |
:100700008091060190910701280F391F37FF02C021 |
:100710002D5F3F4F359527953595279530934403A9 |
:10072000209343031092C50383E08093C60387E0C0 |
:100730008093C7035F9A8BB18F798BB982E090E089 |
:100740000E94290880E00E94430890934E03809302 |
:100750004D0381E00E944308909358038093570310 |
:1007600087E00E944308909346038093450381E00D |
:1007700090E00E9429085F988BB180668BB982E077 |
:1007800090E00E94290880E00E9443089093400373 |
:1007900080933F0381E00E94430890935A03809323 |
:1007A000590387E00E94430890933E0380933D03E2 |
:1007B00081E090E00E9429080E947E008091510310 |
:1007C0009091520390934504809344048091530385 |
:1007D00090915403909347048093460480914F0373 |
:1007E0009091500390934904809348048091410371 |
:1007F0009091420390934B0480934A048091550357 |
:100800009091560390934D0480934C04809149033A |
:1008100090914A0390934F0480934E048091CF03AC |
:100820009091D00390935104809350048091D10310 |
:100830009091D20390935304809352040E94F60047 |
:100840000E94B60683E680931A030E944007519ADD |
:1008500071CF1F920F920FB60F9211248F939F9317 |
:10086000EF93FF93809118038823E1F4809129038B |
:1008700090912A03019690932A0380932903FC0107 |
:10088000E25AFC4FE081ED3019F08436910539F4DD |
:1008900010922A031092290381E080931803E093B9 |
:1008A000C60004C010922A0310922903FF91EF9111 |
:1008B0009F918F910F900FBE0F901F901895809170 |
:1008C000C00086FF29C080911803882309F5809114 |
:1008D0002B0390912C03019690932C0380932B0370 |
:1008E000FC01E25AFC4FE081ED3019F084369105AD |
:1008F00039F410922C0310922B0381E0809318039B |
:100900008091C00081608093C000E093C60008958C |
:1009100010922C0310922B0308951F93CF93DF9313 |
:10092000EC0110E0662309F460C0A22FBB271297E8 |
:10093000E42FFF27E252FC4F30813D534F5FE42FFD |
:10094000FF27E252FC4F50815D534F5FE42FFF279A |
:10095000E252FC4F70817D534F5FE42FFF27E2523C |
:10096000FC4FE081ED534F5F842F9927A817B907FB |
:10097000E4F1832F9927880F991F880F991F352F2E |
:1009800032953F70382B852F99278F70907054E0E7 |
:10099000880F991F5A95E1F7572F56955695582B62 |
:1009A000872F99278370907026E0880F991F2A95CA |
:1009B000E1F78E2B61506F3FC1F0FE01E10FF11D99 |
:1009C00030831F5F61506F3F81F0FE01E10FF11D29 |
:1009D00050831F5F61506F3F41F0FE01E10FF11D39 |
:1009E00080831F5F662309F0A3CFDF91CF911F9112 |
:1009F00008951F920F920FB60F9211242F933F93D9 |
:100A00004F935F938F939F93AF93BF93CF93DF9356 |
:100A1000EF93FF938091C6008093270340913103A9 |
:100A2000443610F010923203509127035D3009F0E4 |
:100A30004DC080913203823009F048C010923203D9 |
:100A4000A42FBB27A252BC4FFD0132978081209179 |
:100A50002D0330912E03281B3109ED012197888148 |
:100A6000281B3109C9019F7090932E0380932D0399 |
:100A7000689415F8969587951694E1F7982F935CEE |
:100A800090932F032F733070235C20933003808169 |
:100A9000981709F06AC08881281709F066C081E0BC |
:100AA0008093260340931D035C938091E00382357D |
:100AB00009F05BC088E190E02CE00FB6F894A895AF |
:100AC000809360000FBE209360004FC020913203DE |
:100AD000822F992781309105F9F0823091051CF41D |
:100AE000892B21F040C0029711F13DC0809127036E |
:100AF000833239F480912603882319F481E08093AE |
:100B00003203809127038093DE0381E080933103D9 |
:100B100080912703992722C02F5F20933203E42F6F |
:100B2000FF27E252FC4F80912703808309C0E42F06 |
:100B3000FF27E252FC4F809127038083443620F444 |
:100B40004F5F4093310302C010923203209127037C |
:100B500080912D0390912E03820F911D90932E036F |
:100B600080932D0302C010923203FF91EF91DF9129 |
:100B7000CF91BF91AF919F918F915F914F913F9195 |
:100B80002F910F900FBE0F901F901895AC01A0E011 |
:100B9000B0E09D01A817B90748F4EEE5F3E08191B4 |
:100BA000280F311D1196A417B507C8F33F70FD013A |
:100BB000E25AFC4FC90176E0969587957A95E1F760 |
:100BC000835C80831196FD01E25AFC4F2F733070D5 |
:100BD000822F835C8083A15ABC4F8DE08C9310924E |
:100BE000180380915E038093C60008951F93CF93EE |
:100BF000DF93382FEA01722F10E083E280935E03C7 |
:100C000060935F0330936003A3E0B0E0772309F4BF |
:100C100058C0772311F4972F07C0FE01E10FF11D93 |
:100C20001F5F9081715011F4472F0EC0FE01E10F3C |
:100C3000F11D1F5F4081715039F0FE01E10FF11D80 |
:100C40001F5F6081715001C0672FFD01E25AFC4FA8 |
:100C5000892F86958695835C80831196FD01E25AE3 |
:100C6000FC4F892F99278370907024E0880F991F7B |
:100C70002A95E1F755279A0194E0369527959A959C |
:100C8000E1F7822B835C80831196FD01E25AFC4FD1 |
:100C90004F705070440F551F440F551F862F9927D2 |
:100CA00026E0969587952A95E1F7842B835C8083CF |
:100CB0001196FD01E25AFC4F6F73635C60831196DD |
:100CC000A5CFCD010E94C605DF91CF911F91089558 |
:100CD000CF93C82F8A3019F48DE00E946806809166 |
:100CE000C00085FFFCCFC093C60080E090E0CF91AC |
:100CF0000895089588E18093C1008091C0008260CA |
:100D00008093C0008091C10080688093C100809171 |
:100D1000C10080648093C10080E18093C40088ECAE |
:100D200090E00E9415089093C3038093C2038AE069 |
:100D30000E94680683E40E94680680E50E946806B7 |
:100D40008AE30E94680686E50E94680680E30E94A6 |
:100D500068068EE20E94680680E30E94680684E3CB |
:100D60000E9468068AE00E94680608951F93CF9348 |
:100D7000DF93CDB7DEB722970FB6F894DEBF0FBE74 |
:100D8000CDBF80912603882309F470C01FEF109314 |
:100D9000C4038091E00399278736910509F45CC06C |
:100DA000883691056CF48136910509F449C0813685 |
:100DB00091050CF459C0843691050CF055C025C03E |
:100DC00086379105C9F1873791052CF4883691054E |
:100DD00009F448C049C08737910509F045C0209102 |
:100DE0001D0343E064E08FEC93E00E948D0480914A |
:100DF000620490916304019690936304809362046B |
:100E000081E0809322035F9A2FC020911D0343E06D |
:100E10006BE083ED93E00E948D048091DB039927C2 |
:100E20009093D0038093CF038091DC039927909314 |
:100E3000D2038093D10318C081E08093250312C0B0 |
:100E400020911D0343E062E0CE0101960E948D04D3 |
:100E500089818093240306C010931A0381E0809354 |
:100E6000230302C010931A031092260322960FB692 |
:100E7000F894DEBF0FBECDBFDF91CF911F910895D3 |
:100E80008091C2039091C3030E941E088823A1F0A1 |
:100E900080911803882381F022E242E454E06091BB |
:100EA0005B0384E40E94F6058AEF90E00E94150837 |
:100EB0009093C3038093C20380912503882371F02C |
:100EC00080911803882351F02AE045EC53E06091AB |
:100ED0005B0386E50E94F6051092250360912403CA |
:100EE0006F3F91F0862F992734E0880F991F3A952C |
:100EF000E1F7885E9E4F605D20E1AC0181E40E94D5 |
:100F0000F6058FEF8093240380912303882371F0EB |
:100F100080911803882351F02BE043ED53E060915A |
:100F20005B0387E40E94F60510922303809122035D |
:100F3000882371F080911803882351F022E04CE55A |
:100F400053E060915B038BE40E94F605109222034C |
:100F500008951F920F920FB60F9211242F933F9373 |
:100F60008F939F9386B5815686BD809164048F5F71 |
:100F70008093640420913A0330913B032F5F3F4FED |
:100F800030933B0320933A0381E02C37380731F448 |
:100F90002A9A10923B0310923A0308C080911B03D7 |
:100FA00090911C032817390709F42A988091390376 |
:100FB000815080933903882311F58AE080933903A7 |
:100FC0008091370390913803019690933803809372 |
:100FD00037038091350390913603009729F00197EC |
:100FE00090933603809335038091330390913403BB |
:100FF000009729F0019790933403809333039F91D6 |
:101000008F913F912F910F900FBE0F901F901895C9 |
:1010100082E085BD80916E00816080936E0080913A |
:101020006E00806480936E000895209137033091A4 |
:101030003803280F391FC9010197089520913703FC |
:1010400030913803821B930B892F99278078992739 |
:101050000895CF93DF930E941508EC01CE010E9402 |
:101060001E088823D9F3DF91CF91089510927C0058 |
:1010700087E880937A0010927C0080917A008064E7 |
:1010800080937A00089580937C0080917A0080613B |
:1010900080937A0080917A00806480937A008091B6 |
:1010A0007A0084FFFCCF80917800909179000895B8 |
:1010B0008093BA0085EC8093BC0008951F920F9234 |
:1010C0000FB60F9211248F939F938091B9009927A7 |
:1010D000887F907080389105F9F08138910534F45B |
:1010E0000097D1F18036910579F03BC0883B91059E |
:1010F000F1F0893B910524F4883A9105C1F031C0A3 |
:10110000883F910521F12DC08091BC0080688093BB |
:10111000BC0010923C0328C08091BB008093650402 |
:1011200084EF91E090933603809335030CC0809157 |
:101130003C03882331F48093BB008F5F80933C0392 |
:1011400002C01092BB008091BC0080680BC08091EF |
:10115000BC0080698093BC008091BC008069809352 |
:10116000BC0085EC8093BC009F918F910F900FBEC7 |
:101170000F901F9018955058192E90D101D040C152 |
:10118000BA176207730784079507B1F188F40EF464 |
:1011900010940B2EBA2FA02D062E622F202D072E75 |
:1011A000732F302D082E842F402D092E952F502D72 |
:1011B000FF275523B9F0591B49F0573E98F0469543 |
:1011C00037952795A795F0405395C9F776F0BA0F54 |
:1011D000621F731F841F30F4879577956795B795C5 |
:1011E000F040939517FA0F2E0895BF1BBB27BA0B3B |
:1011F000620B730B840BF6CFDEF67CC11F930F934B |
:101200000027192F10789F775FE340E86130710560 |
:101210008407950718F000680E94F309912B6F93DB |
:101220007F938F939F930E94070BE8E6F0E003D132 |
:101230005F914F913F912F910E94AC0A002351F092 |
:101240002BED3FE049EC5FE300E8902717FD506885 |
:101250000E94BC080F911F91089550E449EC3FE0B3 |
:101260002BED6ED0A2C01AD101D0CAC0552359F0BF |
:10127000992369F09F575F57951B33F442F49038D8 |
:1012800011F4915805C0D4C091589F3F09F432C160 |
:10129000BB27112462177307840730F4660F771F8A |
:1012A000881FBB1F915098F311D00F920FD00F924F |
:1012B0000DD0A0E82617370748071B0609F0A048FD |
:1012C000BA2F602D7F918F9100240895A0E800240B |
:1012D000621773078407B10528F0621B730B840B38 |
:1012E000B1090A2A660F771F881FBB1FA69581F7D1 |
:1012F000089597FBDFD09F3738F0FEE9F91B982F50 |
:10130000872F762F6B2F05C0F2C09695879577951E |
:101310006795F150D0F73EF4909580957095619562 |
:101320007F4F8F4F9F4F0895E89403C097FB0EF4B3 |
:10133000F3DFB62F672F782F892F9EE9002460C036 |
:101340005F77552319F444230AF072C02F933F931B |
:101350004F935F9388DF55274427CED05F914F91FD |
:101360003F912F91F9C00ED05EF004C00BD026F053 |
:1013700001C008D019F020F48FEF089580E008959F |
:1013800081E0089597FB092E052600F8689489D01E |
:10139000E89407FC07C0621773078407950721F0DC |
:1013A00008F400940794989408951F939F7750EC45 |
:1013B00049E43FE02BEDE0DE10E89F775FE349EC86 |
:1013C0003FE02BED621773078407950720F050EC80 |
:1013D00049E4D2DE11271BD19068EEE8F0E02BD073 |
:1013E00091271F9108959B01AC019FE380E8772727 |
:1013F00066270C9433099A95BB0F661F771F881FC9 |
:1014000011249923A1F08823B2F79F3F59F0BB0F15 |
:1014100048F421F4002011F460FF04C06F5F7F4F97 |
:101420008F4F9F4F881F9795879597F908955FC0B5 |
:101430009FEF80EC0895FF92EF92DF92CF92BF92E0 |
:101440006B017C01B59016D0B590BB2069F09F93DD |
:101450008F937F936F93B601C7010CD02F913F916B |
:101460004F915F910E943309BF90CF90DF90EF9032 |
:10147000FF900895D0D002C09601A701EF93FF938B |
:101480000E94AC0AFF91EF91C6D0EF93FF930E94A8 |
:10149000BC08FF91EF91BA9479F70895052E0926BB |
:1014A00007FA440F551F5F3F79F0AA27A51708F0E8 |
:1014B00051E04795880F991F9F3F31F0BB27B9171F |
:1014C00008F091E0879508959F919F911124B0CFE6 |
:1014D00097FB880F991F9F3F31F0BB27B91708F082 |
:1014E00091E0879508959F919F911124A1CF662740 |
:1014F0007727882799270895EBDFCF93DF93D52FA0 |
:10150000C42F55274427332722279923D9F09F3703 |
:10151000C8F0F92F75DF592F482F372F262FF639AE |
:1015200068F4E7DE03DFC030CD0721F069937993DB |
:10153000899399939058DF91CF911ECE9927882750 |
:1015400077276627C030CD0721F029933993499337 |
:101550005993DF91CF9154CFA1DF01D051CF99237F |
:1015600039F0552329F09F575F57950F13F49AF1DF |
:10157000C1CF91589F3FE1F3629FA12D0F92BB27EE |
:10158000639FA00DB11DEE27729FA00DB11DEE1F30 |
:10159000AF93AA27649FB00DE11D739FB00DE11DAD |
:1015A000AA1F6627829FB00DE11DA61F5527749FB5 |
:1015B000E00DA11D551F839FE00DA11D561F849FA7 |
:1015C000A00D511D852F7A2F6E2F1F900F9088230D |
:1015D0001AF4939539F42CCF000C111CBB1F661F15 |
:1015E000771F881F012808959F939F77993358F09C |
:1015F00050E449EC3FE02BEDA3DE5FEB49EC3FE02C |
:101600002BEDBADDD2DE5F915078952708959B01CE |
:10161000AC010C94AC0A55914591359125910895F2 |
:1016200097FB092E07260AD077FD04D00CD006D0F0 |
:1016300000201AF4709561957F4F0895F6F7909504 |
:1016400081959F4F0895AA1BBB1B51E107C0AA1F9C |
:10165000BB1FA617B70710F0A61BB70B881F991F53 |
:0E1660005A95A9F780959095BC01CD0108958B |
:10166E00DEFEE8FE2C002100FBFF1AFF4200F60012 |
:10167E004B004CFF48FE5AFF4D61676E6574204E5D |
:10168E0020202020202020204D61676E657420527E |
:10169E0020202020202020204D61676E6574205A66 |
:1016AE002020202020202020526F68202020204E35 |
:1016BE002020202020202020526F68202020205221 |
:1016CE002020202020202020526F68202020205A09 |
:1016DE0020202020202020204C616765204E2020D5 |
:1016EE0020202020202020204C61676520522020C1 |
:1016FE0020202020202020202020202020202020DC |
:10170E0020202020202020205370616E6E756E6781 |
:10171E002020202020202020456D7066616E6720DD |
:10172E002020202020202020416E616C6F673131F7 |
:10173E0020202020202020204D6F746F725F566F66 |
:10174E00726E6520202020204D6F746F725F486985 |
:10175E006E74656E202020204B616F6D7061737307 |
:10176E0020202020202020204D6F746F725F526544 |
:10177E0063687473202020204163635F5A20202009 |
:10178E0020202020202020204D697474656C416338 |
:10179E00634E69636B2020204D697474656C4163E0 |
:1017AE0063526F6C6C202020496E74656772616C99 |
:1017BE004572724E69636B20496E74656772616C17 |
:1017CE00457272526F6C6C204D697474656C496E03 |
:1017DE00744E69636B2020204D697474656C496E7C |
:1017EE0074526F6C6C2020204E65757472616C4E55 |
:1017FE0069636B2020202020526F6C6C4F666673DD |
:10180E006574202020202020496E74526F6C6C2A43 |
:10181E0046616B746F722020416E616C6F67323659 |
:10182E002020202020202020446972656B74417591 |
:10183E0073676C526F6C6C204D6573737765727441 |
:10184E00526F6C6C20202020417573676C65696344 |
:10185E0068526F6C6C202020492D4C616765526F69 |
:10186E006C6C202020202020537469636B526F6CA7 |
:0A187E006C20202020202020010013 |
:00000001FF |
/trunk/analog.c |
---|
1,119 → 1,29 |
/*####################################################################################### |
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; |
############################################################################*/ |
#include "main.h" |
//############################################################################ |
//Init ADC |
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)); |
ADMUX = 0; |
ADCSRA = 0x87; |
ADMUX = 0; |
ADCSRA |= 0x40; // Start Conversion |
} |
uint16_t ADC_GetValue(ADChannel_t channel) |
unsigned int MessAD(unsigned char 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); |
unsigned int messwert = 0; |
ADMUX = channel; |
ADCSRA |= 0x10; // Clear Ready-Bit |
ADCSRA |= 0x40; // Start Conversion |
while (((ADCSRA & 0x10) == 0)); |
messwert = ADCW; |
return(messwert); |
} |
/trunk/analog.h |
---|
1,39 → 1,6 |
#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_ |
extern void ADC_Init(void); |
extern void GetAnalogWerte(void); |
extern void AdConvert(void); |
extern void FastADConvert(void); |
extern unsigned int MessAD(unsigned char); |
/trunk/main.c |
---|
1,572 → 1,163 |
/*####################################################################################### |
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> |
signed int OffsetN, OffsetR, OffsetZ; |
/* |
signed int CalTabelleHorizontalN[4] = {67,-450,77,-411}; // Vier Messwerte 90° Horizontal gedreht |
signed int CalTabelleHorizontalR[4] = {-310,175,183,-333}; |
signed int CalTabelleHorizontalZ[4] = {-100,-390,-400,100}; // Messwinkel des Z-Sensors auch horizontal gemessen |
*/ |
signed int CalTabelleHorizontalN[4] = { 75,-180,-440,-166}; // Vier Messwerte 90° Horizontal gedreht |
signed int CalTabelleHorizontalR[4] = { -5,-230, 66, 246}; |
signed int CalTabelleHorizontalZ[4] = {-290,-280, 44, 33}; // Messwinkel des Z-Sensors auch horizontal gemessen |
signed int RawMagnet1a,RawMagnet1b; // reine AD-Messung |
signed int RawMagnet2a,RawMagnet2b; |
signed int RawMagnet3a,RawMagnet3b; |
signed int UncalMagnetN,UncalMagnetR,UncalMagnetZ; // Messwert-Delta ohne Offset- und Verstärker korrektur |
signed int MagnetN,MagnetR,MagnetZ; // Kalibrierte Messerte |
unsigned int PwmHeading = 0; |
unsigned char PC_Connected = 0; |
#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 |
//############################################################################ |
// |
void Wait(unsigned char dauer) |
//############################################################################ |
{ |
int16_t Range; |
int16_t Offset; |
} Scaling_t; |
dauer = (unsigned char)TCNT0 + dauer; |
while((TCNT0 - dauer) & 0x80); |
} |
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 |
} |
{ |
UncalMagnetN = (2 * UncalMagnetN + (RawMagnet1a - RawMagnet1b)) / 3; |
UncalMagnetR = (2 * UncalMagnetR + (RawMagnet3a - RawMagnet3b)) / 3; |
UncalMagnetZ = (2 * UncalMagnetZ + (RawMagnet2a - RawMagnet2b)) / 3; |
MagnetN = UncalMagnetN - OffsetN; |
MagnetR = UncalMagnetR - OffsetR; |
MagnetZ = UncalMagnetZ - OffsetZ; |
} |
//------------------------------------------------------ |
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; |
double nick_rad, roll_rad, Hx, Hy, Cx, Cy, Cz; |
float nick, roll, XEx, XEy, YEy, YEz, YE, XE, XrawCal, YrawCal, ZrawCal, XEz; |
int heading, azimuthgrad; |
nick_rad = ((double)WinkelOut.Winkel[0]) * M_PI / (double)(180); |
roll_rad = ((double)WinkelOut.Winkel[1]) * M_PI / (double)(180); |
//roll_rad = 0; nick_rad = 0; |
// 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); |
} |
/* |
Cx = (double) (MicroMag.Axis[Y_AXIS] + CY_OFFSET) * 0.707f - (double) (MicroMag.Axis[X_AXIS]+ CX_OFFSET) * 0.707f; |
Cy = ((double) (MicroMag.Axis[Y_AXIS]+ CY_OFFSET) * 0.707f + (double) (MicroMag.Axis[X_AXIS]+ CX_OFFSET) * 0.707f); |
Cz = -MicroMag.Axis[Z_AXIS] + CZ_OFFSET; |
*/ |
Cx = MagnetN; |
Cy = MagnetR; |
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 / M_PI); |
else if(Hx > 0 && Hy < 0) heading = - (atan(Hy / Hx) * 180 / M_PI); |
else if(Hx > 0 && Hy > 0) heading = 360 - (atan(Hy / Hx) * 180 / M_PI); |
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 |
// DebugOut.Analog[14] = heading; |
// if (FromFlightCtrl.IntegralNick > 0) heading = heading + FromFlightCtrl.IntegralNick/60; |
if(heading < 361) DebugOut.Analog[14] = heading; |
AnFlightCtrl.Heading = heading; |
PwmHeading = heading + 10; |
// MicroMag.Heading = heading; |
// DebugOut.Analog[14] = heading; |
} |
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 |
//############################################################################ |
//Hauptprogramm |
int main (void) |
//############################################################################ |
{ |
static uint8_t state = 0; |
static uint16_t statetimer; |
// reset input pullup |
DDRC &=~((1<<DDC6)); |
PORTC |= (1<<PORTC6); |
DDRC = 0x08; |
PORTC = 0x08; |
DDRD = 0xf4; |
PORTD = 0xA0; |
DDRB = 0x04; |
PORTB = 0x35; |
LED_ON; |
UART_Init(); |
Timer0_Init(); |
ADC_Init(); |
sei();//Globale Interrupts Einschalten |
Debug_Timer = SetDelay(100); // Sendeintervall |
InitIC2_Slave(0x50); |
LED_Init(); |
TIMER0_Init(); |
USART0_Init(); |
ADC_Init(); |
I2C_Init(); |
OffsetN = (CalTabelleHorizontalN[0] + CalTabelleHorizontalN[1] + CalTabelleHorizontalN[2] + CalTabelleHorizontalN[3]) / 4; |
OffsetR = (CalTabelleHorizontalR[0] + CalTabelleHorizontalR[1] + CalTabelleHorizontalR[2] + CalTabelleHorizontalR[3]) / 4; |
OffsetZ = (CalTabelleHorizontalZ[0] + CalTabelleHorizontalZ[1] + CalTabelleHorizontalZ[2] + CalTabelleHorizontalZ[3]) / 4; |
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 |
VersionInfo.Hauptversion = 0; |
VersionInfo.Nebenversion = 3; |
VersionInfo.PCKompatibel = 7; |
while (1) |
{ |
LED_ON; |
FLIP_LOW; |
Delay_ms(2); |
RawMagnet1a = MessAD(0); |
RawMagnet2a = MessAD(1); |
RawMagnet3a = MessAD(7); |
Delay_ms(1); |
LED_OFF; |
FLIP_HIGH; |
Delay_ms(2); |
RawMagnet1b = MessAD(0); |
RawMagnet2b = MessAD(1); |
RawMagnet3b = MessAD(7); |
Delay_ms(1); |
LED_GRN_ON; |
CalcFields(); |
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[3] = RawMagnet1a; |
DebugOut.Analog[4] = RawMagnet1b; |
DebugOut.Analog[5] = RawMagnet3a; |
DebugOut.Analog[6] = RawMagnet3b;*/ |
DebugOut.Analog[6] = WinkelOut.Winkel[0]; |
DebugOut.Analog[7] = WinkelOut.Winkel[1]; |
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) |
CalcHeading(); |
BearbeiteRxDaten(); |
PC_Connected = 100; |
if(PC_Connected) |
{ |
PC_Connected--; |
DatenUebertragung(); |
DDRD |= 0x02; // TXD-Leitung |
} |
else |
{ |
DDRD &= ~0x02; // TXD-Leitung |
} |
} // while(1) - Hauptschleife |
} |
/trunk/main.h |
---|
1,36 → 1,65 |
#ifndef _MAIN_H_ |
#define _MAIN_H_ |
#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 <inttypes.h> |
#include <avr/boot.h> |
#include <avr/wdt.h> |
#include "twislave.h" |
#include "old_macros.h" |
#include "analog.h" |
#include "uart.h" |
#include "timer0.h" |
typedef enum |
{ |
ATTITUDE_SOURCE_I2C = 0, |
ATTITUDE_SOURCE_UART = 1, |
ATTITUDE_SOURCE_ACC = 2, |
ATTITUDE_SOURCE_NONE = 3 |
} AttitudeSource_t; |
#if defined(__AVR_ATmega8__) |
# define OC1 PB1 |
# define DDROC DDRB |
# define OCR OCR1A |
# define PWM10 WGM10 |
# define PWM11 WGM11 |
#endif |
typedef enum |
{ |
ORIENTATION_NC = 0, |
ORIENTATION_FC = 1 |
} Orientation_t; |
#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) |
extern int16_t Heading; |
#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) |
extern AttitudeSource_t AttitudeSource; |
extern Orientation_t Orientation; |
extern uint8_t InternalCalstate, ActualCalstate; |
#define LED_ON PORTD |= 0x80 |
#define LED_OFF PORTD &= ~0x80 |
#define FLIP_HIGH PORTD |= 0x60 |
#define FLIP_LOW PORTD &= ~0x60 |
extern int16_t MagX, MagY, MagZ; |
extern int8_t PotiToFC[12]; |
void SetDebugValues(void); |
extern unsigned int PwmHeading; |
extern unsigned char PC_Connected; |
#endif //_MAIN_H |
#endif //_MAIN_H_ |
/trunk/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 |
/trunk/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 |
/trunk/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 |
/trunk/makefile |
---|
1,61 → 1,17 |
#-------------------------------------------------------------------- |
# 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 |
HAUPT_VERSION = 0 |
NEBEN_VERSION = 4 |
#------------------------------------------------------------------- |
# 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). |
TARGET = Compass_V$(HAUPT_VERSION)_$(NEBEN_VERSION) |
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 |
62,10 → 18,20 |
########################################################################################################## |
# 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 |
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 |
81,8 → 47,6 |
EXTRAINCDIRS = |
CDEFS = -DF_CPU=$(F_CPU)UL |
# Optional compiler flags. |
# -g: generate debugging information (for GDB, or for COFF conversion) |
# -O*: optimization level |
90,7 → 54,7 |
# -Wall...: warning level |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create assembler listing |
CFLAGS = -O$(OPT) \ |
CFLAGS = -g -O$(OPT) \ |
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ |
-Wall -Wstrict-prototypes \ |
-Wa,-adhlns=$(<:.c=.lst) \ |
104,17 → 68,11 |
#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_HAUPTVERSION=$(HAUPT_VERSION) -DVERSION_NEBENVERSION=$(NEBEN_VERSION) |
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 |
ifeq ($(AVR_CTRL_PLATINE), 1) |
CFLAGS += -DAVR_CTRL_PLATINE=$(AVR_CTRL_PLATINE) |
endif |
219,7 → 177,6 |
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
ELFSIZE = $(SIZE) -A $(TARGET).elf |
LIMITS = $(SIZE) --mcu=$(MCU) -C $(TARGET).elf |
279,10 → 236,10 |
# Display size of file. |
sizebefore: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); $(LIMITS); echo; fi |
@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); $(LIMITS); echo; fi |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi |
387,17 → 344,17 |
clean_list : |
@echo |
@echo $(MSG_CLEANING) |
$(REMOVE) MK3Mag_*.hex |
$(REMOVE) MK3Mag_*.eep |
$(REMOVE) $(TARGET).obj |
# $(REMOVE) $(TARGET).hex |
# $(REMOVE) $(TARGET).eep |
# $(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).cof |
$(REMOVE) MK3Mag_*.elf |
$(REMOVE) MK3Mag_*.map |
$(REMOVE) $(TARGET).elf |
$(REMOVE) $(TARGET).map |
$(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).a90 |
$(REMOVE) MK3Mag_*.sym |
$(REMOVE) $(TARGET).sym |
$(REMOVE) $(TARGET).lnk |
$(REMOVE) MK3Mag_*.lss |
$(REMOVE) $(TARGET).lss |
$(REMOVE) $(OBJ) |
$(REMOVE) $(LST) |
$(REMOVE) $(SRC:.c=.s) |
/trunk/timer0.c |
---|
1,170 → 1,75 |
/*####################################################################################### |
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 unsigned int CountMilliseconds = 0; |
volatile unsigned char Timer0Overflow; |
unsigned int I2C_Timeout = 0; |
unsigned int SIO_Timeout = 0; |
volatile uint16_t CountMilliseconds = 0; |
volatile uint16_t I2C_Timeout = 0; |
enum { |
STOP = 0, |
CK = 1, |
CK8 = 2, |
CK64 = 3, |
CK256 = 4, |
CK1024 = 5, |
T0_FALLING_EDGE = 6, |
T0_RISING_EDGE = 7 |
}; |
/*****************************************************/ |
/* Initialize Timer 0 */ |
/*****************************************************/ |
void TIMER0_Init(void) |
SIGNAL(SIG_OVERFLOW0) |
{ |
// set PB2 as output for the PWM used to signal compass heading |
DDRB |= (1<<DDB2); |
PORTB &= ~(1<<PORTB2); |
static unsigned char cnt; |
static unsigned int cmps_cnt; |
TCNT0 -= 97; // reload |
Timer0Overflow++; |
// 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); |
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--; |
} |
} |
// ----------------------------------------------------------------------- |
ISR(TIMER0_OVF_vect) |
void Timer0_Init(void) |
{ |
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--; |
} |
TCCR0B = TIMER_TEILER; // Starten des Timers |
// TCNT0 = 100; // reload |
TIM0_START; |
TIMER2_INT_ENABLE; |
} |
// ----------------------------------------------------------------------- |
uint16_t SetDelay (uint16_t t) |
unsigned int SetDelay(unsigned int t) |
{ |
return(CountMilliseconds + t - 1); |
return(CountMilliseconds + t - 1); |
} |
// ----------------------------------------------------------------------- |
int8_t CheckDelay(uint16_t t) |
char CheckDelay (unsigned int t) |
{ |
return(((t - CountMilliseconds) & 0x8000) >> 8); // check sign bit |
return(((t - CountMilliseconds) & 0x8000) >> 8); |
} |
// ----------------------------------------------------------------------- |
void Delay_ms(uint16_t wait) |
void Delay_ms(unsigned int w) |
{ |
uint16_t t_stop; |
t_stop = SetDelay(wait); |
while (!CheckDelay(t_stop)); |
unsigned int akt; |
akt = SetDelay(w); |
while (!CheckDelay(akt)); |
} |
/trunk/timer0.h |
---|
1,17 → 1,15 |
#ifndef _TIMER0_H |
#define _TIMER0_H |
#define TIMER_TEILER CK8 |
//#define TIMER_RELOAD_VALUE 125 |
#include <inttypes.h> |
extern volatile uint16_t CountMilliseconds; |
extern volatile uint16_t I2C_Timeout; |
extern volatile unsigned int CountMilliseconds; |
extern volatile unsigned char Timer0Overflow; |
extern unsigned int I2C_Timeout; |
extern unsigned int SIO_Timeout; |
void TIMER0_Init(void); |
uint16_t SetDelay (uint16_t t); |
int8_t CheckDelay(uint16_t t); |
void Delay_ms(uint16_t wait); |
void Timer1_Init(void); |
void Delay_ms(unsigned int); |
unsigned int SetDelay (unsigned int t); |
char CheckDelay (unsigned int t); |
#endif //_TIMER0_H |
/trunk/twislave.c |
---|
1,289 → 1,75 |
/*####################################################################################### |
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. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
/*############################################################################ |
Slaveadr = 0x52 = Vorne, 0x54 = Hinten, 0x56 = Rechts, 0x58 = Links |
############################################################################*/ |
#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" |
unsigned char I2C_RXBuffer; |
unsigned char Byte_Counter=0; |
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; |
//############################################################################ |
//I2C (TWI) Interface Init |
void InitIC2_Slave(uint8_t adr) |
//############################################################################ |
{ |
TWAR = adr; // Eigene Adresse setzen |
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWIE) | (1<<TWEA); |
} |
//############################################################################ |
//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) |
{ |
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; |
} |
//############################################################################ |
{ |
switch (TWSR & 0xF8) |
{ |
case SR_SLA_ACK: |
TWCR |= (1<<TWINT); |
Byte_Counter=0; |
return; |
// Daten Empfangen |
case SR_PREV_ACK: |
I2C_RXBuffer = TWDR; |
I2C_Timeout = 500; |
TWCR |= (1<<TWINT); |
return; |
// Daten Senden |
case SW_SLA_ACK: |
if (Byte_Counter==0) |
{ |
TWDR = 0;//Mittelstrom; |
Byte_Counter++; |
} |
else |
{ |
TWDR = 0;//MaxPWM; |
} |
TWCR |= (1<<TWINT); |
return; |
// Daten Senden |
case SW_DATA_ACK: |
if (Byte_Counter==0) |
{ |
TWDR = 0;//Mittelstrom; |
Byte_Counter++; |
} |
else |
{ |
TWDR = 0;//MaxPWM; |
} |
TWCR |= (1<<TWINT); |
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 |
} |
/trunk/twislave.h |
---|
1,63 → 1,32 |
#ifndef _TWI_SLAVE_H_ |
#define _TWI_SLAVE_H_ |
#include <inttypes.h> |
extern unsigned char I2C_RXBuffer; |
extern unsigned char Byte_Counter; |
#define I2C_SLAVE_ADDRESS 0x50 |
extern void InitIC2_Slave (uint8_t adr); |
#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 |
#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 |
typedef struct |
{ |
uint8_t Major; |
uint8_t Minor; |
uint8_t Patch; |
uint8_t Compatible; |
} I2C_Version_t; |
// 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 |
typedef struct |
{ |
int16_t MagX; |
int16_t MagY; |
int16_t MagZ; |
} I2C_Mag_t; |
#endif |
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_ |
/trunk/uart.c |
---|
1,677 → 1,427 |
/*####################################################################################### |
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> |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Regler für Brushless-Motoren |
// + ATMEGA8 mit 8MHz |
// + (c) 01.2007 Holger Buss |
// + Nur für den privaten Gebrauch |
// + Keine Garantie auf Fehlerfreiheit |
// + Kommerzielle Nutzung nur mit meiner Zustimmung |
// + Der Code ist für die Hardware BL_Ctrl V1.0 entwickelt worden |
// + www.mikrocontroller.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#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 BL_ADDRESS 5 |
#define MAX_SENDE_BUFF 100 |
#define MAX_EMPFANGS_BUFF 100 |
#define FALSE 0 |
#define TRUE 1 |
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; |
// keep buffers as small as possible |
#define TXD_BUFFER_LEN 120 |
#define RXD_BUFFER_LEN 30 |
struct str_DebugOut DebugOut; |
struct str_WinkelOut WinkelOut; |
struct str_ExternControl ExternControl; |
struct str_VersionInfo VersionInfo; |
struct str_AnFlightCtrl AnFlightCtrl; |
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 |
int Debug_Timer; |
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] = |
const unsigned char ANALOG_TEXT[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 " |
//1234567890123456 |
"Magnet N ", //0 |
"Magnet R ", |
"Magnet Z ", |
"Roh N ", |
"Roh R ", |
"Roh Z ", //5 |
"Lage N ", |
"Lage R ", |
" ", |
"Spannung ", |
"Empfang ", //10 |
"Analog11 ", |
"Motor_Vorne ", |
"Motor_Hinten ", |
"Kaompass ", |
"Motor_Rechts ", //15 |
"Acc_Z ", |
"MittelAccNick ", |
"MittelAccRoll ", |
"IntegralErrNick ", |
"IntegralErrRoll ", //20 |
"MittelIntNick ", |
"MittelIntRoll ", |
"NeutralNick ", |
"RollOffset ", |
"IntRoll*Faktor ", //25 |
"Analog26 ", |
"DirektAusglRoll ", |
"MesswertRoll ", |
"AusgleichRoll ", |
"I-LageRoll ", //30 |
"StickRoll " |
}; |
/****************************************************************/ |
/* 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) |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//++ Sende-Part der Datenübertragung |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
SIGNAL(INT_VEC_TX) |
{ |
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 |
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 USART0_DisableTXD(void) |
void SendUart(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); |
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; |
} |
/****************************************************************/ |
/* USART0 transmitter ISR */ |
/****************************************************************/ |
ISR(USART_TX_vect) |
// -------------------------------------------------------------------------- |
void Decode64(unsigned char *ptrOut, unsigned char len, unsigned char ptrIn,unsigned char max) // Wohin mit den Daten; Wie lang; Wo im RxdBuffer |
{ |
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; |
} |
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 |
/****************************************************************/ |
/* 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; |
x = (a << 2) | (b >> 4); |
y = ((b & 0x0f) << 4) | (c >> 2); |
z = ((c & 0x03) << 6) | d; |
c = UDR0; // catch the received byte |
if(len--) ptrOut[ptr++] = x; else break; |
if(len--) ptrOut[ptr++] = y; else break; |
if(len--) ptrOut[ptr++] = z; else break; |
} |
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) |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//++ Empfangs-Part der Datenübertragung |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
SIGNAL(INT_VEC_RX) |
{ |
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) |
} |
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 SendOutData(uint8_t cmd, uint8_t address, uint8_t numofbuffers, ...) // uint8_t *pdata, uint8_t len, ... |
void AddCRC(unsigned int wieviele) |
{ |
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 |
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 Decode64(void) |
void SendOutData(unsigned char cmd,unsigned char modul, unsigned char *snd, unsigned char len) |
{ |
uint8_t a,b,c,d; |
uint8_t ptrIn = 3; |
uint8_t ptrOut = 3; |
uint8_t len = ReceivedBytes - 6; |
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 |
len/=4; |
while(len--) |
{ |
a = rxd_buffer[ptrIn++] - '='; |
b = rxd_buffer[ptrIn++] - '='; |
c = rxd_buffer[ptrIn++] - '='; |
d = rxd_buffer[ptrIn++] - '='; |
rxd_buffer[ptrOut++] = (a << 2) | (b >> 4); |
rxd_buffer[ptrOut++] = ((b & 0x0f) << 4) | (c >> 2); |
rxd_buffer[ptrOut++] = ((c & 0x03) << 6) | d; |
} |
pRxData = &rxd_buffer[3]; |
RxDataLen = ptrOut - 3; |
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); |
} |
// -------------------------------------------------------------------------- |
void USART0_Putchar (char c) |
//############################################################################ |
//Routine für die Serielle Ausgabe |
int uart_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; |
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 USART0_ProcessRxData(void) |
void WriteProgramData(unsigned int pos, unsigned char wert) |
{ |
// if data in the rxd buffer are not locked immediately return |
if(!rxd_buffer_locked) return; |
} |
Decode64(); // decode data block in rxd_buffer |
//############################################################################ |
//INstallation der Seriellen Schnittstelle |
void UART_Init (void) |
//############################################################################ |
{ |
//Enable TXEN im Register UCR TX-Data Enable & RX Enable |
switch(rxd_buffer[1]-'a') // check Slave Address |
{ |
case MK3MAG_ADDRESS: |
UCR=(1 << TXEN) | (1 << RXEN); |
// UART Double Speed (U2X) |
USR |= (1<<U2X); |
// RX-Interrupt Freigabe |
switch(rxd_buffer[2]) // check for CmdID |
{ |
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; |
UCSRB |= (1<<RXCIE); // serieller Empfangsinterrupt |
default: |
// unsupported command |
break; |
} // case MK3MAG_ADDRESS: |
// TX-Interrupt Freigabe |
UCSRB |= (1<<TXCIE); |
default: // any Slave Address |
//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'); |
} |
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; |
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; |
case 'v': // request version and board release |
RequestFlags |= RQST_VERSION_INFO; |
PC_Connected = 2000; |
break; |
switch(RxdBuffer[2]) |
{ |
case 'w':// Lagewinkel |
Decode64((unsigned char *) &WinkelOut,sizeof(WinkelOut),3,AnzahlEmpfangsBytes); |
DebugOut.Analog[15]++; |
KompassAntwort = 1; |
LED_ON; |
break; |
case 'c': |
case 'b': |
Decode64((unsigned char *) &ExternControl,sizeof(ExternControl),3,AnzahlEmpfangsBytes); |
WinkelOut.Winkel[0] = ExternControl.Par1; |
WinkelOut.Winkel[1] = ExternControl.Par2; |
break; |
case 'v': // Version-Anforderung und Ausbaustufe |
GetVersionAnforderung = 1; |
PC_Connected = 255; |
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; |
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 USART0_TransmitTxData(void) |
void DatenUebertragung(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 |
if((CheckDelay(Debug_Timer) && UebertragungAbgeschlossen)) // im Singlestep-Betrieb in jedem Schtitt senden |
{ |
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 *) &AnFlightCtrl,sizeof(AnFlightCtrl)); |
KompassAntwort = 0; |
} |
} |
void USART0_Print(int8_t *msg) |
{ |
uint8_t i = 0; |
while(msg[i] != 0) |
{ |
USART0_Putchar(msg[i++]); |
} |
} |
/trunk/uart.h |
---|
1,78 → 1,135 |
#ifndef _UART_H_ |
#define _UART_H_ |
#ifndef _UART_H |
#define _UART_H |
#include <inttypes.h> |
#include "printf_P.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); |
#define NICK 0 |
#define ROLL 1 |
void DatenUebertragung(void); |
struct str_DebugOut |
{ |
unsigned char Digital[2]; |
unsigned int Analog[16]; // Debugwerte |
}; |
#define BAUD_RATE 57600 |
struct str_WinkelOut |
{ |
signed int Winkel[2]; |
}; |
extern struct str_WinkelOut WinkelOut; |
struct str_AnFlightCtrl |
{ |
int Heading; |
}; |
extern struct str_AnFlightCtrl AnFlightCtrl; |
extern uint16_t DebugData_Timer; |
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; |
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 |
struct str_VersionInfo |
{ |
uint8_t Digital[2]; |
uint16_t Analog[32]; // Debugvalues |
} DebugOut_t; |
unsigned char Hauptversion; |
unsigned char Nebenversion; |
unsigned char PCKompatibel; |
unsigned char Rserved[7]; |
}; |
extern struct str_VersionInfo VersionInfo; |
extern DebugOut_t DebugOut; |
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 |
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; |
//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 |
extern ExternData_t ExternData; |
#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 |
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; |
#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 |
extern ExternControl_t ExternControl; |
#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 |
typedef struct |
{ |
uint8_t SWMajor; |
uint8_t SWMinor; |
uint8_t ProtoMajor; |
uint8_t ProtoMinor; |
uint8_t SWPatch; |
uint8_t Reserved[5]; |
} UART_VersionInfo_t; |
#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 |
extern uint16_t PC_Connected; |
extern uint16_t FC_Connected; |
#endif //_UART_H_ |
#endif //_UART_H |
/trunk |
---|
Property changes: |
Deleted: tsvn:logminsize |
-8 |
\ No newline at end of property |