From b8402e32fc02b82d44630c5f25b73ffc6cff69ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Ple=C3=9F?= Date: Wed, 12 Jun 2013 00:30:49 +0200 Subject: [PATCH] - added 3rd party uart lib - added measurements for voltage and current --- display/.gitignore | 6 + display/software/.idea/vcs.xml | 2 +- display/software/.idea/workspace.xml | 194 ++++--- display/software/powerboard/.dep/main.o.d | 4 +- display/software/powerboard/Makefile | 4 +- display/software/powerboard/main.elf | Bin 9594 -> 21345 bytes display/software/powerboard/main.hex | 151 ++++- display/software/powerboard/main.map | 463 +++++++++++---- display/software/powerboard/src/main.c | 75 ++- display/software/powerboard/src/main.lst | 509 +++++++++++++---- display/software/powerboard/src/uart.c | 663 ++++++++++++++++++++++ display/software/powerboard/src/uart.h | 195 +++++++ 12 files changed, 1922 insertions(+), 344 deletions(-) create mode 100644 display/.gitignore create mode 100644 display/software/powerboard/src/uart.c create mode 100644 display/software/powerboard/src/uart.h diff --git a/display/.gitignore b/display/.gitignore new file mode 100644 index 0000000..8e94ead --- /dev/null +++ b/display/.gitignore @@ -0,0 +1,6 @@ +.lst +.eep +.hex +.lss +.map +.sym diff --git a/display/software/.idea/vcs.xml b/display/software/.idea/vcs.xml index def6a6a..9ab281a 100644 --- a/display/software/.idea/vcs.xml +++ b/display/software/.idea/vcs.xml @@ -1,7 +1,7 @@ - + diff --git a/display/software/.idea/workspace.xml b/display/software/.idea/workspace.xml index 599dce6..db43439 100644 --- a/display/software/.idea/workspace.xml +++ b/display/software/.idea/workspace.xml @@ -1,10 +1,24 @@ - + + + + + + + + + + + + + + - + + - - - - - - - - - - - - - - - - - - - + @@ -95,16 +91,7 @@ - - - - - - - - - - + @@ -117,22 +104,31 @@ + + + + + - - + @@ -208,14 +204,19 @@ + + + + + + - - - + + @@ -324,6 +325,23 @@ + + @@ -333,31 +351,31 @@ - - + + - + - - - + + + - - - - + + + + - + - - - - - - + + + + + + - + @@ -446,13 +464,57 @@ + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -460,23 +522,9 @@ - - - - - - - - - - - - - - - + diff --git a/display/software/powerboard/.dep/main.o.d b/display/software/powerboard/.dep/main.o.d index d826568..6e759f3 100644 --- a/display/software/powerboard/.dep/main.o.d +++ b/display/software/powerboard/.dep/main.o.d @@ -12,7 +12,7 @@ src/main.o: src/main.c \ /usr/lib/gcc/avr/4.5.3/../../../avr/include/avr/lock.h \ /usr/lib/gcc/avr/4.5.3/../../../avr/include/avr/interrupt.h \ /usr/lib/gcc/avr/4.5.3/../../../avr/include/avr/pgmspace.h \ - /usr/lib/gcc/avr/4.5.3/include/stddef.h src/utils.h src/adc.h + /usr/lib/gcc/avr/4.5.3/include/stddef.h src/utils.h src/adc.h src/uart.h /usr/lib/gcc/avr/4.5.3/../../../avr/include/avr/io.h: @@ -45,3 +45,5 @@ src/main.o: src/main.c \ src/utils.h: src/adc.h: + +src/uart.h: diff --git a/display/software/powerboard/Makefile b/display/software/powerboard/Makefile index 7b33ff9..df636a7 100644 --- a/display/software/powerboard/Makefile +++ b/display/software/powerboard/Makefile @@ -52,7 +52,7 @@ TARGET = main # List C source files here. (C dependencies are automatically generated.) -SRC = src/$(TARGET).c src/adc.c src/utils.c +SRC = src/$(TARGET).c src/adc.c src/utils.c src/uart.c # List Assembler source files here. @@ -180,7 +180,7 @@ LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) AVRDUDE_PROGRAMMER = usbasp # com1 = serial port. Use lpt1 to connect to parallel port. -AVRDUDE_PORT = +AVRDUDE_PORT = usb AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep diff --git a/display/software/powerboard/main.elf b/display/software/powerboard/main.elf index cc212c8ee8e127ea9a93ad2a091c921b8051989b..ce651a3bd0bbe09608166059c37a9689b413ff5c 100755 GIT binary patch literal 21345 zcmchf34Bylvj6L5hXfK9LBSyrGN6d*B!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Mo);nL&kuTTL41O*&&_vgux&onT;pDl*!|T@BX)_^x86;@0&?-g>-hmcmpvMq@8?$&`9*FQR6C*|KUy ztMKlWBJKS8WqnQ(w@k0XcGl<)cv%S(%Gq%*N~Q@v^-pO5cPqDsxVbsX+nA^5oN~J~ z4C@=5Gy8U5?J-y%uDntmsG!e`W~MY_e5O?G;?nKWE7abJeA^SQU+mUwZ$KB@q70L> nAisxAZDYAIx8W<6TqG!Ct6VR!cP?HeFelE{FE7n6udM$E@Y$bm diff --git a/display/software/powerboard/main.hex b/display/software/powerboard/main.hex index a9f6a44..21bfd41 100644 --- a/display/software/powerboard/main.hex +++ b/display/software/powerboard/main.hex @@ -1,27 +1,126 @@ -:1000000012C021C020C01FC01EC01DC03EC01BC0EA -:100010001AC019C018C017C016C015C014C013C02C -:1000200012C011C010C011241FBECFE5D4E0DEBF46 -:10003000CDBF10E0A0E6B0E001C01D92A236B1072E -:10004000E1F71FD0ABC0DCCF8EB58B608EBD82EEEA -:1000500094E09BBD8ABD80E189BF7894089587B301 -:10006000876087BB88B3887F88BB089580E0089548 -:10007000882311F481E001C080E064E034D080E0A6 -:100080000895EDDF19D0E0DFFFCF1F920F920FB67A -:100090000F9211248F939F93809160009091610043 -:1000A000019690936100809360009F918F910F90D3 -:1000B0000FBE0F901F90189580E487B983E086B932 -:1000C000379A369A3699FECF84B195B1089597B193 -:1000D0008F71907E892B87B9369A3699FECF24B1DD -:1000E00035B1C9010895BF92CF92DF92EF92FF928E -:1000F0000F931F93D82EB62ECC24EE24FF24870115 -:100100000AC08D2DE4DFAC0160E070E0E40EF51E66 -:10011000061F171FC394CB14A0F32B2D30E040E033 -:1001200050E0C801B70118D0C9011F910F91FF908D -:10013000EF90DF90CF90BF900895882309F484E674 -:1001400090E007C0E3ECF9E03197F1F700C0000060 -:100150009F5F9817B8F30895A1E21A2EAA1BBB1B44 -:10016000FD010DC0AA1FBB1FEE1FFF1FA217B30783 -:10017000E407F50720F0A21BB30BE40BF50B661F99 -:10018000771F881F991F1A9469F76095709580955D -:1001900090959B01AC01BD01CF010895F894FFCF6C +:1000000030C03FC03EC03DC03CC03BC02AC139C02B +:1000100038C037C036C08CC1B7C133C032C031C060 +:1000200030C02FC02EC0570D0A006D412020004760 +:10003000656E657261746F723A2000570D0A006D2B +:10004000412020004C6F61643A20202020202000B5 +:1000500064560D0A00566F6C746167653A20202063 +:10006000000011241FBECFE5D4E0DEBFCDBF10E0FD +:10007000A0E6B0E001C01D92AD3AB107E1F75FD054 +:10008000A1C3BECF8EB58B608EBD82EE94E09BBDCA +:100090008ABD80E189BF7894089587B3876087BB64 +:1000A00088B3887F88BB0895CF93DF9382E064E0B4 +:1000B00006D1BC0180E090E07FD223E333E343ED3F +:1000C00050E4E6D14DD2709363006093620081E00A +:1000D00064E0F5D09C012E5F3140C8E4D0E02C9F55 +:1000E000C0012D9F900D3C9F900D112490936500B1 +:1000F0008093640080E064E0E2D09C012F5F314097 +:100100002C9FC0012D9F900D3C9F900D112490932A +:10011000670080936600DF91CF910895FC01CB01C9 +:1001200024E630E0B901EAD26E9FC0016F9F900DC6 +:100130007E9F900D1124B901CDD2862F0895EF92A4 +:10014000FF920F931F93DF93CF93CDB7DEB72A971C +:100150000FB6F894DEBF0FBECDBF9FDF99D092DF00 +:1001600083E390E036D1C09AC19AC2988E010F5FA6 +:100170001F4F84E6E82EF12C97DF85E590E07BD1D8 +:100180008091620090916300B8014AE050E0EBD2A8 +:100190005FD180E590E06FD184E490E06CD18091F4 +:1001A000660090916700B8014AE050E0DCD250D17F +:1001B0008FE390E060D18091660090916700B70175 +:1001C0009DD22091620030916300629FC001639FC5 +:1001D000900D729F900D1124B7017CD2862F90E074 +:1001E000B8014AE050E0BFD233D18BE390E043D175 +:1001F0008FE290E040D18091640090916500B80159 +:100200004AE050E0B0D224D18AE290E034D180912B +:10021000640090916500B70171D220916200309125 +:100220006300629FC001639F900D729F900D112427 +:10023000B70150D2862F90E0B8014AE050E093D247 +:1002400007D186E290E017D184E663D084E661D0DE +:1002500084E65FD084E65DD084E65BD084E659D046 +:100260008BCF1F920F920FB60F9211248F939F93F3 +:10027000809160009091610001969093610080935D +:1002800060009F918F910F900FBE0F901F90189557 +:1002900080E487B983E086B9379A369A3699FECFDB +:1002A00084B195B1089597B18F71907E892B87B9EC +:1002B000369A3699FECF24B135B1C9010895BF925F +:1002C000CF92DF92EF92FF920F931F93D82EB62E0C +:1002D000CC24EE24FF2487010AC08D2DE4DFAC017D +:1002E00060E070E0E40EF51E061F171FC394CB14E8 +:1002F000A0F32B2D30E040E050E0C801B70111D24F +:10030000C9011F910F91FF90EF90DF90CF90BF90A8 +:100310000895882309F484E690E007C0E3ECF9E04F +:100320003197F1F700C000009F5F9817B8F3089568 +:100330001F920F920FB60F9211242F938F939F93BA +:10034000EF93FF939BB18CB1E0918A00EF5FEF7167 +:1003500020918B00E21741F09871E0938A00F0E061 +:10036000E457FF4F808301C092E08091AC00892B5D +:100370008093AC00FF91EF919F918F912F910F90FF +:100380000FBE0F901F9018951F920F920FB60F92ED +:1003900011248F939F93EF93FF9390916800809126 +:1003A0006900981761F0E0916900EF5FEF71E093E9 +:1003B0006900F0E0E659FF4F80818CB901C0559883 +:1003C000FF91EF919F918F910F900FBE0F901F9013 +:1003D0001895109268001092690010928A0010928D +:1003E0008B0097FF03C022E02BB99F7790BD89B99E +:1003F00088E98AB986E880BD089590918A00809145 +:100400008B00981781F0E0918B00EF5FEF71E09324 +:100410008B00F0E0E457FF4F20818091AC001092F8 +:10042000AC0030E002C020E031E0C90108959091B5 +:1004300068009F5F9F71209169009217E1F3E92F97 +:10044000F0E0E659FF4F808390936800559A089535 +:10045000EF92FF92CF93DF93E82EE7017E01F92E12 +:10046000E70101C0E4DF89918823E1F7DF91CF91B3 +:10047000FF90EF900895CF93DF93EC0101C0D7DF99 +:10048000FE01219684918823D1F7DF91CF910895C1 +:100490000CD0E6C0DED040F0D5D030F021F45F3F84 +:1004A00019F0C7C0511110C1CAC0EBD098F39923FD +:1004B000C9F35523B1F3951B550BBB27AA27621728 +:1004C0007307840738F09F5F5F4F220F331F441F6D +:1004D000AA1FA9F333D00E2E3AF0E0E830D09150A5 +:1004E0005040E695001CCAF729D0FE2F27D0660F92 +:1004F000771F881FBB1F261737074807AB07B0E8D1 +:1005000009F0BB0B802DBF01FF2793585F4F2AF0E6 +:100510009E3F510568F08DC0D7C05F3FECF3983E19 +:10052000DCF3869577956795B795F7959F5FC9F743 +:10053000880F911D9695879597F90895E1E0660FCC +:10054000771F881FBB1F621773078407BA0720F045 +:10055000621B730B840BBA0BEE1F88F7E0950895AE +:1005600098D088F09F5790F0B92F9927B751A0F0F5 +:10057000D1F0660F771F881F991F1AF0BA95C9F737 +:1005800012C0B13081F09FD0B1E008959CC0672FB8 +:10059000782F8827B85F39F0B93FCCF386957795E7 +:1005A0006795B395D9F73EF49095809570956195D0 +:1005B0007F4F8F4F9F4F0895E89409C097FB3EF4FB +:1005C00090958095709561957F4F8F4F9F4F9923A0 +:1005D000A9F0F92F96E9BB279395F695879577951E +:1005E0006795B795F111F8CFFAF4BB0F11F460FFDE +:1005F0001BC06F5F7F4F8F4F9F4F16C0882311F036 +:1006000096E911C0772321F09EE8872F762F05C049 +:10061000662371F096E8862F70E060E02AF09A95E4 +:10062000660F771F881FDAF7880F9695879597F9D9 +:10063000089597F99F6780E870E060E008959FEF64 +:1006400080EC089500240A94161617061806090669 +:10065000089500240A941216130614060506089538 +:10066000092E0394000C11F4882352F0BB0F40F4C0 +:10067000BF2B11F460FF04C06F5F7F4F8F4F9F4F00 +:10068000089557FD9058440F551F59F05F3F71F082 +:100690004795880F97FB991F61F09F3F79F08795E9 +:1006A0000895121613061406551FF2CF4695F1DF72 +:1006B00008C0161617061806991FF1CF8695710502 +:1006C000610508940895E894BB2766277727CB0136 +:1006D00097F90895AA1BBB1B51E107C0AA1FBB1FB6 +:1006E000A617B70710F0A61BB70B881F991F5A95BE +:1006F000A9F780959095BC01CD01089597FB092E2F +:1007000007260AD077FD04D0E5DF06D000201AF4D2 +:10071000709561957F4F0895F6F7909581959F4F5D +:100720000895A1E21A2EAA1BBB1BFD010DC0AA1F32 +:10073000BB1FEE1FFF1FA217B307E407F50720F04A +:10074000A21BB30BE40BF50B661F771F881F991FC5 +:100750001A9469F760957095809590959B01AC010E +:10076000BD01CF010895FB019F01E8944230BCF028 +:100770004532ACF44A3029F497FB1EF490958195EC +:100780009F4F642F7727A6DF805D8A330CF0895D49 +:100790008193CB010097A9F716F45DE25193108283 +:1007A000C90100C0DC01FC01672F71917723E1F7DB +:1007B000329704C07C916D9370836291AE17BF072E +:0807C000C8F30895F894FFCF7F :00000001FF diff --git a/display/software/powerboard/main.map b/display/software/powerboard/main.map index 0191eaf..b82532d 100644 --- a/display/software/powerboard/main.map +++ b/display/software/powerboard/main.map @@ -1,11 +1,41 @@ Archive member included because of file (symbol) +/usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3.o) + src/main.o (__divsf3) +/usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3.o) (__divsf3x) +/usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fixunssfsi.o) + src/main.o (__fixunssfsi) +/usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(floatsisf.o) + src/main.o (__floatunsisf) +/usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_inf.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) (__fp_inf) +/usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_nan.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) (__fp_nan) +/usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_pscA.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) (__fp_pscA) +/usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_pscB.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) (__fp_pscB) +/usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_round.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3.o) (__fp_round) +/usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_split3.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) (__fp_split3) +/usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_zero.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fixunssfsi.o) (__fp_zero) +/usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodhi4.o) + src/main.o (__udivmodhi4) +/usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_divmodhi4.o) + src/main.o (__divmodhi4) /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodsi4.o) src/adc.o (__udivmodsi4) /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_exit.o) /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o (exit) /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_clear_bss.o) src/main.o (__do_clear_bss) +/usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(itoa.o) + src/main.o (itoa) +/usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(strrev.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(itoa.o) (strrev) Memory Configuration @@ -24,6 +54,7 @@ LOAD /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o LOAD src/main.o LOAD src/adc.o LOAD src/utils.o +LOAD src/uart.o LOAD /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a LOAD /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a LOAD /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a @@ -119,7 +150,7 @@ LOAD /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a .rela.plt *(.rela.plt) -.text 0x0000000000000000 0x1a0 +.text 0x0000000000000000 0x7c8 *(.vectors) .vectors 0x0000000000000000 0x26 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o 0x0000000000000000 __vectors @@ -127,38 +158,40 @@ LOAD /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a *(.vectors) *(.progmem.gcc*) *(.progmem*) - 0x0000000000000026 . = ALIGN (0x2) - 0x0000000000000026 __trampolines_start = . + .progmem.data 0x0000000000000026 0x3b src/main.o + 0x0000000000000062 . = ALIGN (0x2) + *fill* 0x0000000000000061 0x1 00 + 0x0000000000000062 __trampolines_start = . *(.trampolines) - .trampolines 0x0000000000000026 0x0 linker stubs + .trampolines 0x0000000000000062 0x0 linker stubs *(.trampolines*) - 0x0000000000000026 __trampolines_end = . + 0x0000000000000062 __trampolines_end = . *(.jumptables) *(.jumptables*) *(.lowtext) *(.lowtext*) - 0x0000000000000026 __ctors_start = . + 0x0000000000000062 __ctors_start = . *(.ctors) - 0x0000000000000026 __ctors_end = . - 0x0000000000000026 __dtors_start = . + 0x0000000000000062 __ctors_end = . + 0x0000000000000062 __dtors_start = . *(.dtors) - 0x0000000000000026 __dtors_end = . + 0x0000000000000062 __dtors_end = . SORT(*)(.ctors) SORT(*)(.dtors) *(.init0) - .init0 0x0000000000000026 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o - 0x0000000000000026 __init + .init0 0x0000000000000062 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o + 0x0000000000000062 __init *(.init0) *(.init1) *(.init1) *(.init2) - .init2 0x0000000000000026 0xc /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o + .init2 0x0000000000000062 0xc /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o *(.init2) *(.init3) *(.init3) *(.init4) - .init4 0x0000000000000032 0x10 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_clear_bss.o) - 0x0000000000000032 __do_clear_bss + .init4 0x000000000000006e 0x10 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_clear_bss.o) + 0x000000000000006e __do_clear_bss *(.init4) *(.init5) *(.init5) @@ -169,55 +202,124 @@ LOAD /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a *(.init8) *(.init8) *(.init9) - .init9 0x0000000000000042 0x4 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o + .init9 0x000000000000007e 0x4 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o *(.init9) *(.text) - .text 0x0000000000000046 0x2 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o - 0x0000000000000046 __vector_1 - 0x0000000000000046 __vector_12 - 0x0000000000000046 __bad_interrupt - 0x0000000000000046 __vector_3 - 0x0000000000000046 __vector_11 - 0x0000000000000046 __vector_13 - 0x0000000000000046 __vector_17 - 0x0000000000000046 __vector_7 - 0x0000000000000046 __vector_5 - 0x0000000000000046 __vector_4 - 0x0000000000000046 __vector_9 - 0x0000000000000046 __vector_2 - 0x0000000000000046 __vector_15 - 0x0000000000000046 __vector_8 - 0x0000000000000046 __vector_14 - 0x0000000000000046 __vector_10 - 0x0000000000000046 __vector_16 - 0x0000000000000046 __vector_18 - .text 0x0000000000000048 0x70 src/main.o - 0x0000000000000048 timer_init - 0x000000000000005e ports_init - 0x000000000000006c get_voltage - 0x0000000000000070 get_power - 0x0000000000000082 main - 0x000000000000008a __vector_6 - .text 0x00000000000000b8 0x82 src/adc.o - 0x00000000000000b8 adc_init - 0x00000000000000ce adc_read_single - 0x00000000000000e6 adc_read_avg - .text 0x000000000000013a 0x1e src/utils.o - 0x000000000000013a wait - .text 0x0000000000000158 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodsi4.o) - .text 0x0000000000000158 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_exit.o) - .text 0x0000000000000158 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_clear_bss.o) - 0x0000000000000158 . = ALIGN (0x2) + .text 0x0000000000000082 0x2 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o + 0x0000000000000082 __vector_1 + 0x0000000000000082 __bad_interrupt + 0x0000000000000082 __vector_3 + 0x0000000000000082 __vector_13 + 0x0000000000000082 __vector_17 + 0x0000000000000082 __vector_7 + 0x0000000000000082 __vector_5 + 0x0000000000000082 __vector_4 + 0x0000000000000082 __vector_9 + 0x0000000000000082 __vector_2 + 0x0000000000000082 __vector_15 + 0x0000000000000082 __vector_8 + 0x0000000000000082 __vector_14 + 0x0000000000000082 __vector_10 + 0x0000000000000082 __vector_16 + 0x0000000000000082 __vector_18 + .text 0x0000000000000084 0x20c src/main.o + 0x0000000000000084 timer_init + 0x000000000000009a ports_init + 0x00000000000000a8 measure + 0x000000000000011c get_power + 0x000000000000013e main + 0x0000000000000262 __vector_6 + .text 0x0000000000000290 0x82 src/adc.o + 0x0000000000000290 adc_init + 0x00000000000002a6 adc_read_single + 0x00000000000002be adc_read_avg + .text 0x0000000000000312 0x1e src/utils.o + 0x0000000000000312 wait + .text 0x0000000000000330 0x160 src/uart.o + 0x0000000000000330 __vector_11 + 0x0000000000000388 __vector_12 + 0x00000000000003d2 uart_init + 0x00000000000003fa uart_getc + 0x000000000000042e uart_putc + 0x0000000000000450 uart_puts + 0x0000000000000476 uart_puts_p + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fixunssfsi.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(floatsisf.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_inf.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_nan.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_pscA.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_pscB.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_round.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_split3.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_zero.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodhi4.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_divmodhi4.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodsi4.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_exit.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_clear_bss.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(itoa.o) + .text 0x0000000000000490 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(strrev.o) + 0x0000000000000490 . = ALIGN (0x2) *(.text.*) - .text.libgcc 0x0000000000000158 0x44 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodsi4.o) - 0x0000000000000158 __udivmodsi4 - .text.libgcc 0x000000000000019c 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_exit.o) - .text.libgcc 0x000000000000019c 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_clear_bss.o) - 0x000000000000019c . = ALIGN (0x2) + .text.avr-libc.fplib + 0x0000000000000490 0x4 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3.o) + 0x0000000000000490 __divsf3 + .text.avr-libc.fplib + 0x0000000000000494 0xcc /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) + 0x00000000000004aa __divsf3x + 0x00000000000004ae __divsf3_pse + .text.avr-libc.fplib + 0x0000000000000560 0x58 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fixunssfsi.o) + 0x0000000000000560 __fixunssfsi + .text.avr-libc.fplib + 0x00000000000005b8 0x7a /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(floatsisf.o) + 0x00000000000005b8 __floatunsisf + 0x00000000000005bc __floatsisf + .text.avr-libc.fplib + 0x0000000000000632 0xc /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_inf.o) + 0x0000000000000632 __fp_inf + .text.avr-libc.fplib + 0x000000000000063e 0x6 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_nan.o) + 0x000000000000063e __fp_nan + .text.avr-libc.fplib + 0x0000000000000644 0xe /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_pscA.o) + 0x0000000000000644 __fp_pscA + .text.avr-libc.fplib + 0x0000000000000652 0xe /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_pscB.o) + 0x0000000000000652 __fp_pscB + .text.avr-libc.fplib + 0x0000000000000660 0x22 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_round.o) + 0x0000000000000660 __fp_round + .text.avr-libc.fplib + 0x0000000000000682 0x44 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_split3.o) + 0x0000000000000682 __fp_split3 + 0x0000000000000692 __fp_splitA + .text.avr-libc.fplib + 0x00000000000006c6 0xe /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_zero.o) + 0x00000000000006c6 __fp_zero + 0x00000000000006c8 __fp_szero + .text.libgcc 0x00000000000006d4 0x28 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodhi4.o) + 0x00000000000006d4 __udivmodhi4 + .text.libgcc 0x00000000000006fc 0x26 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_divmodhi4.o) + 0x00000000000006fc __divmodhi4 + 0x00000000000006fc _div + .text.libgcc 0x0000000000000722 0x44 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodsi4.o) + 0x0000000000000722 __udivmodsi4 + .text.libgcc 0x0000000000000766 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_exit.o) + .text.libgcc 0x0000000000000766 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_clear_bss.o) + .text.avr-libc + 0x0000000000000766 0x3e /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(itoa.o) + 0x0000000000000766 itoa + .text.avr-libc + 0x00000000000007a4 0x20 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(strrev.o) + 0x00000000000007a4 strrev + 0x00000000000007c4 . = ALIGN (0x2) *(.fini9) - .fini9 0x000000000000019c 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_exit.o) - 0x000000000000019c exit - 0x000000000000019c _exit + .fini9 0x00000000000007c4 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_exit.o) + 0x00000000000007c4 exit + 0x00000000000007c4 _exit *(.fini9) *(.fini8) *(.fini8) @@ -236,20 +338,36 @@ LOAD /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a *(.fini1) *(.fini1) *(.fini0) - .fini0 0x000000000000019c 0x4 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_exit.o) + .fini0 0x00000000000007c4 0x4 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_exit.o) *(.fini0) - 0x00000000000001a0 _etext = . + 0x00000000000007c8 _etext = . -.data 0x0000000000800060 0x0 load address 0x00000000000001a0 +.data 0x0000000000800060 0x0 load address 0x00000000000007c8 0x0000000000800060 PROVIDE (__data_start, .) *(.data) .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o .data 0x0000000000800060 0x0 src/main.o .data 0x0000000000800060 0x0 src/adc.o .data 0x0000000000800060 0x0 src/utils.o + .data 0x0000000000800060 0x0 src/uart.o + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3.o) + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fixunssfsi.o) + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(floatsisf.o) + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_inf.o) + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_nan.o) + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_pscA.o) + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_pscB.o) + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_round.o) + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_split3.o) + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_zero.o) + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodhi4.o) + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_divmodhi4.o) .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodsi4.o) .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_exit.o) .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_clear_bss.o) + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(itoa.o) + .data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(strrev.o) *(.data*) *(.rodata) *(.rodata*) @@ -258,29 +376,48 @@ LOAD /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a 0x0000000000800060 _edata = . 0x0000000000800060 PROVIDE (__data_end, .) -.bss 0x0000000000800060 0x2 +.bss 0x0000000000800060 0x4d 0x0000000000800060 PROVIDE (__bss_start, .) *(.bss) .bss 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o - .bss 0x0000000000800060 0x2 src/main.o + .bss 0x0000000000800060 0x8 src/main.o 0x0000000000800060 syscounter - .bss 0x0000000000800062 0x0 src/adc.o - .bss 0x0000000000800062 0x0 src/utils.o - .bss 0x0000000000800062 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodsi4.o) - .bss 0x0000000000800062 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_exit.o) - .bss 0x0000000000800062 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_clear_bss.o) + 0x0000000000800062 voltage + 0x0000000000800064 ampere_in + 0x0000000000800066 ampere_out + .bss 0x0000000000800068 0x0 src/adc.o + .bss 0x0000000000800068 0x0 src/utils.o + .bss 0x0000000000800068 0x45 src/uart.o + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fixunssfsi.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(floatsisf.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_inf.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_nan.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_pscA.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_pscB.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_round.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_split3.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_zero.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodhi4.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_divmodhi4.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodsi4.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_exit.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_clear_bss.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(itoa.o) + .bss 0x00000000008000ad 0x0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(strrev.o) *(.bss*) *(COMMON) - 0x0000000000800062 PROVIDE (__bss_end, .) - 0x00000000000001a0 __data_load_start = LOADADDR (.data) - 0x00000000000001a0 __data_load_end = (__data_load_start + SIZEOF (.data)) + 0x00000000008000ad PROVIDE (__bss_end, .) + 0x00000000000007c8 __data_load_start = LOADADDR (.data) + 0x00000000000007c8 __data_load_end = (__data_load_start + SIZEOF (.data)) -.noinit 0x0000000000800062 0x0 - 0x0000000000800062 PROVIDE (__noinit_start, .) +.noinit 0x00000000008000ad 0x0 + 0x00000000008000ad PROVIDE (__noinit_start, .) *(.noinit*) - 0x0000000000800062 PROVIDE (__noinit_end, .) - 0x0000000000800062 _end = . - 0x0000000000800062 PROVIDE (__heap_start, .) + 0x00000000008000ad PROVIDE (__noinit_end, .) + 0x00000000008000ad _end = . + 0x00000000008000ad PROVIDE (__heap_start, .) .eeprom 0x0000000000810000 0x0 *(.eeprom*) @@ -298,13 +435,39 @@ LOAD /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a .signature *(.signature*) -.stab 0x0000000000000000 0x6cc +.stab 0x0000000000000000 0x1938 *(.stab) .stab 0x0000000000000000 0x6cc /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o + .stab 0x00000000000006cc 0x48 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3.o) + 0x54 (size before relaxing) + .stab 0x0000000000000714 0x510 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) + 0x51c (size before relaxing) + .stab 0x0000000000000c24 0x240 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fixunssfsi.o) + 0x24c (size before relaxing) + .stab 0x0000000000000e64 0x318 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(floatsisf.o) + 0x324 (size before relaxing) + .stab 0x000000000000117c 0x78 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_inf.o) + 0x84 (size before relaxing) + .stab 0x00000000000011f4 0x54 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_nan.o) + 0x60 (size before relaxing) + .stab 0x0000000000001248 0x84 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_pscA.o) + 0x90 (size before relaxing) + .stab 0x00000000000012cc 0x84 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_pscB.o) + 0x90 (size before relaxing) + .stab 0x0000000000001350 0xfc /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_round.o) + 0x108 (size before relaxing) + .stab 0x000000000000144c 0x1d4 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_split3.o) + 0x1e0 (size before relaxing) + .stab 0x0000000000001620 0x90 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_zero.o) + 0x9c (size before relaxing) + .stab 0x00000000000016b0 0x1b0 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(itoa.o) + 0x1bc (size before relaxing) + .stab 0x0000000000001860 0xd8 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(strrev.o) + 0xe4 (size before relaxing) -.stabstr 0x0000000000000000 0x54 +.stabstr 0x0000000000000000 0x2b3 *(.stabstr) - .stabstr 0x0000000000000000 0x54 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o + .stabstr 0x0000000000000000 0x2b3 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o .stab.excl *(.stab.excl) @@ -333,7 +496,7 @@ LOAD /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a .debug_sfnames *(.debug_sfnames) -.debug_aranges 0x0000000000000000 0x60 +.debug_aranges 0x0000000000000000 0x80 *(.debug_aranges) .debug_aranges 0x0000000000000000 0x20 src/main.o @@ -341,56 +504,67 @@ LOAD /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a 0x0000000000000020 0x20 src/adc.o .debug_aranges 0x0000000000000040 0x20 src/utils.o + .debug_aranges + 0x0000000000000060 0x20 src/uart.o .debug_pubnames - 0x0000000000000000 0xd4 + 0x0000000000000000 0x173 *(.debug_pubnames) .debug_pubnames - 0x0000000000000000 0x75 src/main.o + 0x0000000000000000 0x9a src/main.o .debug_pubnames - 0x0000000000000075 0x44 src/adc.o + 0x000000000000009a 0x44 src/adc.o .debug_pubnames - 0x00000000000000b9 0x1b src/utils.o + 0x00000000000000de 0x1b src/utils.o + .debug_pubnames + 0x00000000000000f9 0x7a src/uart.o -.debug_info 0x0000000000000000 0x40e +.debug_info 0x0000000000000000 0x7a7 *(.debug_info) - .debug_info 0x0000000000000000 0x19c src/main.o - .debug_info 0x000000000000019c 0x136 src/adc.o - .debug_info 0x00000000000002d2 0x13c src/utils.o + .debug_info 0x0000000000000000 0x259 src/main.o + .debug_info 0x0000000000000259 0x136 src/adc.o + .debug_info 0x000000000000038f 0x13c src/utils.o + .debug_info 0x00000000000004cb 0x2dc src/uart.o *(.gnu.linkonce.wi.*) -.debug_abbrev 0x0000000000000000 0x2a5 +.debug_abbrev 0x0000000000000000 0x3d5 *(.debug_abbrev) - .debug_abbrev 0x0000000000000000 0x113 src/main.o - .debug_abbrev 0x0000000000000113 0xb4 src/adc.o - .debug_abbrev 0x00000000000001c7 0xde src/utils.o + .debug_abbrev 0x0000000000000000 0x12a src/main.o + .debug_abbrev 0x000000000000012a 0xb4 src/adc.o + .debug_abbrev 0x00000000000001de 0xde src/utils.o + .debug_abbrev 0x00000000000002bc 0x119 src/uart.o -.debug_line 0x0000000000000000 0x384 +.debug_line 0x0000000000000000 0x6fb *(.debug_line) - .debug_line 0x0000000000000000 0x144 src/main.o - .debug_line 0x0000000000000144 0x13b src/adc.o - .debug_line 0x000000000000027f 0x105 src/utils.o + .debug_line 0x0000000000000000 0x252 src/main.o + .debug_line 0x0000000000000252 0x13b src/adc.o + .debug_line 0x000000000000038d 0x105 src/utils.o + .debug_line 0x0000000000000492 0x269 src/uart.o -.debug_frame 0x0000000000000000 0xd0 +.debug_frame 0x0000000000000000 0x150 *(.debug_frame) .debug_frame 0x0000000000000000 0x70 src/main.o .debug_frame 0x0000000000000070 0x40 src/adc.o .debug_frame 0x00000000000000b0 0x20 src/utils.o + .debug_frame 0x00000000000000d0 0x80 src/uart.o -.debug_str 0x0000000000000000 0x1cd +.debug_str 0x0000000000000000 0x2bf *(.debug_str) - .debug_str 0x0000000000000000 0x116 src/main.o - 0x159 (size before relaxing) - .debug_str 0x0000000000000116 0x56 src/adc.o + .debug_str 0x0000000000000000 0x114 src/main.o + 0x155 (size before relaxing) + .debug_str 0x0000000000000114 0x56 src/adc.o 0x11a (size before relaxing) - .debug_str 0x000000000000016c 0x61 src/utils.o + .debug_str 0x000000000000016a 0x61 src/utils.o 0x12e (size before relaxing) + .debug_str 0x00000000000001cb 0xf4 src/uart.o + 0x1c9 (size before relaxing) -.debug_loc 0x0000000000000000 0x17b +.debug_loc 0x0000000000000000 0x3f3 *(.debug_loc) - .debug_loc 0x0000000000000000 0x1e src/main.o - .debug_loc 0x000000000000001e 0xcf src/adc.o - .debug_loc 0x00000000000000ed 0x8e src/utils.o + .debug_loc 0x0000000000000000 0xac src/main.o + .debug_loc 0x00000000000000ac 0xcf src/adc.o + .debug_loc 0x000000000000017b 0x8e src/utils.o + .debug_loc 0x0000000000000209 0x1ea src/uart.o .debug_macinfo *(.debug_macinfo) @@ -398,13 +572,18 @@ OUTPUT(main.elf elf32-avr) LOAD linker stubs .debug_pubtypes - 0x0000000000000000 0xac + 0x0000000000000000 0xd2 .debug_pubtypes - 0x0000000000000000 0x3c src/main.o + 0x0000000000000000 0x37 src/main.o .debug_pubtypes - 0x000000000000003c 0x38 src/adc.o + 0x0000000000000037 0x38 src/adc.o .debug_pubtypes - 0x0000000000000074 0x38 src/utils.o + 0x000000000000006f 0x38 src/utils.o + .debug_pubtypes + 0x00000000000000a7 0x2b src/uart.o + +.debug_ranges 0x0000000000000000 0x18 + .debug_ranges 0x0000000000000000 0x18 src/main.o Cross Reference Table @@ -412,17 +591,54 @@ Symbol File __bad_interrupt /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o __bss_end /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_clear_bss.o) __bss_start /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_clear_bss.o) -__do_clear_bss /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_clear_bss.o) +__divmodhi4 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_divmodhi4.o) src/main.o +__divsf3 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3.o) + src/main.o +__divsf3_pse /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) +__divsf3x /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3.o) +__do_clear_bss /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_clear_bss.o) + src/uart.o + src/main.o +__fixunssfsi /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fixunssfsi.o) + src/main.o +__floatsisf /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(floatsisf.o) +__floatunsisf /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(floatsisf.o) + src/main.o +__fp_inf /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_inf.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) +__fp_nan /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_nan.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) +__fp_pscA /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_pscA.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) +__fp_pscB /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_pscB.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) +__fp_round /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_round.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3.o) +__fp_split3 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_split3.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) +__fp_splitA /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_split3.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fixunssfsi.o) +__fp_szero /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_zero.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(divsf3x.o) +__fp_zero /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fp_zero.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libm.a(fixunssfsi.o) __heap_end /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o __init /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o __stack /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o +__udivmodhi4 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodhi4.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(itoa.o) + /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_divmodhi4.o) + src/main.o __udivmodsi4 /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_udivmodsi4.o) src/adc.o __vector_1 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o __vector_10 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o -__vector_11 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o -__vector_12 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o +__vector_11 src/uart.o + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o +__vector_12 src/uart.o + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o __vector_13 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o __vector_14 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o __vector_15 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o @@ -440,19 +656,36 @@ __vector_8 /usr/lib/gcc/avr/4.5.3/../../. __vector_9 /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o __vector_default /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o __vectors /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o +_div /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_divmodhi4.o) _exit /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_exit.o) adc_init src/adc.o src/main.o adc_read_avg src/adc.o src/main.o adc_read_single src/adc.o +ampere_in src/main.o +ampere_out src/main.o exit /usr/lib/gcc/avr/4.5.3/avr4/libgcc.a(_exit.o) /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o get_power src/main.o -get_voltage src/main.o +itoa /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(itoa.o) + src/main.o main src/main.o /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/crtm8.o +measure src/main.o ports_init src/main.o +strrev /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(strrev.o) + /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr4/libc.a(itoa.o) syscounter src/main.o timer_init src/main.o +uart_getc src/uart.o +uart_init src/uart.o + src/main.o +uart_putc src/uart.o +uart_puts src/uart.o + src/main.o +uart_puts_p src/uart.o + src/main.o +voltage src/main.o wait src/utils.o + src/main.o diff --git a/display/software/powerboard/src/main.c b/display/software/powerboard/src/main.c index a51074b..56a289e 100644 --- a/display/software/powerboard/src/main.c +++ b/display/software/powerboard/src/main.c @@ -3,6 +3,7 @@ #include #include #include "adc.h" +#include "uart.h" #define AD_I_LOAD 0 #define AD_I_GEN 1 @@ -28,6 +29,9 @@ typedef enum { volatile uint16_t syscounter = 0; +uint16_t voltage = 0; +int16_t current_in = 0; +int16_t current_out = 0; void timer_init(void) { // clock is 8MHz @@ -42,38 +46,73 @@ void ports_init(void) { PORT_SW &= ~(_BV(LOADSW) | _BV(GENSW) | _BV(DUMPSW)); } -uint8_t get_voltage(void) { - // voltage has a divider (12V - 56k - ADC - 27k - GND) - // so - uint8_t voltage = 0; +void measure(void) { + voltage = adc_read_avg(AD_V, 4) / 6.6; - return voltage; + current_in = adc_read_avg(AD_I_GEN, 4); + current_in -= 510; + current_in *= 72; + + current_out = adc_read_avg(AD_I_LOAD, 4); + current_out -= 511; + current_out *= 72; } -uint8_t get_power(power_source source) { - - uint16_t voltage = get_voltage(); - uint16_t amperes; - - if(source == generated) { - amperes = adc_read_avg(AD_I_GEN, 4); - } else { - amperes = adc_read_avg(AD_I_LOAD, 4); - } - - return 0; +uint8_t get_power(uint16_t voltage, int16_t currents) { + return (voltage * (currents/100)) / 100; } int main(void) { ports_init(); - adc_init(); + adc_init(); timer_init(); + uart_init(UART_BAUD_SELECT(9600,F_OSC)); + char s[10]; + + LOAD_ON; + GEN_ON; + DUMP_OFF; while(1) { + + measure(); + + uart_puts_P("Voltage: "); + uart_puts ( itoa ( voltage, s, 10 ) ); + uart_puts_P("dV\r\n"); + + uart_puts_P("Load: "); + uart_puts ( itoa ( current_out, s, 10 ) ); + uart_puts_P("mA "); + + uart_puts ( itoa ( get_power(voltage, current_out), s, 10 ) ); + uart_puts_P("W\r\n"); + + + uart_puts_P("Generator: "); + uart_puts ( itoa ( current_in, s, 10 ) ); + uart_puts_P("mA "); + + uart_puts ( itoa ( get_power(voltage, current_in), s, 10 ) ); + uart_puts_P("W\r\n"); + + + + + + wait(100); + wait(100); + wait(100); + wait(100); + //wait(100); + //wait(100); + wait(100); + wait(100); + } diff --git a/display/software/powerboard/src/main.lst b/display/software/powerboard/src/main.lst index f032ddb..503900e 100644 --- a/display/software/powerboard/src/main.lst +++ b/display/software/powerboard/src/main.lst @@ -28,7 +28,7 @@ 36 0010 89BF out 89-32,r24 37 .LM5: 38 /* #APP */ - 39 ; 37 "src/main.c" 1 + 39 ; 41 "src/main.c" 1 40 0012 7894 sei 41 ; 0 "" 2 42 /* epilogue start */ @@ -56,120 +56,413 @@ 66 .LM10: 67 0022 0895 ret 68 .LFE1: - 70 .global get_voltage - 72 get_voltage: + 70 .global measure + 72 measure: 73 .LFB2: 74 .LM11: - 75 /* prologue: function */ - 76 /* frame size = 0 */ - 77 /* stack size = 0 */ - 78 .L__stack_usage = 0 - 79 .LVL0: - 80 .LM12: - 81 0024 80E0 ldi r24,lo8(0) - 82 /* epilogue start */ - 83 0026 0895 ret - 84 .LFE2: - 86 .global get_power - 88 get_power: - 89 .LFB3: - 90 .LM13: - 91 .LVL1: - 92 /* prologue: function */ - 93 /* frame size = 0 */ - 94 /* stack size = 0 */ - 95 .L__stack_usage = 0 - 96 .LM14: - 97 0028 8823 tst r24 - 98 002a 01F4 brne .L5 - 99 .LM15: - 100 002c 81E0 ldi r24,lo8(1) - 101 .LVL2: - 102 002e 00C0 rjmp .L7 - 103 .LVL3: - 104 .L5: - 105 .LM16: - 106 0030 80E0 ldi r24,lo8(0) - 107 .LVL4: - 108 .L7: - 109 0032 64E0 ldi r22,lo8(4) - 110 0034 00D0 rcall adc_read_avg - 111 .LM17: - 112 0036 80E0 ldi r24,lo8(0) - 113 /* epilogue start */ - 114 0038 0895 ret - 115 .LFE3: - 117 .global main - 119 main: - 120 .LFB4: - 121 .LM18: - 122 /* prologue: function */ - 123 /* frame size = 0 */ - 124 /* stack size = 0 */ - 125 .L__stack_usage = 0 - 126 .LM19: - 127 003a 00D0 rcall ports_init - 128 .LM20: - 129 003c 00D0 rcall adc_init - 130 .LM21: - 131 003e 00D0 rcall timer_init - 132 .L9: - 133 0040 00C0 rjmp .L9 - 134 .LFE4: - 136 .global __vector_6 - 138 __vector_6: - 139 .LFB5: - 140 .LM22: - 141 0042 1F92 push __zero_reg__ - 142 0044 0F92 push r0 - 143 0046 0FB6 in r0,__SREG__ - 144 0048 0F92 push r0 - 145 004a 1124 clr __zero_reg__ - 146 004c 8F93 push r24 - 147 004e 9F93 push r25 - 148 /* prologue: Signal */ + 75 0024 CF93 push r28 + 76 0026 DF93 push r29 + 77 /* prologue: function */ + 78 /* frame size = 0 */ + 79 /* stack size = 2 */ + 80 .L__stack_usage = 2 + 81 .LM12: + 82 0028 82E0 ldi r24,lo8(2) + 83 002a 64E0 ldi r22,lo8(4) + 84 002c 00D0 rcall adc_read_avg + 85 002e BC01 movw r22,r24 + 86 0030 80E0 ldi r24,lo8(0) + 87 0032 90E0 ldi r25,hi8(0) + 88 0034 00D0 rcall __floatunsisf + 89 0036 23E3 ldi r18,lo8(0x40d33333) + 90 0038 33E3 ldi r19,hi8(0x40d33333) + 91 003a 43ED ldi r20,hlo8(0x40d33333) + 92 003c 50E4 ldi r21,hhi8(0x40d33333) + 93 003e 00D0 rcall __divsf3 + 94 0040 00D0 rcall __fixunssfsi + 95 0042 7093 0000 sts voltage+1,r23 + 96 0046 6093 0000 sts voltage,r22 + 97 .LM13: + 98 004a 81E0 ldi r24,lo8(1) + 99 004c 64E0 ldi r22,lo8(4) + 100 004e 00D0 rcall adc_read_avg + 101 .LM14: + 102 0050 9C01 movw r18,r24 + 103 0052 2E5F subi r18,lo8(-(-510)) + 104 0054 3140 sbci r19,hi8(-(-510)) + 105 .LM15: + 106 0056 C8E4 ldi r28,lo8(72) + 107 0058 D0E0 ldi r29,hi8(72) + 108 005a 2C9F mul r18,r28 + 109 005c C001 movw r24,r0 + 110 005e 2D9F mul r18,r29 + 111 0060 900D add r25,r0 + 112 0062 3C9F mul r19,r28 + 113 0064 900D add r25,r0 + 114 0066 1124 clr r1 + 115 0068 9093 0000 sts ampere_in+1,r25 + 116 006c 8093 0000 sts ampere_in,r24 + 117 .LM16: + 118 0070 80E0 ldi r24,lo8(0) + 119 0072 64E0 ldi r22,lo8(4) + 120 0074 00D0 rcall adc_read_avg + 121 .LM17: + 122 0076 9C01 movw r18,r24 + 123 0078 2F5F subi r18,lo8(-(-511)) + 124 007a 3140 sbci r19,hi8(-(-511)) + 125 .LM18: + 126 007c 2C9F mul r18,r28 + 127 007e C001 movw r24,r0 + 128 0080 2D9F mul r18,r29 + 129 0082 900D add r25,r0 + 130 0084 3C9F mul r19,r28 + 131 0086 900D add r25,r0 + 132 0088 1124 clr r1 + 133 008a 9093 0000 sts ampere_out+1,r25 + 134 008e 8093 0000 sts ampere_out,r24 + 135 /* epilogue start */ + 136 .LM19: + 137 0092 DF91 pop r29 + 138 0094 CF91 pop r28 + 139 0096 0895 ret + 140 .LFE2: + 142 .global get_power + 144 get_power: + 145 .LFB3: + 146 .LM20: + 147 .LVL0: + 148 /* prologue: function */ 149 /* frame size = 0 */ - 150 /* stack size = 5 */ - 151 .L__stack_usage = 5 - 152 .LM23: - 153 0050 8091 0000 lds r24,syscounter - 154 0054 9091 0000 lds r25,syscounter+1 - 155 0058 0196 adiw r24,1 - 156 005a 9093 0000 sts syscounter+1,r25 - 157 005e 8093 0000 sts syscounter,r24 - 158 /* epilogue start */ - 159 .LM24: - 160 0062 9F91 pop r25 - 161 0064 8F91 pop r24 - 162 0066 0F90 pop r0 - 163 0068 0FBE out __SREG__,r0 - 164 006a 0F90 pop r0 - 165 006c 1F90 pop __zero_reg__ - 166 006e 1895 reti - 167 .LFE5: - 169 .global syscounter - 170 .global syscounter - 171 .section .bss - 174 syscounter: - 175 0000 0000 .skip 2,0 - 240 .Letext0: + 150 /* stack size = 0 */ + 151 .L__stack_usage = 0 + 152 0098 FC01 movw r30,r24 + 153 009a CB01 movw r24,r22 + 154 .LVL1: + 155 .LM21: + 156 009c 24E6 ldi r18,lo8(100) + 157 009e 30E0 ldi r19,hi8(100) + 158 00a0 B901 movw r22,r18 + 159 .LVL2: + 160 00a2 00D0 rcall __divmodhi4 + 161 .LVL3: + 162 00a4 6E9F mul r22,r30 + 163 00a6 C001 movw r24,r0 + 164 00a8 6F9F mul r22,r31 + 165 00aa 900D add r25,r0 + 166 00ac 7E9F mul r23,r30 + 167 00ae 900D add r25,r0 + 168 00b0 1124 clr r1 + 169 00b2 B901 movw r22,r18 + 170 00b4 00D0 rcall __udivmodhi4 + 171 .LM22: + 172 00b6 862F mov r24,r22 + 173 /* epilogue start */ + 174 00b8 0895 ret + 175 .LFE3: + 177 .global main + 179 main: + 180 .LFB4: + 181 .LM23: + 182 00ba EF92 push r14 + 183 00bc FF92 push r15 + 184 00be 0F93 push r16 + 185 00c0 1F93 push r17 + 186 00c2 DF93 push r29 + 187 00c4 CF93 push r28 + 188 00c6 CDB7 in r28,__SP_L__ + 189 00c8 DEB7 in r29,__SP_H__ + 190 00ca 2A97 sbiw r28,10 + 191 00cc 0FB6 in __tmp_reg__,__SREG__ + 192 00ce F894 cli + 193 00d0 DEBF out __SP_H__,r29 + 194 00d2 0FBE out __SREG__,__tmp_reg__ + 195 00d4 CDBF out __SP_L__,r28 + 196 /* prologue: function */ + 197 /* frame size = 10 */ + 198 /* stack size = 16 */ + 199 .L__stack_usage = 16 + 200 .LM24: + 201 00d6 00D0 rcall ports_init + 202 .LM25: + 203 00d8 00D0 rcall adc_init + 204 .LM26: + 205 00da 00D0 rcall timer_init + 206 .LM27: + 207 00dc 83E3 ldi r24,lo8(51) + 208 00de 90E0 ldi r25,hi8(51) + 209 00e0 00D0 rcall uart_init + 210 .LM28: + 211 00e2 C09A sbi 56-32,0 + 212 .LM29: + 213 00e4 C19A sbi 56-32,1 + 214 .LM30: + 215 00e6 C298 cbi 56-32,2 + 216 .LBB15: + 217 .LM31: + 218 00e8 8E01 movw r16,r28 + 219 00ea 0F5F subi r16,lo8(-(1)) + 220 00ec 1F4F sbci r17,hi8(-(1)) + 221 .LBB16: + 222 .LBB17: + 223 .LM32: + 224 00ee 84E6 ldi r24,lo8(100) + 225 00f0 E82E mov r14,r24 + 226 00f2 F12C mov r15,__zero_reg__ + 227 .L6: + 228 .LBE17: + 229 .LBE16: + 230 .LM33: + 231 00f4 00D0 rcall measure + 232 .LM34: + 233 00f6 80E0 ldi r24,lo8(__c.1470) + 234 00f8 90E0 ldi r25,hi8(__c.1470) + 235 00fa 00D0 rcall uart_puts_p + 236 .LM35: + 237 00fc 8091 0000 lds r24,voltage + 238 0100 9091 0000 lds r25,voltage+1 + 239 0104 B801 movw r22,r16 + 240 0106 4AE0 ldi r20,lo8(10) + 241 0108 50E0 ldi r21,hi8(10) + 242 010a 00D0 rcall itoa + 243 010c 00D0 rcall uart_puts + 244 .LM36: + 245 010e 80E0 ldi r24,lo8(__c.1473) + 246 0110 90E0 ldi r25,hi8(__c.1473) + 247 0112 00D0 rcall uart_puts_p + 248 .LM37: + 249 0114 80E0 ldi r24,lo8(__c.1475) + 250 0116 90E0 ldi r25,hi8(__c.1475) + 251 0118 00D0 rcall uart_puts_p + 252 .LM38: + 253 011a 8091 0000 lds r24,ampere_out + 254 011e 9091 0000 lds r25,ampere_out+1 + 255 0122 B801 movw r22,r16 + 256 0124 4AE0 ldi r20,lo8(10) + 257 0126 50E0 ldi r21,hi8(10) + 258 0128 00D0 rcall itoa + 259 012a 00D0 rcall uart_puts + 260 .LM39: + 261 012c 80E0 ldi r24,lo8(__c.1477) + 262 012e 90E0 ldi r25,hi8(__c.1477) + 263 0130 00D0 rcall uart_puts_p + 264 .LVL4: + 265 .LBB19: + 266 .LBB18: + 267 .LM40: + 268 0132 8091 0000 lds r24,ampere_out + 269 0136 9091 0000 lds r25,ampere_out+1 + 270 013a B701 movw r22,r14 + 271 013c 00D0 rcall __divmodhi4 + 272 013e 2091 0000 lds r18,voltage + 273 0142 3091 0000 lds r19,voltage+1 + 274 0146 629F mul r22,r18 + 275 0148 C001 movw r24,r0 + 276 014a 639F mul r22,r19 + 277 014c 900D add r25,r0 + 278 014e 729F mul r23,r18 + 279 0150 900D add r25,r0 + 280 0152 1124 clr r1 + 281 0154 B701 movw r22,r14 + 282 0156 00D0 rcall __udivmodhi4 + 283 .LBE18: + 284 .LBE19: + 285 .LM41: + 286 0158 862F mov r24,r22 + 287 015a 90E0 ldi r25,lo8(0) + 288 015c B801 movw r22,r16 + 289 015e 4AE0 ldi r20,lo8(10) + 290 0160 50E0 ldi r21,hi8(10) + 291 0162 00D0 rcall itoa + 292 .LVL5: + 293 0164 00D0 rcall uart_puts + 294 .LM42: + 295 0166 80E0 ldi r24,lo8(__c.1479) + 296 0168 90E0 ldi r25,hi8(__c.1479) + 297 016a 00D0 rcall uart_puts_p + 298 .LM43: + 299 016c 80E0 ldi r24,lo8(__c.1481) + 300 016e 90E0 ldi r25,hi8(__c.1481) + 301 0170 00D0 rcall uart_puts_p + 302 .LM44: + 303 0172 8091 0000 lds r24,ampere_in + 304 0176 9091 0000 lds r25,ampere_in+1 + 305 017a B801 movw r22,r16 + 306 017c 4AE0 ldi r20,lo8(10) + 307 017e 50E0 ldi r21,hi8(10) + 308 0180 00D0 rcall itoa + 309 0182 00D0 rcall uart_puts + 310 .LM45: + 311 0184 80E0 ldi r24,lo8(__c.1483) + 312 0186 90E0 ldi r25,hi8(__c.1483) + 313 0188 00D0 rcall uart_puts_p + 314 .LVL6: + 315 .LBB20: + 316 .LBB21: + 317 .LM46: + 318 018a 8091 0000 lds r24,ampere_in + 319 018e 9091 0000 lds r25,ampere_in+1 + 320 0192 B701 movw r22,r14 + 321 0194 00D0 rcall __divmodhi4 + 322 0196 2091 0000 lds r18,voltage + 323 019a 3091 0000 lds r19,voltage+1 + 324 019e 629F mul r22,r18 + 325 01a0 C001 movw r24,r0 + 326 01a2 639F mul r22,r19 + 327 01a4 900D add r25,r0 + 328 01a6 729F mul r23,r18 + 329 01a8 900D add r25,r0 + 330 01aa 1124 clr r1 + 331 01ac B701 movw r22,r14 + 332 01ae 00D0 rcall __udivmodhi4 + 333 .LBE21: + 334 .LBE20: + 335 .LM47: + 336 01b0 862F mov r24,r22 + 337 01b2 90E0 ldi r25,lo8(0) + 338 01b4 B801 movw r22,r16 + 339 01b6 4AE0 ldi r20,lo8(10) + 340 01b8 50E0 ldi r21,hi8(10) + 341 01ba 00D0 rcall itoa + 342 .LVL7: + 343 01bc 00D0 rcall uart_puts + 344 .LM48: + 345 01be 80E0 ldi r24,lo8(__c.1485) + 346 01c0 90E0 ldi r25,hi8(__c.1485) + 347 01c2 00D0 rcall uart_puts_p + 348 .LM49: + 349 01c4 84E6 ldi r24,lo8(100) + 350 01c6 00D0 rcall wait + 351 .LM50: + 352 01c8 84E6 ldi r24,lo8(100) + 353 01ca 00D0 rcall wait + 354 .LM51: + 355 01cc 84E6 ldi r24,lo8(100) + 356 01ce 00D0 rcall wait + 357 .LM52: + 358 01d0 84E6 ldi r24,lo8(100) + 359 01d2 00D0 rcall wait + 360 .LM53: + 361 01d4 84E6 ldi r24,lo8(100) + 362 01d6 00D0 rcall wait + 363 .LM54: + 364 01d8 84E6 ldi r24,lo8(100) + 365 01da 00D0 rcall wait + 366 01dc 00C0 rjmp .L6 + 367 .LBE15: + 368 .LFE4: + 370 .global __vector_6 + 372 __vector_6: + 373 .LFB5: + 374 .LM55: + 375 01de 1F92 push __zero_reg__ + 376 01e0 0F92 push r0 + 377 01e2 0FB6 in r0,__SREG__ + 378 01e4 0F92 push r0 + 379 01e6 1124 clr __zero_reg__ + 380 01e8 8F93 push r24 + 381 01ea 9F93 push r25 + 382 /* prologue: Signal */ + 383 /* frame size = 0 */ + 384 /* stack size = 5 */ + 385 .L__stack_usage = 5 + 386 .LM56: + 387 01ec 8091 0000 lds r24,syscounter + 388 01f0 9091 0000 lds r25,syscounter+1 + 389 01f4 0196 adiw r24,1 + 390 01f6 9093 0000 sts syscounter+1,r25 + 391 01fa 8093 0000 sts syscounter,r24 + 392 /* epilogue start */ + 393 .LM57: + 394 01fe 9F91 pop r25 + 395 0200 8F91 pop r24 + 396 0202 0F90 pop r0 + 397 0204 0FBE out __SREG__,r0 + 398 0206 0F90 pop r0 + 399 0208 1F90 pop __zero_reg__ + 400 020a 1895 reti + 401 .LFE5: + 403 .global syscounter + 404 .global syscounter + 405 .section .bss + 408 syscounter: + 409 0000 0000 .skip 2,0 + 410 .global voltage + 411 .global voltage + 414 voltage: + 415 0002 0000 .skip 2,0 + 416 .global ampere_in + 417 .global ampere_in + 420 ampere_in: + 421 0004 0000 .skip 2,0 + 422 .global ampere_out + 423 .global ampere_out + 426 ampere_out: + 427 0006 0000 .skip 2,0 + 428 .section .progmem.data,"a",@progbits + 431 __c.1485: + 432 0000 570D 0A00 .string "W\r\n" + 435 __c.1483: + 436 0004 6D41 2020 .string "mA " + 436 00 + 439 __c.1481: + 440 0009 4765 6E65 .string "Generator: " + 440 7261 746F + 440 723A 2000 + 443 __c.1479: + 444 0015 570D 0A00 .string "W\r\n" + 447 __c.1477: + 448 0019 6D41 2020 .string "mA " + 448 00 + 451 __c.1475: + 452 001e 4C6F 6164 .string "Load: " + 452 3A20 2020 + 452 2020 2000 + 455 __c.1473: + 456 002a 6456 0D0A .string "dV\r\n" + 456 00 + 459 __c.1470: + 460 002f 566F 6C74 .string "Voltage: " + 460 6167 653A + 460 2020 2000 + 525 .Letext0: DEFINED SYMBOLS *ABS*:0000000000000000 main.c - /tmp/cc5sOhJc.s:2 *ABS*:000000000000003f __SREG__ - /tmp/cc5sOhJc.s:3 *ABS*:000000000000003e __SP_H__ - /tmp/cc5sOhJc.s:4 *ABS*:000000000000003d __SP_L__ - /tmp/cc5sOhJc.s:5 *ABS*:0000000000000034 __CCP__ - /tmp/cc5sOhJc.s:6 *ABS*:0000000000000000 __tmp_reg__ - /tmp/cc5sOhJc.s:7 *ABS*:0000000000000001 __zero_reg__ - /tmp/cc5sOhJc.s:18 .text:0000000000000000 timer_init - /tmp/cc5sOhJc.s:50 .text:0000000000000016 ports_init - /tmp/cc5sOhJc.s:72 .text:0000000000000024 get_voltage - /tmp/cc5sOhJc.s:88 .text:0000000000000028 get_power - /tmp/cc5sOhJc.s:119 .text:000000000000003a main - /tmp/cc5sOhJc.s:138 .text:0000000000000042 __vector_6 - /tmp/cc5sOhJc.s:174 .bss:0000000000000000 syscounter + /tmp/ccTFX6lH.s:2 *ABS*:000000000000003f __SREG__ + /tmp/ccTFX6lH.s:3 *ABS*:000000000000003e __SP_H__ + /tmp/ccTFX6lH.s:4 *ABS*:000000000000003d __SP_L__ + /tmp/ccTFX6lH.s:5 *ABS*:0000000000000034 __CCP__ + /tmp/ccTFX6lH.s:6 *ABS*:0000000000000000 __tmp_reg__ + /tmp/ccTFX6lH.s:7 *ABS*:0000000000000001 __zero_reg__ + /tmp/ccTFX6lH.s:18 .text:0000000000000000 timer_init + /tmp/ccTFX6lH.s:50 .text:0000000000000016 ports_init + /tmp/ccTFX6lH.s:72 .text:0000000000000024 measure + /tmp/ccTFX6lH.s:414 .bss:0000000000000002 voltage + /tmp/ccTFX6lH.s:420 .bss:0000000000000004 ampere_in + /tmp/ccTFX6lH.s:426 .bss:0000000000000006 ampere_out + /tmp/ccTFX6lH.s:144 .text:0000000000000098 get_power + /tmp/ccTFX6lH.s:179 .text:00000000000000ba main + /tmp/ccTFX6lH.s:459 .progmem.data:000000000000002f __c.1470 + /tmp/ccTFX6lH.s:455 .progmem.data:000000000000002a __c.1473 + /tmp/ccTFX6lH.s:451 .progmem.data:000000000000001e __c.1475 + /tmp/ccTFX6lH.s:447 .progmem.data:0000000000000019 __c.1477 + /tmp/ccTFX6lH.s:443 .progmem.data:0000000000000015 __c.1479 + /tmp/ccTFX6lH.s:439 .progmem.data:0000000000000009 __c.1481 + /tmp/ccTFX6lH.s:435 .progmem.data:0000000000000004 __c.1483 + /tmp/ccTFX6lH.s:431 .progmem.data:0000000000000000 __c.1485 + /tmp/ccTFX6lH.s:372 .text:00000000000001de __vector_6 + /tmp/ccTFX6lH.s:408 .bss:0000000000000000 syscounter UNDEFINED SYMBOLS adc_read_avg +__floatunsisf +__divsf3 +__fixunssfsi +__divmodhi4 +__udivmodhi4 adc_init +uart_init +uart_puts_p +itoa +uart_puts +wait __do_clear_bss diff --git a/display/software/powerboard/src/uart.c b/display/software/powerboard/src/uart.c new file mode 100644 index 0000000..3cb2a81 --- /dev/null +++ b/display/software/powerboard/src/uart.c @@ -0,0 +1,663 @@ +/************************************************************************* +Title: Interrupt UART library with receive/transmit circular buffers +Author: Peter Fleury http://jump.to/fleury +File: $Id: uart.c,v 1.10 2013/06/02 07:27:04 peter Exp $ +Software: AVR-GCC 4.1, AVR Libc 1.4.6 or higher +Hardware: any AVR with built-in UART, +License: GNU General Public License + +DESCRIPTION: + An interrupt is generated when the UART has finished transmitting or + receiving a byte. The interrupt handling routines use circular buffers + for buffering received and transmitted data. + + The UART_RX_BUFFER_SIZE and UART_TX_BUFFER_SIZE variables define + the buffer size in bytes. Note that these variables must be a + power of 2. + +USAGE: + Refere to the header file uart.h for a description of the routines. + See also example test_uart.c. + +NOTES: + Based on Atmel Application Note AVR306 + +LICENSE: + Copyright (C) 2006 Peter Fleury + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +*************************************************************************/ +#include +#include +#include +#include "uart.h" + + +/* + * constants and macros + */ + +/* size of RX/TX buffers */ +#define UART_RX_BUFFER_MASK ( UART_RX_BUFFER_SIZE - 1) +#define UART_TX_BUFFER_MASK ( UART_TX_BUFFER_SIZE - 1) + +#if ( UART_RX_BUFFER_SIZE & UART_RX_BUFFER_MASK ) +#error RX buffer size is not a power of 2 +#endif +#if ( UART_TX_BUFFER_SIZE & UART_TX_BUFFER_MASK ) +#error TX buffer size is not a power of 2 +#endif + +#if defined(__AVR_AT90S2313__) \ + || defined(__AVR_AT90S4414__) || defined(__AVR_AT90S4434__) \ + || defined(__AVR_AT90S8515__) || defined(__AVR_AT90S8535__) \ + || defined(__AVR_ATmega103__) + /* old AVR classic or ATmega103 with one UART */ + #define AT90_UART + #define UART0_RECEIVE_INTERRUPT UART_RX_vect + #define UART0_TRANSMIT_INTERRUPT UART_UDRE_vect + #define UART0_STATUS USR + #define UART0_CONTROL UCR + #define UART0_DATA UDR + #define UART0_UDRIE UDRIE +#elif defined(__AVR_AT90S2333__) || defined(__AVR_AT90S4433__) + /* old AVR classic with one UART */ + #define AT90_UART + #define UART0_RECEIVE_INTERRUPT UART_RX_vect + #define UART0_TRANSMIT_INTERRUPT UART_UDRE_vect + #define UART0_STATUS UCSRA + #define UART0_CONTROL UCSRB + #define UART0_DATA UDR + #define UART0_UDRIE UDRIE +#elif defined(__AVR_ATmega8__) || defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) \ + || defined(__AVR_ATmega323__) + /* ATmega with one USART */ + #define ATMEGA_USART + #define UART0_RECEIVE_INTERRUPT USART_RXC_vect + #define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect + #define UART0_STATUS UCSRA + #define UART0_CONTROL UCSRB + #define UART0_DATA UDR + #define UART0_UDRIE UDRIE +#elif defined (__AVR_ATmega8515__) || defined(__AVR_ATmega8535__) + #define ATMEGA_USART + #define UART0_RECEIVE_INTERRUPT USART_RX_vect + #define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect + #define UART0_STATUS UCSRA + #define UART0_CONTROL UCSRB + #define UART0_DATA UDR + #define UART0_UDRIE UDRIE +#elif defined(__AVR_ATmega163__) + /* ATmega163 with one UART */ + #define ATMEGA_UART + #define UART0_RECEIVE_INTERRUPT UART_RX_vect + #define UART0_TRANSMIT_INTERRUPT UART_UDRE_vect + #define UART0_STATUS UCSRA + #define UART0_CONTROL UCSRB + #define UART0_DATA UDR + #define UART0_UDRIE UDRIE +#elif defined(__AVR_ATmega162__) + /* ATmega with two USART */ + #define ATMEGA_USART0 + #define ATMEGA_USART1 + #define UART0_RECEIVE_INTERRUPT USART0_RXC_vect + #define UART1_RECEIVE_INTERRUPT USART1_RXC_vect + #define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect + #define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect + #define UART0_STATUS UCSR0A + #define UART0_CONTROL UCSR0B + #define UART0_DATA UDR0 + #define UART0_UDRIE UDRIE0 + #define UART1_STATUS UCSR1A + #define UART1_CONTROL UCSR1B + #define UART1_DATA UDR1 + #define UART1_UDRIE UDRIE1 +#elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) + /* ATmega with two USART */ + #define ATMEGA_USART0 + #define ATMEGA_USART1 + #define UART0_RECEIVE_INTERRUPT USART0_RX_vect + #define UART1_RECEIVE_INTERRUPT USART1_RX_vect + #define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect + #define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect + #define UART0_STATUS UCSR0A + #define UART0_CONTROL UCSR0B + #define UART0_DATA UDR0 + #define UART0_UDRIE UDRIE0 + #define UART1_STATUS UCSR1A + #define UART1_CONTROL UCSR1B + #define UART1_DATA UDR1 + #define UART1_UDRIE UDRIE1 +#elif defined(__AVR_ATmega161__) + /* ATmega with UART */ + #error "AVR ATmega161 currently not supported by this libaray !" +#elif defined(__AVR_ATmega169__) + /* ATmega with one USART */ + #define ATMEGA_USART + #define UART0_RECEIVE_INTERRUPT USART0_RX_vect + #define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect + #define UART0_STATUS UCSRA + #define UART0_CONTROL UCSRB + #define UART0_DATA UDR + #define UART0_UDRIE UDRIE +#elif defined(__AVR_ATmega48__) || defined(__AVR_ATmega88__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega48P__) || defined(__AVR_ATmega88P__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__) \ + || defined(__AVR_ATmega3250__) || defined(__AVR_ATmega3290__) ||defined(__AVR_ATmega6450__) || defined(__AVR_ATmega6490__) + /* ATmega with one USART */ + #define ATMEGA_USART0 + #define UART0_RECEIVE_INTERRUPT USART_RX_vect + #define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect + #define UART0_STATUS UCSR0A + #define UART0_CONTROL UCSR0B + #define UART0_DATA UDR0 + #define UART0_UDRIE UDRIE0 +#elif defined(__AVR_ATtiny2313__) + #define ATMEGA_USART + #define UART0_RECEIVE_INTERRUPT USART_RX_vect + #define UART0_TRANSMIT_INTERRUPT USART_UDRE_vect + #define UART0_STATUS UCSRA + #define UART0_CONTROL UCSRB + #define UART0_DATA UDR + #define UART0_UDRIE UDRIE +#elif defined(__AVR_ATmega329__) || \ + defined(__AVR_ATmega649__) || \ + defined(__AVR_ATmega325__) || \ + defined(__AVR_ATmega645__) + /* ATmega with one USART */ + #define ATMEGA_USART0 + #define UART0_RECEIVE_INTERRUPT USART0_RX_vect + #define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect + #define UART0_STATUS UCSR0A + #define UART0_CONTROL UCSR0B + #define UART0_DATA UDR0 + #define UART0_UDRIE UDRIE0 +#elif defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega640__) +/* ATmega with two USART */ + #define ATMEGA_USART0 + #define ATMEGA_USART1 + #define UART0_RECEIVE_INTERRUPT USART0_RX_vect + #define UART1_RECEIVE_INTERRUPT USART1_RX_vect + #define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect + #define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect + #define UART0_STATUS UCSR0A + #define UART0_CONTROL UCSR0B + #define UART0_DATA UDR0 + #define UART0_UDRIE UDRIE0 + #define UART1_STATUS UCSR1A + #define UART1_CONTROL UCSR1B + #define UART1_DATA UDR1 + #define UART1_UDRIE UDRIE1 +#elif defined(__AVR_ATmega644__) + /* ATmega with one USART */ + #define ATMEGA_USART0 + #define UART0_RECEIVE_INTERRUPT USART0_RX_vect + #define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect + #define UART0_STATUS UCSR0A + #define UART0_CONTROL UCSR0B + #define UART0_DATA UDR0 + #define UART0_UDRIE UDRIE0 +#elif defined(__AVR_ATmega164P__) || defined(__AVR_ATmega324P__) || defined(__AVR_ATmega644P__) + /* ATmega with two USART */ + #define ATMEGA_USART0 + #define ATMEGA_USART1 + #define UART0_RECEIVE_INTERRUPT USART0_RX_vect + #define UART1_RECEIVE_INTERRUPT USART1_RX_vect + #define UART0_TRANSMIT_INTERRUPT USART0_UDRE_vect + #define UART1_TRANSMIT_INTERRUPT USART1_UDRE_vect + #define UART0_STATUS UCSR0A + #define UART0_CONTROL UCSR0B + #define UART0_DATA UDR0 + #define UART0_UDRIE UDRIE0 + #define UART1_STATUS UCSR1A + #define UART1_CONTROL UCSR1B + #define UART1_DATA UDR1 + #define UART1_UDRIE UDRIE1 +#else + #error "no UART definition for MCU available" +#endif + + +/* + * module global variables + */ +static volatile unsigned char UART_TxBuf[UART_TX_BUFFER_SIZE]; +static volatile unsigned char UART_RxBuf[UART_RX_BUFFER_SIZE]; +static volatile unsigned char UART_TxHead; +static volatile unsigned char UART_TxTail; +static volatile unsigned char UART_RxHead; +static volatile unsigned char UART_RxTail; +static volatile unsigned char UART_LastRxError; + +#if defined( ATMEGA_USART1 ) +static volatile unsigned char UART1_TxBuf[UART_TX_BUFFER_SIZE]; +static volatile unsigned char UART1_RxBuf[UART_RX_BUFFER_SIZE]; +static volatile unsigned char UART1_TxHead; +static volatile unsigned char UART1_TxTail; +static volatile unsigned char UART1_RxHead; +static volatile unsigned char UART1_RxTail; +static volatile unsigned char UART1_LastRxError; +#endif + + + +ISR (UART0_RECEIVE_INTERRUPT) +/************************************************************************* +Function: UART Receive Complete interrupt +Purpose: called when the UART has received a character +**************************************************************************/ +{ + unsigned char tmphead; + unsigned char data; + unsigned char usr; + unsigned char lastRxError; + + + /* read UART status register and UART data register */ + usr = UART0_STATUS; + data = UART0_DATA; + + /* */ +#if defined( AT90_UART ) + lastRxError = (usr & (_BV(FE)|_BV(DOR)) ); +#elif defined( ATMEGA_USART ) + lastRxError = (usr & (_BV(FE)|_BV(DOR)) ); +#elif defined( ATMEGA_USART0 ) + lastRxError = (usr & (_BV(FE0)|_BV(DOR0)) ); +#elif defined ( ATMEGA_UART ) + lastRxError = (usr & (_BV(FE)|_BV(DOR)) ); +#endif + + /* calculate buffer index */ + tmphead = ( UART_RxHead + 1) & UART_RX_BUFFER_MASK; + + if ( tmphead == UART_RxTail ) { + /* error: receive buffer overflow */ + lastRxError = UART_BUFFER_OVERFLOW >> 8; + }else{ + /* store new index */ + UART_RxHead = tmphead; + /* store received data in buffer */ + UART_RxBuf[tmphead] = data; + } + UART_LastRxError |= lastRxError; +} + + +ISR (UART0_TRANSMIT_INTERRUPT) +/************************************************************************* +Function: UART Data Register Empty interrupt +Purpose: called when the UART is ready to transmit the next byte +**************************************************************************/ +{ + unsigned char tmptail; + + + if ( UART_TxHead != UART_TxTail) { + /* calculate and store new buffer index */ + tmptail = (UART_TxTail + 1) & UART_TX_BUFFER_MASK; + UART_TxTail = tmptail; + /* get one byte from buffer and write it to UART */ + UART0_DATA = UART_TxBuf[tmptail]; /* start transmission */ + }else{ + /* tx buffer empty, disable UDRE interrupt */ + UART0_CONTROL &= ~_BV(UART0_UDRIE); + } +} + + +/************************************************************************* +Function: uart_init() +Purpose: initialize UART and set baudrate +Input: baudrate using macro UART_BAUD_SELECT() +Returns: none +**************************************************************************/ +void uart_init(unsigned int baudrate) +{ + UART_TxHead = 0; + UART_TxTail = 0; + UART_RxHead = 0; + UART_RxTail = 0; + +#if defined( AT90_UART ) + /* set baud rate */ + UBRR = (unsigned char)baudrate; + + /* enable UART receiver and transmmitter and receive complete interrupt */ + UART0_CONTROL = _BV(RXCIE)|_BV(RXEN)|_BV(TXEN); + +#elif defined (ATMEGA_USART) + /* Set baud rate */ + if ( baudrate & 0x8000 ) + { + UART0_STATUS = (1<>8); + UBRRL = (unsigned char) baudrate; + + /* Enable USART receiver and transmitter and receive complete interrupt */ + UART0_CONTROL = _BV(RXCIE)|(1<>8); + UBRR0L = (unsigned char) baudrate; + + /* Enable USART receiver and transmitter and receive complete interrupt */ + UART0_CONTROL = _BV(RXCIE0)|(1<>8); + UBRR = (unsigned char) baudrate; + + /* Enable UART receiver and transmitter and receive complete interrupt */ + UART0_CONTROL = _BV(RXCIE)|(1<> 8; + }else{ + /* store new index */ + UART1_RxHead = tmphead; + /* store received data in buffer */ + UART1_RxBuf[tmphead] = data; + } + UART1_LastRxError |= lastRxError; +} + + +ISR(UART1_TRANSMIT_INTERRUPT) +/************************************************************************* +Function: UART1 Data Register Empty interrupt +Purpose: called when the UART1 is ready to transmit the next byte +**************************************************************************/ +{ + unsigned char tmptail; + + + if ( UART1_TxHead != UART1_TxTail) { + /* calculate and store new buffer index */ + tmptail = (UART1_TxTail + 1) & UART_TX_BUFFER_MASK; + UART1_TxTail = tmptail; + /* get one byte from buffer and write it to UART */ + UART1_DATA = UART1_TxBuf[tmptail]; /* start transmission */ + }else{ + /* tx buffer empty, disable UDRE interrupt */ + UART1_CONTROL &= ~_BV(UART1_UDRIE); + } +} + + +/************************************************************************* +Function: uart1_init() +Purpose: initialize UART1 and set baudrate +Input: baudrate using macro UART_BAUD_SELECT() +Returns: none +**************************************************************************/ +void uart1_init(unsigned int baudrate) +{ + UART1_TxHead = 0; + UART1_TxTail = 0; + UART1_RxHead = 0; + UART1_RxTail = 0; + + + /* Set baud rate */ + if ( baudrate & 0x8000 ) + { + UART1_STATUS = (1<>8); + UBRR1L = (unsigned char) baudrate; + + /* Enable USART receiver and transmitter and receive complete interrupt */ + UART1_CONTROL = _BV(RXCIE1)|(1< http://jump.to/fleury +File: $Id: uart.h,v 1.12 2012/11/19 19:52:27 peter Exp $ +Software: AVR-GCC 4.1, AVR Libc 1.4 +Hardware: any AVR with built-in UART, tested on AT90S8515 & ATmega8 at 4 Mhz +License: GNU General Public License +Usage: see Doxygen manual + +LICENSE: + Copyright (C) 2006 Peter Fleury + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +************************************************************************/ + +/** + * @defgroup pfleury_uart UART Library + * @code #include @endcode + * + * @brief Interrupt UART library using the built-in UART with transmit and receive circular buffers. + * + * This library can be used to transmit and receive data through the built in UART. + * + * An interrupt is generated when the UART has finished transmitting or + * receiving a byte. The interrupt handling routines use circular buffers + * for buffering received and transmitted data. + * + * The UART_RX_BUFFER_SIZE and UART_TX_BUFFER_SIZE constants define + * the size of the circular buffers in bytes. Note that these constants must be a power of 2. + * You may need to adapt this constants to your target and your application by adding + * CDEFS += -DUART_RX_BUFFER_SIZE=nn -DUART_RX_BUFFER_SIZE=nn to your Makefile. + * + * @note Based on Atmel Application Note AVR306 + * @author Peter Fleury pfleury@gmx.ch http://jump.to/fleury + */ + +/**@{*/ + + +#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304 +#error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !" +#endif + + +/* +** constants and macros +*/ + +/** @brief UART Baudrate Expression + * @param xtalcpu system clock in Mhz, e.g. 4000000UL for 4Mhz + * @param baudrate baudrate in bps, e.g. 1200, 2400, 9600 + */ +#define UART_BAUD_SELECT(baudRate,xtalCpu) (((xtalCpu) + 8UL * (baudRate)) / (16UL * (baudRate)) -1UL) + +/** @brief UART Baudrate Expression for ATmega double speed mode + * @param xtalcpu system clock in Mhz, e.g. 4000000UL for 4Mhz + * @param baudrate baudrate in bps, e.g. 1200, 2400, 9600 + */ +#define UART_BAUD_SELECT_DOUBLE_SPEED(baudRate,xtalCpu) ( ((((xtalCpu) + 4UL * (baudRate)) / (8UL * (baudRate)) -1UL)) | 0x8000) + + +/** Size of the circular receive buffer, must be power of 2 */ +#ifndef UART_RX_BUFFER_SIZE +#define UART_RX_BUFFER_SIZE 32 +#endif +/** Size of the circular transmit buffer, must be power of 2 */ +#ifndef UART_TX_BUFFER_SIZE +#define UART_TX_BUFFER_SIZE 32 +#endif + +/* test if the size of the circular buffers fits into SRAM */ +#if ( (UART_RX_BUFFER_SIZE+UART_TX_BUFFER_SIZE) >= (RAMEND-0x60 ) ) +#error "size of UART_RX_BUFFER_SIZE + UART_TX_BUFFER_SIZE larger than size of SRAM" +#endif + +/* +** high byte error return code of uart_getc() +*/ +#define UART_FRAME_ERROR 0x1000 /* Framing Error by UART */ +#define UART_OVERRUN_ERROR 0x0800 /* Overrun condition by UART */ +#define UART_PARITY_ERROR 0x0400 /* Parity Error by UART */ +#define UART_BUFFER_OVERFLOW 0x0200 /* receive ringbuffer overflow */ +#define UART_NO_DATA 0x0100 /* no receive data available */ + + +/* +** function prototypes +*/ + +/** + @brief Initialize UART and set baudrate + @param baudrate Specify baudrate using macro UART_BAUD_SELECT() + @return none +*/ +extern void uart_init(unsigned int baudrate); + + +/** + * @brief Get received byte from ringbuffer + * + * Returns in the lower byte the received character and in the + * higher byte the last receive error. + * UART_NO_DATA is returned when no data is available. + * + * @param void + * @return lower byte: received byte from ringbuffer + * @return higher byte: last receive status + * - \b 0 successfully received data from UART + * - \b UART_NO_DATA + *
no receive data available + * - \b UART_BUFFER_OVERFLOW + *
Receive ringbuffer overflow. + * We are not reading the receive buffer fast enough, + * one or more received character have been dropped + * - \b UART_OVERRUN_ERROR + *
Overrun condition by UART. + * A character already present in the UART UDR register was + * not read by the interrupt handler before the next character arrived, + * one or more received characters have been dropped. + * - \b UART_FRAME_ERROR + *
Framing Error by UART + */ +extern unsigned int uart_getc(void); + + +/** + * @brief Put byte to ringbuffer for transmitting via UART + * @param data byte to be transmitted + * @return none + */ +extern void uart_putc(unsigned char data); + + +/** + * @brief Put string to ringbuffer for transmitting via UART + * + * The string is buffered by the uart library in a circular buffer + * and one character at a time is transmitted to the UART using interrupts. + * Blocks if it can not write the whole string into the circular buffer. + * + * @param s string to be transmitted + * @return none + */ +extern void uart_puts(const char *s ); + + +/** + * @brief Put string from program memory to ringbuffer for transmitting via UART. + * + * The string is buffered by the uart library in a circular buffer + * and one character at a time is transmitted to the UART using interrupts. + * Blocks if it can not write the whole string into the circular buffer. + * + * @param s program memory string to be transmitted + * @return none + * @see uart_puts_P + */ +extern void uart_puts_p(const char *s ); + +/** + * @brief Macro to automatically put a string constant into program memory + */ +#define uart_puts_P(__s) uart_puts_p(PSTR(__s)) + + + +/** @brief Initialize USART1 (only available on selected ATmegas) @see uart_init */ +extern void uart1_init(unsigned int baudrate); +/** @brief Get received byte of USART1 from ringbuffer. (only available on selected ATmega) @see uart_getc */ +extern unsigned int uart1_getc(void); +/** @brief Put byte to ringbuffer for transmitting via USART1 (only available on selected ATmega) @see uart_putc */ +extern void uart1_putc(unsigned char data); +/** @brief Put string to ringbuffer for transmitting via USART1 (only available on selected ATmega) @see uart_puts */ +extern void uart1_puts(const char *s ); +/** @brief Put string from program memory to ringbuffer for transmitting via USART1 (only available on selected ATmega) @see uart_puts_p */ +extern void uart1_puts_p(const char *s ); +/** @brief Macro to automatically put a string constant into program memory */ +#define uart1_puts_P(__s) uart1_puts_p(PSTR(__s)) + +/**@}*/ + + +#endif // UART_H +