IRP - Message - How to resolve this

General discussion on mikroC PRO for PIC.
Author
Message
shanpuru
Posts: 39
Joined: 20 Nov 2009 18:42

#16 Post by shanpuru » 21 Jan 2010 12:08

Hi Mince,

I have done that too.

Looking forward to the HEX file from you.

Thanks
Shankar

dobova
Posts: 200
Joined: 13 Feb 2005 16:23
Location: Italy

#17 Post by dobova » 21 Jan 2010 12:13

Stupid help:
I suggest, as a test, to rename variable "output" with different name, like "_out_put" ... I got similar problem with other variable name. It may be the compiler has internal use of this word.
Ciao
Dome

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#18 Post by Mince-n-Tatties » 21 Jan 2010 12:19

shanpuru wrote:Hi Mince,
Looking forward to the HEX file from you.
i sent it yesterday to the email you PM'd to me. I also sent a screen grab of the build to show that there where no irp or any other errors.

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#19 Post by Mince-n-Tatties » 21 Jan 2010 13:02

hex file

:040000008A15322CFF
:0400060000000800EE
:10000A00083083120313FC002330FD00FD0B0B287C
:06001A00FC0B0B2808009E
:10002000103083120313FD00FD0B1428000008009C
:1000300083160313141926281F301105F1007108C7
:10004000003A031D26280130F0000800F0010800E6
:1000500083120317C81B2E2886132F288617481BC8
:100060003328061334280617C81A38288612392868
:100070008616481A3D2806123E28061683160313D4
:100080006B1845288312061547288312061186151A
:10009000032086110317C8194F2886135028861786
:1000A00048195428061355280617C81859288612C7
:1000B0005A28861648185E2806125F2806168316E8
:1000C00003136B186628831206156828831206111D
:1000D00086150320861183166B1C70280520712855
:0400E00010200800E4
:0800E400831603131115080037
:1000EC0083120317C601C7014708123C031D802861
:1000FC0046088E3C031C8D2818207008031987288D
:10010C008D2883120317C60A0319C70A7A2883128B
:10011C00031712304702031D95288F304602031C2B
:10012C009A287B30F0000800831603131114111C5D
:08013C00A0289D28F001080035
:10014400831603136B10831203174608C800282074
:0601540083166B14080085
:10015A00831203138C1103174608031393008316A3
:10016A00141DB828B42883128C19BC28B828831601
:10017A00111BC128F001080011150230F000080017
:10018A0083120313F801F9011030FC00710DF80D08
:10019A00F90D7408F8027508031C750FF9020318A3
:1001AA00DD287408F80775080318750FF907031096
:0A01BA00F00DF10DFC0BCB2808003E
:1001C4007620D03083120317C600AD2083120317A4
:1001D4004208C600AD20831203174308C600AD20B1
:0401E400722008007D
:0E01E800831603139114911CFA28F7280800BF
:1001F6000D29803083120317C2002029C030C200A7
:1002060020299430C2002029D430C2002029803011
:10021600C2002029831203174208013A0319FC2859
:100226004208023A031901294208033A031904292C
:100236004208043A031907290A294303F000420831
:10024600F0077008C2007008C800282083166B10DB
:1002560083120317C50145084407840000080319E3
:100266003E294508440784000008C600A2208312E0
:0E0276000317C50A2E29831603136B14080004
:100284000A3083120313F4000030F5000317420808
:10029400F0004308F100C520303070078316D60003
:1002A4000A30F4000030F500831203174208F0000E
:1002B4004308F100C5207808F0007908F1003030D7
:0802C40070078316D700080043
:1002CC00831203137008F100F0010830FC00710870
:1002DC00F40C03187529FC0B6E29F1010034031082
:1002EC007A29F40C0318F107F10CF00CFC0B7729AC
:0202FC000800F8
:1002FE00831203138C118316911583128C1988297E
:10030E0084291308F10003174208003A031D9329AC
:10031E0083160313911696298316031391128312D3
:10032E008C118316111683128C199E299A29710825
:04033E00F0000800C3
:1003420083120313F8010830FC00700DF80D7408D5
:10035200F8020318AE29F8070310F00DFC0BA629CA
:02036200080091
:100364000030831203174106031DBA2901304006E9
:10037400031D1B2A022A3E083F04031DC929B40A8F
:100384003408173C0318C8291730B400CE293408A0
:10039400003C0318CE29B4033408B200B3011A2A6E
:1003A4003E083F04031DE02983160313EE0A6E087A
:1003B4003B3C0318DF293B30EE00E7298316031387
:1003C4006E08003C0318E729EE036E08EC00ED010B
:1003D4001A2A831203173E083F04031DF929B50A9C
:1003E40035083B3C0318F8293B30B500FE29350895
:1003F400003C0318FE29B5033508B000B1011A2AE0
:1004040000303D06031D082A00303C060319BD29AF
:1004140000303D06031D102A01303C060319D22981
:1004240000303D06031D182A02303C060319EB294F
:10043400CA2A8312031700304106031D232A0230FF
:100444004006031D902A752A3E083F04031D342AE2
:1004540083160313EF0A6F081F3C0318332A1F3057
:10046400EF003B2A831603136F08003C03183B2A52
:10047400EF036F08D100D2018F2A831203173E08BD
:100484003F04031D4F2A83160313D30A53080C3C5D
:1004940003184E2A0C30D300562A8316031353082C
:1004A400003C0318562AD3035308CE00CF018F2AE9
:1004B400831203173E083F04031D6A2A831603139D
:1004C400D00A5008633C0318692A6330D000712AAB
:1004D400831603135008003C0318712AD0035008F4
:1004E400D400D5018F2A0030831203173D06031D63
:1004F4007D2A00303C060319262A00303D06031DE0
:10050400852A01303C0603193F2A00303D06031DAD
:100514008D2A02303C0603195A2ACA2A8312031769
:1005240000304106031D982A03304006031DCA2AE1
:10053400C02A3E083F04031DB12A83160313E90AA7
:100544000319EA0A6A08003C031DAA2A6908083C40
:100554000318B02A0830E9000030EA00BF2A8316E5
:1005640003136A08003C031DB92A6908013C0318F7
:10057400BF2A0130E902031CEA03CA2A00308312AD
:1005840003173D06031DC82A00303C0603199B2AA5
:0205940008005D
:10059600013083120317C800282003173C08003ACD
:1005A600031D012B0130C2000130C3002430C400FA
:1005B600FB20013083120317C2000630C300293026
:1005C600C400FB20023083120317C2000630C300AA
:1005D6003230C400FB20033083120317C2000630FA
:1005E600C300A930C400FB20043083120317C200E5
:1005F6000630C3006B30C400FB20492C831203175E
:100606003C08013A03190C2B3C08023A03190C2B3F
:10061600CC2B3C08013A031D5E2B0130C200013091
:10062600C300A030C400FB20831203173208C200A7
:100636003308C3004221013083120317C2000D3074
:10064600C300D630C400FB20013083120317C2005A
:100656000F30C3006930C400FB206C0883120317F7
:10066600C200831603136D0883120317C3004221C9
:10067600013083120317C2001030C300D630C40005
:10068600FB20013083120317C2001230C300B030C2
:10069600C400FB20831203173008C2003108C300D0
:1006A6004221013083120317C2001330C300D63033
:1006B600C400FB20B92B831203173C08023A031D22
:1006C600B92B0130C2000130C300B930C400FB2091
:1006D600510883120317C2008316031352088312AC
:1006E6000317C3004221013083120317C2000D30E5
:1006F600C300D630C400FB20013083120317C200AA
:100706000F30C300C230C400FB204E08831203170B
:10071600C200831603134F0883120317C300422136
:10072600013083120317C2001030C300D630C40054
:10073600FB20013083120317C2001230C300B2300F
:10074600C400FB20540883120317C2008316031348
:10075600550883120317C300422101308312031781
:10076600C2001330C300D630C400FB20033083120E
:100776000317C2000630C300B430C400FB200430A7
:1007860083120317C2000630C3006430C400FB2086
:10079600492C831203173C08033A031D492C0130E8
:1007A600C2000230C3003A30C400FB20023083127C
:1007B6000317C2000130C3003E30C400FB206908A5
:1007C60083120317C200831603136A0883120317E2
:1007D600C3004221023083120317C2000730C30050
:1007E600D630C400FB20023083120317C2000B3040
:1007F600C3003730C400FB2001306902F20000302C
:10080600031C013E6A02F3007208F000F00D70103E
:100816007008103E8400000883120317C200840A81
:100826000008C3004221023083120317C2000E30B3
:10083600C300D630C400FB20023083120317C20067
:100846001030C3005830C400FB206908F000F00DDA
:1008560070107008103E8400000883120317C2004F
:10086600840A0008C3004221023083120317C20023
:100876001130C300D630C400FB20033083120317A7
:0E088600C2000A30C3005A30C400FB20080034
:0E0894008312031737088A0036088200080016
:1008A200831203173C08013A031DCE2C0A30F400D0
:1008B2003508F000A1217008F100F10D7110F10D61
:1008C2007110F10D7110F10D7110F03071050317F7
:1008D200BD000A30F4006621700803173502F000EB
:1008E2000F30F0053D08F0077008B500C20170082E
:1008F200C300E2200A30F4006E08F000A121700863
:10090200F100F10D7110F10D7110F10D7110F10D79
:100912007110F03071050317BD000A30F400662132
:10092200700883166E02F0000F30F0058312031771
:100932003D08F007700883160313EE00013083129E
:100942000317C2007008C300E2200A30F4008312C9
:1009520003173408F000A1217008F100F10D7110A5
:10096200F10D7110F10D7110F10D7110F030710572
:100972000317BD000A30F400662170080317340221
:10098200F0000F30F0053D08F0077008B4000230A7
:10099200C2007008C300E220572D831203173C08DF
:1009A200023A031D572D0A30F400831603136F0811
:1009B200F000A1217008F100F10D7110F10D71101C
:1009C200F10D7110F10D7110303071050317BD007A
:1009D2000A30F4006621700883166F02F0000F30AF
:1009E200F005831203173D08F007700883160313FE
:1009F200EF00043083120317C2007008C300E22024
:100A02000A30F4005308F000A1217008F100F10D42
:100A12007110F10D7110F10D7110F10D7110103096
:100A220071050317BD000A30F400662170088316B1
:100A32005302F0000F30F005831203173D08F00750
:100A4200700883160313D300053083120317C20004
:100A52007008C300E2200A30F4005008F000A1211F
:100A62007008F100F10D7110F10D7110F10D71109E
:100A7200F10D7110F03071050317BD000A30F4005A
:100A82006621700883165002F0000F30F0058312C1
:100A920003173D08F007700883160313D0000630D1
:100AA20083120317C2007008C300E2200B30FB0060
:100AB2002630FC005D30FD00FD0B5D2DFC0B5D2D35
:0A0AC200FB0B5D2D00000000080092
:100ACC007620D03083120317C600AD208312031793
:100ADC003C08C600AD20F420D13083120317C600A9
:100AEC00AD2083120317C2017F2170080317BD00CC
:0C0AFC007220831203173D08F000080070
:100B080083120317BC0166257008B500F030700524
:100B1800F2007208F000F00CF013F00CF013F00C77
:100B2800F013F00CF0130A30F40066210F300317AD
:100B38003505F1007108F0077008B5007008B000BD
:100B4800B1010130BC006625700883160313EE005E
:100B5800F0307005F2007208F000F00CF013F00CA1
:100B6800F013F00CF013F00CF0130A30F4006621C7
:100B78000F3083166E05F1007108F0077008EE005B
:100B88007008EC00ED01023083120317BC006625E3
:100B98007008B40030307005F2007208F000F00CF4
:100BA800F013F00CF013F00CF013F00CF0130A3003
:100BB800F40066210F3003173405F1007108F007BF
:100BC8007008B4007008B200B3010430BC00662598
:100BD800700883160313EF0030307005F2007208B6
:100BE800F000F00CF013F00CF013F00CF013F00C14
:100BF800F0130A30F40066210F3083166F05F100F8
:100C08007108F0077008EF007008D100D2010530B4
:100C180083120317BC006625700883160313D300DC
:100C280010307005F2007208F000F00CF013F00CB0
:100C3800F013F00CF013F00CF0130A30F4006621F6
:100C48000F3083165305F1007108F0077008D300C0
:100C58007008CE00CF01063083120317BC0066254A
:100C6800700883160313D000F0307005F200720884
:100C7800F000F00CF013F00CF013F00CF013F00C83
:100C8800F0130A30F40066210F3083165005F10086
:100C98007108F0077008D0007008D400D5018312DD
:100CA80003173308831603136706031D5F2E6608B0
:100CB800831203173206031D682E83160313680870
:100CC800593A0319682E8D2E83120317320883169A
:100CD8000313E60083120317330883160313E70090
:100CE800831203173208C2003308C30042210130BF
:100CF80083120317C2000D30C300D630C400FB2096
:100D0800013083120317C2000F30C3003030C40013
:100D1800FB206D084D06031D932E4C086C06031D21
:100D28009A2E6808593A03199A2EBB2E6C08CC00E3
:100D38006D08CD006C0883120317C20083160313D5
:100D48006D0883120317C300422101308312031771
:100D5800C2001030C300D630C400FB20013083121B
:100D68000317C2001230C3002230C400FB208312D4
:100D780003173108831603134706031DC72E4608B9
:100D8800831203173006031DD02E83160313680839
:100D9800593A0319D02EEC2E831203173008831604
:100DA8000313C60083120317310883160313C70001
:100DB800831203173008C2003108C30042210130F2
:100DC80083120317C2001330C300D630C400FB20BF
:100DD80052084506031DF22E44085106031DF92E3C
:100DE8006808593A0319F92E1A2F5108C4005208F5
:100DF800C500510883120317C20083160313520853
:100E080083120317C3004221023083120317C20062
:100E18000D30C300D630C400FB2002308312031704
:100E2800C2000F30C3002030C400FB204F08490621
:100E3800031D202F48084E06031D272F6808593A1E
:100E48000319272F482F4E08C8004F08C9004E081D
:100E580083120317C200831603134F088312031764
:100E6800C3004221023083120317C2001030C300AE
:100E7800D630C400FB20023083120317C2001230A0
:100E8800C3002E30C400FB2055084B06031D4E2F0F
:100E98004A085406031D552F6808593A0319552F57
:100EA8006D2F5408CA005508CB0054088312031745
:100EB800C20083160313550883120317C300422187
:100EC800023083120317C2001330C300D630C400A7
:080ED800FB204E30E800080089
:100EE00083160313141394130716871538308312CF
:040EF0009400080062
:100EF4004A248A110A128000840AB60A0319B70A1E
:080F0400F003031D7A2F080021
:10100000831203173D08003A031DA428922880305C
:10101000C8008A1128208A1501300317BE0000304D
:10102000BF0000303F02031D172806303E020318A0
:1010300023281430C8008A1128208A150317BE0AF5
:101040000319BF0A11280F30C8008A1128208A15F9
:10105000A328C0300317C8008A1128208A15013040
:101060000317BE000030BF0000303F02031D3A28C6
:1010700006303E02031846281430C8008A11282082
:101080008A150317BE0A0319BF0A34280F30C80097
:101090008A1128208A15A32894300317C8008A11C2
:1010A00028208A1501300317BE000030BF00003031
:1010B0003F02031D5D2806303E02031869281430E4
:1010C000C8008A1128208A150317BE0A0319BF0A0F
:1010D00057280F30C8008A1128208A15A328D43039
:1010E0000317C8008A1128208A1501300317BE0093
:1010F0000030BF0000303F02031D802806303E0252
:1011000003188C281430C8008A1128208A15031768
:10111000BE0A0319BF0A7A280F30C8008A11282096
:101120008A15A32803173C08003A031907283C082E
:10113000013A031929283C08023A03194C283C08B3
:10114000033A03196F28682A03173D08013A031967
:10115000AE283D08023A0319AE281F2A092A3D0885
:10116000013A031DC2283408F000F1017008B200F2
:101170007108B3007008C2007108C3008A114221CF
:101180008A15DA28831203173D08023A031DDA286C
:10119000831603136F08F000F1017008D100710885
:1011A000D200700883120317C2007108C3008A11AD
:1011B00042218A15013083120317C2000D30C3008B
:1011C000D630C4008A11FB208A15803083120317A1
:1011D000C8008A1128208A1501300317BE0000308C
:1011E000BF0000303F02031DF7280E303E020318F7
:1011F00003291430C8008A1128208A150317BE0A53
:101200000319BF0AF1280F30C8008A1128208A1557
:101210001E2A03173D08013A031D212983160313D3
:101220006E08F000F1017008EC007108ED00700824
:1012300083120317C2007108C3008A1142218A1564
:101240003929831203173D08023A031D39298316F1
:1012500003135308F000F1017008CE007108CF00AD
:10126000700883120317C2007108C3008A1142215B
:101270008A15013083120317C2001030C300D63024
:10128000C4008A11FB208A15803083120317C8001E
:101290008A1128208A1501300317BE000030BF00D4
:1012A00000303F02031D562911303E020318622907
:1012B0001430C8008A1128208A150317BE0A0319A2
:1012C000BF0A50290F30C8008A1128208A151E2A0B
:1012D00003173D08013A031D7C293508F000F10190
:1012E0007008B0007108B1007008C2007108C30036
:1012F0008A1142218A159429831203173D08023A64
:10130000031D9429831603135008F000F10170089F
:10131000D4007108D500700883120317C200710849
:10132000C3008A1142218A15013083120317C200BB
:101330001330C300D630C4008A11FB208A158030D8
:1013400083120317C8008A1128208A150130031759
:10135000BE000030BF0000303F02031DB129143031
:101360003E020318BD291430C8008A1128208A15AE
:101370000317BE0A0319BF0AAB290F30C8008A1130
:1013800028208A151E2A94300317C8008A112820A5
:101390008A1501300317BE000030BF0000303F0245
:1013A000031DD42906303E020318E0291430C8007A
:1013B0008A1128208A150317BE0A0319BF0ACE29ED
:1013C0000F30C8008A1128208A151E2AD43003172E
:1013D000C8008A1128208A1501300317BE0000308A
:1013E000BF0000303F02031DF72906303E020318FC
:1013F000032A1430C8008A1128208A150317BE0A50
:101400000319BF0AF1290F30C8008A1128208A1554
:101410001E2A03173C08003A0319AF283C08013A7A
:10142000031909293C08023A031968293C08033AC0
:101430000319C3293C08043A0319E629682A03174B
:101440003D08033A031D682A632A831603136908BB
:1014500083120317C200831603136A08831203174B
:10146000C3008A1142218A15023083120317C20079
:101470000730C300D630C4008A11FB208A15C03063
:1014800083120317C8008A1128208A150130031718
:10149000BE000030BF0000303F02031D512A08305B
:1014A0003E0203185D2A1430C8008A1128208A15CC
:1014B0000317BE0A0319BF0A4B2A0F30C8008A114E
:1014C00028208A15682A03173C08003A0319252AA0
:0214D000080012
:1014D200831603138611061106128612061386134B
:1014E20083128611061186130613861206128A11BA
:1014F20005208A158A1105208A158A1105208A1568
:101502008616061686158A1103208A1586118A11F7
:1015120005208A1586158A1103208A1586118A11DB
:1015220005208A1586158A1103208A1586118A11CB
:1015320005208A15061286158A1103208A1586113E
:101542008A1105208A1586158A1103208A158611AB
:101552008612861786158A1103208A1586118A112A
:1015620005208A158613061686158A1103208A1508
:101572008611061286158A1103208A1586118A1190
:1015820005208A1586158A1103208A1586110616EA
:1015920086158A1103208A1586118A1105208A155B
:1015A200061286158A1103208A15861186170617D8
:1015B2008616061686158A1103208A1586118A1147
:0A15C20005208A1583166B1408003B
:1015CC0083120317B801B90183160313E601E7016F
:1015DC00CC01CD01C601C701C401C501C801C901B7
:1015EC00CA01CB0183120317BC018A11CB228A15C5
:1015FC00831203173808BC003908BD000020831281
:10160C0003138818312B8230FC00DD30FD00FD0BFC
:10161C000D2BFC0B0D2B000000000317B80A39082A
:10162C00003A031D1E2B3808033C03181E2BB8016F
:10163C003908013A0319272B3908023A0319272BC9
:10164C002C2B3808043C03182C2BB8013808BC0090
:10165C003908BD000020831203130819D42B8230E3
:10166C00FC00DD30FD00FD0B392BFC0B392B000091
:10167C00000003173908003A031D492B3808033AB8
:10168C00031D492B252C3908003A031D612B380802
:10169C00003A031D612B0130B900B8010130BC00C8
:1016AC008A11CB228A15831203173808BC0039081B
:1016BC00BD000020D42B831203173908003A031DF8
:1016CC007B2B3808013A031D7B2B0230B900B80183
:1016DC000230BC008A11CB228A15831203173808FA
:1016EC00BC003908BD000020D42B83120317390825
:1016FC00003A031D952B3808023A031D952B033035
:10170C00B900B8010330BC008A11CB228A158312B0
:10171C0003173808BC003908BD000020D42B8312F5
:10172C0003173908013A0319A02B3908023A031997
:10173C00A02BB22B3808043A031DB22BB901B80107
:10174C00BC018A11CB228A15831203173808BC00FE
:10175C003908BD000020D42B831203173908013A35
:10176C000319BD2B3908023A0319BD2BD42B3808A9
:10177C00033A031DD42B3908BC008A1151248A1555
:10178C00831203173908BC008A11CB228A158312E5
:10179C0003173808BC003908BD000020831203135E
:1017AC008819F52B8230FC00DD30FD00FD0BDC2BA5
:1017BC00FC0BDC2B0000000003173808BC00BD013B
:1017CC00BE01BF013908C000C1018A11B2218A15BE
:1017DC00831203173808BC003908BD00002083129F
:1017EC000313081A182C8230FC00DD30FD00FD0BB1
:1017FC00FD2BFC0BFD2B0000000003173808BC0070
:10180C00BD010130BE000030BF003908C000C1016D
:10181C008A11B2218A15831203173808BC003908C3
:10182C00BD000020823083120313FC00DD30FD006C
:10183C00FD0B1E2CFC0B1E2C00000000052B013098
:10184C000317C8008A1128208A150C300317C8000A
:08185C008A1128208A150800FA
:10186400D6249F30831603138800831286018316BF
:10187400870183128701FF3083168800FF308312AB
:1018840088008316890183128901073083169F001B
:10189400871507165930E8000130E9000030EA00E6
:1018A4000A30831203179000003091001E3092001A
:1018B400003093000B30FB002630FC005D30FD004F
:1018C400FD0B622CFC0B622CFB0B622C0000000055
:1018D4000A308316031393008A1170278A1569222C
:1018E400013083120317C8008A1128208A150C308E
:1018F4000317C8008A1128208A1501300317C20073
:101904000130C3004430C4008A11FB208A1506301C
:10191400FB001330FC00AD30FD00FD0B8F2CFC0BE5
:101924008F2CFB0B8F2C0000000001308312031757
:10193400C8008A1128208A158230FC00DD30FD00A1
:10194400FD0BA22CFC0BA22C000000008A118425A4
:101954008A1583120818BE2C0230FB004530FC00A7
:10196400A930FD00FD0BB42CFC0BB42CFB0BB42CE8
:1019740000000000E622CE2C881BCE2C0230FB0097
:101984004530FC00A930FD00FD0BC62CFC0BC62C19
:0C199400FB0BC62C000000009E2CCF2C8A
:1019AC0020308400493083120313F0008630031773
:1019BC00B6000730B7008A117A278A15A030840048
:1019CC0009300313F000E3300317B6000730B700FB
:1019DC008A117A278A156930840002300313F000CB
:1019EC00F8300317B6000730B7008A117A278A152A
:1019FC00A930840007300313F000EC300317B60055
:101A0C000730B7008A117A278A156B3084000530AD
:101A1C000313F000F3300317B6000730B7008A1138
:101A2C007A278A15B030840014300313F000CF30BD
:101A3C000317B6000730B7008A117A278A150800F9
:040F0C002F3400344A
:040F10003A3400343B
:0A0F14004D3465346E34753400343A
:0A0F1E00543469346D346534003436
:040F28002F3400342E
:040F2C003A3400341F
:0A0F30004434613474346534003435
:060F3A004F346E34003458
:080F40005334653474340034AD
:0C0F4800543469346D3465347234003464
:100F5400203449346E346934743461346C34693403
:100F64007A3469346E3467342034543469346D34DB
:080F74006534723420340034AE
:040F7C003A340034CF
:100F80004F34463446342034303430343A343034FC
:040F900030340034C5
:0A0F940045347834693474340034B5
:040F9E003A340034AD
:040FA2002F340034B4
:0A0FA60053346134763465340034AE
:100FB00053346534743420344434613474346534C7
:020FC0000034FB
:040FC2002F34003494
:100FC6005334653474342034543469346D346534A0
:020FD6000034E5
:0E0FD800543469346D3465347234733400342B
:0A0FE6004534783469347434003463
:040FF0003A3400345B
:02400E004A2F37
:00000001FF

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#20 Post by Mince-n-Tatties » 21 Jan 2010 14:11

and the screen grab showing no error reported

Image

User avatar
anikolic
mikroElektronika team
Posts: 1775
Joined: 17 Aug 2009 16:51
Location: Belgrade
Contact:

#21 Post by anikolic » 21 Jan 2010 14:11

Hi,
Our PIC compilers, for the time being, do not handle indirect access to higher two banks of RAM automatically. This should be done by setting the appropriate IRP bit for addressing those higher locations. If some arrays end up linked in those parts of RAM, you have two options:
1. First option is the most convenient. Just go to Statistics and take a look at Used RAM locations and try locating the appropriate place in lower two banks where your array might fit. Then just use linker command absolute and force the linker to place your array there. I have found out that your two arrays might be fitted in to successive RAM locations:

Code: Select all

unsigned int on[16] absolute 0x00C4;
unsigned char output[16] absolute 0x00E4;
2. Other option is that you handle this IRP bit by yourself. But this is a little tricky and requires more explanation, so if you are very much into it, I will explain in more details, but if you are satisfied with the first solution then this is not necessary.

Best regards,
Aleksandar
Web Department Manager

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#22 Post by Mince-n-Tatties » 21 Jan 2010 14:23

hi aleksandar,

with us both using the same compiler at the same rev 3.2.1, and using the exact same code listing (if the posted code is exactly the same as being used by us both)...

why dont i have the issue reported? can this be specific to build hardware tools? i.e. PC CPU and winOS.

shanpuru
Posts: 39
Joined: 20 Nov 2009 18:42

#23 Post by shanpuru » 21 Jan 2010 16:34

Hi Mince,

The output from the HEX code is not displaying correct values.

This display is the same as which I get when I run the HEX file generated from my system with the IRP Message as a warning.

I have send the full project file to your email id. Please check when you get time.

Thank you for the effort.

Shankar

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#24 Post by Mince-n-Tatties » 21 Jan 2010 18:09

eek i just found why i dont get the warning! if you look at my screen dump, you will see that i have warning box unticked... lol that would do it!

i found this after doing as aleksandar advised, looked at the RAM usage locations where i could see which variables have been placed out of reach, this lead me to look as to why i was not getting the warning. tick the box tada!!!!

at least now i will know when its solved.

Acetronics
Posts: 715
Joined: 27 Dec 2006 14:33
Location: Le Tréport , FRANCE

#25 Post by Acetronics » 21 Jan 2010 18:46

Hi, Shanpuru

Also see this thread : http://www.mikroe.com/forum/viewtopic.p ... highlight=

Same issue ...

Alain

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#26 Post by Mince-n-Tatties » 21 Jan 2010 18:52

you have a long road ahead if you are going to define the locations with absolute, there are a lot of variables out of range in this code.

i would make 100% you dont have any variables defined as type greater than is required, so that no RAM location are lost to nothing.

I would also store all LCD data in ROM as i should previously.

shanpuru
Posts: 39
Joined: 20 Nov 2009 18:42

#27 Post by shanpuru » 21 Jan 2010 19:01

Hi Alexander,

Since accessing Bank 3 or 4 seems unevitable, please for understanding purpose could you please explain how to use indirect addressing for accessing a particular element of an array.

Thank You
Shankar

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#28 Post by Mince-n-Tatties » 21 Jan 2010 21:34

this shows what impact you could get from storing the LCD data in ROM as i said previously.

i took this "main menu" from your code just to demo how much RAM you could be saving with a new approach to the code.

36 bytes of total RAM usage with the standard method compared to only 9 bytes used by the method i offer here. Also note i make use of the string "Timers" to produce by Time & Timers, just another step to cut down on ROM usage too.

code is written for easypic 5 so you will have to change the LCD pin connections

Code: Select all

// LCD module connections for EASYPIC 5 board
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;

unsigned short i = 0;    // loop index to read msg1 array
unsigned short Col = 1;  // loop index for column position


const unsigned char Menu[] = "Menu";
const unsigned char Timers[] = "Timers";
const unsigned char Date[] = "Date";
const unsigned char Exit[] = "Exit";



void main() {

    INTCON.GIE =0;    // Global interrupts OFF
    CCP1CON   = 0;
    CCP2CON   = 0;
    ADCON0    = 0;    // ADC off
    ADCON1    = 0x7;  // All I/O Ports set to digital

    Lcd_Init();               // Initialize LCD
    Lcd_Cmd(_LCD_CLEAR);      // Clear display
    Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off

/* //This is very RAM hungry, with this method total RAM usage is 36 bytes

    Lcd_Out( 1, 1, "Menu");
    Lcd_Out( 1, 6, "Time");
    Lcd_Out( 2, 6, "Date");
    Lcd_Out( 3, 6, "Timers");
    Lcd_Out( 4, 6, "Exit");
*/


    // this is very friendly to our RAM, with this method total RAM usage is 9 bytes
    for (i = 0; i != sizeof(Menu)-1; i++)Lcd_Chr(1,Col++,Menu[i]);
    Col=6;
    for (i = 0; i != sizeof(Menu)-1; i++)Lcd_Chr(1,Col++,Timers[i]); // using Menu as i only want "Time" from "Timers"
    Col =6;
    for (i = 0; i != sizeof(Date)-1; i++)Lcd_Chr(2,Col++,Date[i]);
    Col=6;
    for (i = 0; i != sizeof(Timers)-1; i++)Lcd_Chr(3,Col++,Timers[i]);
    Col=6;
    for (i = 0; i != sizeof(Exit)-1; i++)Lcd_Chr(4,Col++,Exit[i]);



}//main
work smarter not harder :wink:

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#29 Post by Mince-n-Tatties » 21 Jan 2010 21:48

same result but sugar free :wink:

Image

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#30 Post by Mince-n-Tatties » 21 Jan 2010 22:29

i have done more than enough to enable the compiler to place your variables within easy reach, no irp warning.

you could easily come up with a user defined function to implement the write to LCD from ROM to reduce code size, if you wanted.

FREE RAM > USED RAM

Code: Select all

//###############################################
// LCD module connections
sbit LCD_RS at RB2_bit;
sbit LCD_EN at RB3_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;

sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
// End LCD module connections

// Keypad Port and lines
#define KEYPAD_PORT PORTD // Select keypad port
#define KEYPAD_MENU F0 // Menu/Exit
#define KEYPAD_CURSOR F1 // Select/Cursor
#define KEYPAD_OK F2 // Ok
#define KEYPAD_INC F3 // Inc number
#define KEYPAD_DEC F4 // Dec number
#define KEYPAD_RESET F7 // Reset

unsigned short i = 0;    // loop index to read msg1 array
unsigned short Col = 1;  // loop index for column position

const unsigned char Men[] = "Menu";
const unsigned char Timers[] = "Timers";
const unsigned char Date[] = "Date";
const unsigned char Exit[] = "Exit";
const unsigned char Save[] = "Save";
const unsigned char SetDate[] = "Set Date";
const unsigned char SetTime[] = "Set Time";

unsigned char first;
unsigned char bSec, bMin, bStd, bDay, bMon, bYear, oldstate;
unsigned int uSec, uMin, uStd, uDay, uMon, uYear;
unsigned int cSec, cMin, cStd, cDay, cMon, cYear, timer_no;

unsigned int on[16], off[16];
unsigned char output[16];

extern void menu();
extern void Show_Menu(unsigned char Show_Menu);
extern void Show_Cursor( unsigned char Sign, unsigned char Show_Menu);
extern void IncDecSign( unsigned Sign, unsigned direct, unsigned Show_Menu);

extern void populate_output (unsigned int num);

extern unsigned short read_ds1307(unsigned char address);
extern void write_ds1307(unsigned char Addr, unsigned char Data);
extern void StoreToRTC(unsigned char t_or_d);
extern void display_time(void);

void Show_Menu(unsigned char Show_Menu)
{
Lcd_Cmd(_LCD_CLEAR);
if (Show_Menu == 0) // Main Menu
{
//Lcd_Out( 1, 1, "Menu");
//Lcd_Out( 1, 6, "Time");
//Lcd_Out( 2, 6, "Date");
//Lcd_Out( 3, 6, "Timers");
//Lcd_Out( 4, 6, "Exit");

    // this is very friendly to our RAM, with this method total RAM usage is 9 bytes
    Col = 1;
    for (i = 0; i != sizeof(Men)-1; i++)Lcd_Chr(1,Col++,Men[i]);
    Col=6;
    for (i = 0; i != sizeof(Men)-1; i++)Lcd_Chr(1,Col++,Timers[i]); // using Men as i only want "Time" from "Timers"
    Col =6;
    for (i = 0; i != sizeof(Date)-1; i++)Lcd_Chr(2,Col++,Date[i]);
    Col=6;
    for (i = 0; i != sizeof(Timers)-1; i++)Lcd_Chr(3,Col++,Timers[i]);
    Col=6;
    for (i = 0; i != sizeof(Exit)-1; i++)Lcd_Chr(4,Col++,Exit[i]);
    Col = 1;

}
else if ((Show_Menu == 1) || (Show_Menu == 2)) // Change Time & Date Menu
{
if (Show_Menu == 1) // Change Time
{
//Lcd_Out( 1, 1, "Set Time");
Col = 1;
for (i = 0; i != sizeof(SetTime)-1; i++)Lcd_Chr(1,Col++,SetTime[i]);
Col = 1;
populate_output(uStd);
Lcd_out (1, 13, output);
Lcd_out (1, 15, ":");
populate_output(uMin);
Lcd_out (1, 16, output);
Lcd_out (1, 18, ":");
populate_output(uSec);
Lcd_out (1, 19, output);
}
else if (Show_Menu == 2) // Change Date
{
//Lcd_Out( 1, 1, "Set Date");
Col = 1;
for (i = 0; i != sizeof(SetDate)-1; i++)Lcd_Chr(1,Col++,SetDate[i]);
Col = 1;
populate_output(uDay);
Lcd_out (1, 13, output);
Lcd_out (1, 15, "/");
populate_output(uMon);
Lcd_out (1, 16, output);
Lcd_out (1, 18, "/");
populate_output(uYear);
Lcd_out (1, 19, output);
}
//Lcd_Out( 3, 6, "Save");
//Lcd_Out( 4, 6, "Exit");
    Col=6;
    for (i = 0; i != sizeof(Save)-1; i++)Lcd_Chr(3,Col++,Save[i]);
    Col=6;
    for (i = 0; i != sizeof(Exit)-1; i++)Lcd_Chr(4,Col++,Exit[i]);
}
else if (Show_Menu == 3) // Change Timers
{
//Lcd_Out( 1, 2, "Set");
Col = 2;
for (i = 0; i != sizeof(SetTime)-5; i++)Lcd_Chr(1,Col++,SetTime[i]);
Col = 1;

//Lcd_Out( 2, 1, "Timer");

Col=1;
for (i = 0; i != sizeof(Timers)-2; i++)Lcd_Chr(2,Col++,Timers[i]);
Col=1;

populate_output(timer_no);
Lcd_Out( 2, 7, output);
Lcd_Out( 2, 11, "On");
populate_output(on[timer_no-1]);
Lcd_Out( 2, 14, output);
Lcd_Out( 2, 16, ":");
populate_output(on[timer_no]);
Lcd_Out( 2, 17, output);
Lcd_Out( 3, 10,"OFF 00:00");
}
}
void menu( void)
{
unsigned char Sig;
unsigned char Which_Menu;
Sig=0;
Which_Menu=0;

// intialize comparators - added shan
cStd=0;cMin=0;cSec=0;
cDay=0;cMon=0;cYear=0;

Show_Menu( Which_Menu);
Show_Cursor( Sig, Which_Menu);
// Delay_ms( 250);

do
{

// Move Cursor
if( KEYPAD_PORT.KEYPAD_CURSOR == 0) {
delay_ms( 100);
Sig++;
if (Which_Menu == 0)
{
if( Sig > 3)
Sig = 0;
}
if ( (Which_Menu == 1) || (Which_Menu == 2) )
{
if( Sig > 4)
Sig = 0;
}
Show_Cursor( Sig, Which_Menu);
};

// Menu Option Selected - OK Key Pressed
if( KEYPAD_PORT.KEYPAD_OK == 0)
{
delay_ms( 100);
if ( (Which_Menu == 0) && (Sig == 3) )
break;
else if ( (Which_Menu == 0) && (Sig == 0) ) // call time menu
{
Which_menu = 1;
Sig = 0;
Show_Menu(Which_Menu);
Show_Cursor( Sig, Which_Menu);
}
else if ( (Which_Menu == 0) && (Sig == 1) ) // call Date menu
{
Which_Menu = 2;
Sig = 0;
Show_Menu(Which_Menu);
Show_Cursor( Sig, Which_Menu);
}
else if ( (Which_Menu == 0) && (Sig == 2) ) // call Timer menu
{
Which_Menu = 3;
Sig = 0;
Show_Menu(Which_Menu);
Show_Cursor( Sig, Which_Menu);
}
else if ( ((Which_Menu == 1) || (Which_Menu == 2)) && (Sig == 4) )
{
// Exit to Main Menu
Which_Menu = 0;
Sig = 0;
Show_Menu(Which_Menu);
Show_Cursor( Sig, Which_Menu);
}
else if ( ((Which_Menu == 1) || (Which_Menu == 2)) && (Sig == 3) )
{
// Save Time to RTC
StoreToRTC(Which_Menu);
Show_Menu(Which_Menu);
Show_Cursor( Sig, Which_Menu);
}
};

// Increment
if( KEYPAD_PORT.KEYPAD_INC == 0) {
delay_ms( 100);
IncDecSign( Sig, 0, Which_Menu);
Show_Cursor( Sig, Which_Menu);
};

// Decrement
if( KEYPAD_PORT.KEYPAD_DEC == 0) {
delay_ms( 100);
IncDecSign( Sig, 1, Which_Menu);
Show_Cursor( Sig, Which_Menu);
};

Delay_ms( 100);
} while( 1);

// Refresh Display
Lcd_Cmd (_LCD_CLEAR);
Lcd_Cmd (_LCD_CURSOR_OFF);

}

void Show_Cursor( unsigned char Sign, unsigned char Show_Menu)
{
unsigned int k;
if (Show_Menu == 0)
{
switch( Sign)
{
case 0:
Lcd_Cmd(_LCD_FIRST_ROW);
for (k=1;k<6;k++)
Lcd_Cmd(_LCD_MOVE_CURSOR_RIGHT);
Lcd_Cmd(_LCD_BLINK_CURSOR_ON);
break;
case 1:
Lcd_Cmd(_LCD_SECOND_ROW);
for (k=1;k<6;k++)
Lcd_Cmd(_LCD_MOVE_CURSOR_RIGHT);
Lcd_Cmd(_LCD_BLINK_CURSOR_ON);
break;
case 2:
Lcd_Cmd(_LCD_THIRD_ROW);
for (k=1;k<6;k++)
Lcd_Cmd(_LCD_MOVE_CURSOR_RIGHT);
Lcd_Cmd(_LCD_BLINK_CURSOR_ON);
break;
case 3:
Lcd_Cmd(_LCD_FOURTH_ROW);
for (k=1;k<6;k++)
Lcd_Cmd(_LCD_MOVE_CURSOR_RIGHT);
Lcd_Cmd(_LCD_BLINK_CURSOR_ON);
break;
};
}
else if ((Show_Menu == 1) || (Show_Menu == 2))
{
switch( Sign)
{
case 0:
if (Show_Menu == 1)
{
uStd=(unsigned)bStd;
populate_output(uStd);
}
else if (Show_Menu == 2)
{
uDay=(unsigned)bDay;
populate_output(uDay);
}
Lcd_out (1, 13, output);
Lcd_Cmd(_LCD_FIRST_ROW);
for (k=1;k<14;k++)
Lcd_Cmd(_LCD_MOVE_CURSOR_RIGHT);
Lcd_Cmd(_LCD_BLINK_CURSOR_ON);
break;
case 1:
if (Show_Menu == 1)
{
uMin = (unsigned)bMin;
populate_output(uMin);
}
else if (Show_Menu == 2)
{
uMon=(unsigned)bMon;
populate_output(uMon);
}
Lcd_out (1, 16, output);
Lcd_Cmd(_LCD_FIRST_ROW);
for (k=1;k<17;k++)
Lcd_Cmd(_LCD_MOVE_CURSOR_RIGHT);
Lcd_Cmd(_LCD_BLINK_CURSOR_ON);
break;
case 2:
if (Show_Menu == 1)
{
uSec=(unsigned)bSec;
populate_output(uSec);
}
else if (Show_Menu == 2)
{
uYear=(unsigned)bYear;
populate_output(uYear);
}
Lcd_out (1, 19, output);
Lcd_Cmd(_LCD_FIRST_ROW);
for (k=1;k<20;k++)
Lcd_Cmd(_LCD_MOVE_CURSOR_RIGHT);
Lcd_Cmd(_LCD_BLINK_CURSOR_ON);
break;
case 3:
Lcd_Cmd(_LCD_THIRD_ROW);
for (k=1;k<6;k++)
Lcd_Cmd(_LCD_MOVE_CURSOR_RIGHT);
Lcd_Cmd(_LCD_BLINK_CURSOR_ON);
break;
case 4:
Lcd_Cmd(_LCD_FOURTH_ROW);
for (k=1;k<6;k++)
Lcd_Cmd(_LCD_MOVE_CURSOR_RIGHT);
Lcd_Cmd(_LCD_BLINK_CURSOR_ON);
break;
};
}
else if (Show_Menu == 3) // Timer Menu
{
switch( Sign)
{
case 0:
populate_output(timer_no);
Lcd_Out( 2, 7, output);
Lcd_Cmd(_LCD_SECOND_ROW);
for (k=1;k<8;k++)
Lcd_Cmd(_LCD_MOVE_CURSOR_RIGHT);
Lcd_Cmd(_LCD_BLINK_CURSOR_ON);
break;
};
}
}

void IncDecSign( unsigned Sign, unsigned direct, unsigned Show_Menu)
{
if (Show_Menu == 1) // Time Menu
{
switch( Sign)
{
case 0: if( !direct)
{
bStd++;
if( bStd > 23)
bStd = 23;
} else {
if( bStd > 0)
bStd--;
};
uStd = (unsigned int)bStd;
break;

case 1: if( !direct)
{
bMin++;
if( bMin > 59)
bMin = 59;
} else {
if( bMin > 0)
bMin--;
};
uMin = (unsigned int)bMin;
break;

case 2: if( !direct)
{
bSec++;
if( bSec > 59)
bSec = 59;
} else {
if( bSec > 0)
bSec--;
};
uSec = (unsigned int)bSec;
break;
}
}
else if (Show_Menu == 2) // Date Menu
{
switch( Sign)
{
case 0: if( !direct)
{
bDay++;
if( bDay > 31)
bDay = 31;
} else {
if( bDay > 0)
bDay--;
};
uDay = (unsigned int)bDay;
break;

case 1: if( !direct)
{
bMon++;
if( bMon > 12)
bMon = 12;
} else {
if( bMon > 0)
bMon--;
};
uMon = (unsigned int)bMon;
break;

case 2: if( !direct)
{
bYear++;
if( bYear > 99)
bYear = 99;
} else {
if( bYear > 0)
bYear--;
};
uYear = (unsigned int)bYear;
break;
};
}
else if (Show_Menu == 3) // Timer Menu
{
switch( Sign)
{
case 0: if( !direct)
{
timer_no++;
if( timer_no > 8)
timer_no = 8;
} else {
if( timer_no > 1)
timer_no--;
};
break;
}
}
}

void populate_output (unsigned int num)
{
output [0] = num/10 + 48;
output [1] = num%10 + 48;
return;
}

void main( void)
{
TRISD = 0b10011111;
PORTB = 0x00;
TRISC = 0x00;
PORTC = 0b00;
TRISD = 0xFF;
PORTD = 0xFF;
TRISE = 0x00;
PORTE = 0x00;
ADCON1 = 7; // disable analog inputs

TRISC.F3 = 1;
TRISC.F4 = 1;

first = 'Y';
timer_no=1;
on[0]=10; on[1]=30;

Delay_ms (2000);

I2C1_Init (100000); //DS1307 I2C is running at 100KHz

Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF); // Turn off cursor
Lcd_Out( 1, 1, " Initalizing Timer ");
Delay_ms( 1000);
Lcd_Cmd (_LCD_CLEAR);

do
{
Delay_ms (100);
display_time();

// Menu key pressed?
////////////////////
if( KEYPAD_PORT.KEYPAD_MENU == 0) {
delay_ms( 250);
menu();
} else if( KEYPAD_PORT.KEYPAD_RESET == 0) {
delay_ms( 250);
};
} while(1);
}

unsigned short read_ds1307(unsigned char address)
{
unsigned char Data;
I2C1_Start();
I2C1_Wr(0xd0); //address 0x68 followed by direction bit (0 for write, 1 for read) 0x68 followed by 0 --> 0xD0
I2C1_Wr(address);
I2C1_Repeated_Start();
I2C1_Wr(0xd1); //0x68 followed by 1 --> 0xD1
Data=I2C1_Rd(0);
I2C1_Stop();
return(Data);
}

void write_ds1307(unsigned char Addr, unsigned char Data)
{
I2C1_Start(); // Issue I2C start signal
I2C1_Wr(0xd0); // Send hardware address for writting
I2C1_Wr(Addr); // Send low byte of the data address
I2C1_Wr(Data); // Send the data
I2C1_Stop(); // Free the bus
return;
}

void StoreToRTC(unsigned char t_or_d)
{
if (t_or_d == 1)
{
bSec = (((bSec / 10) << 4) & 0xF0) + ((bSec-(bSec / 10) * 10) & 0b00001111);
write_ds1307( 0x00, bSec);
bMin = (((bMin / 10) << 4) & 0xF0) + ((bMin-(bMin / 10) * 10) & 0b00001111);
write_ds1307( 0x01, bMin);
bStd = (((bStd / 10) << 4) & 0xF0) + ((bStd-(bStd / 10) * 10) & 0b00001111);
write_ds1307( 0x02, bStd);
}
else if (t_or_d == 2)
{
bDay = (((bDay / 10) << 4) & 0x30) + ((bDay-(bDay / 10) * 10) & 0b00001111);
write_ds1307( 0x04, bDay);
bMon = (((bMon / 10) << 4) & 0x10) + ((bMon-(bMon / 10) * 10) & 0b00001111);
write_ds1307( 0x05, bMon);
bYear = (((bYear / 10) << 4) & 0xF0) + ((bYear-(bYear / 10) * 10) & 0b00001111);
write_ds1307( 0x06, bYear);
}
delay_ms( 2000);
return;
}

void display_time(void)
{
bSec=read_ds1307(0x00); // read second
bSec = ((bSec & 0xF0) >> 4)*10 + (bSec & 0b00001111);
uSec = (unsigned int)bSec;
bMin=read_ds1307(0x01); // read minute
bMin = ((bMin & 0xF0) >> 4)*10 + (bMin & 0b00001111);
uMin = (unsigned int)bMin;
bStd=read_ds1307(0x02); // read hour
bStd = ((bStd & 0x30) >> 4)*10 + (bStd & 0b00001111);
uStd = (unsigned int)bStd;
bDay=read_ds1307(0x04); // read date
bDay = ((bDay & 0x30) >> 4)*10 + (bDay & 0b00001111);
uDay = (unsigned int)bDay;
bMon=read_ds1307(0x05); // read month
bMon = ((bMon & 0x10) >> 4)*10 + (bMon & 0b00001111);
uMon = (unsigned int)bMon;
bYear=read_ds1307(0x06); // read year
bYear = ((bYear & 0xF0)>> 4)*10 + (bYear & 0b00001111);
uYear = (unsigned int)bYear;

if ( (uStd != cStd) || (first == 'Y') )
{
cStd = uStd;
populate_output(uStd);
Lcd_out (1, 13, output);
Lcd_out (1, 15, ":");
}

if ( (uMin != cMin) || (first == 'Y') )
{
cMin = uMin;
populate_output(uMin);
Lcd_out (1, 16, output);
Lcd_out (1, 18, ":");
}

if ( (uSec != cSec) || (first == 'Y') )
{
cSec = uSec;
populate_output(uSec);
Lcd_out (1, 19, output);
}

if ( (uDay != cDay) || (first == 'Y') )
{
cDay = uDay;
populate_output(uDay);
Lcd_out (2, 13, output);
Lcd_out (2, 15, "/");
}

if ( (uMon != cMon) || (first == 'Y') )
{
cMon = uMon;
populate_output(uMon);
Lcd_out (2, 16, output);
Lcd_out (2, 18, "/");
}

if ( (uYear != cYear) || (first == 'Y') )
{
cYear = uYear;
populate_output(uYear);
Lcd_out (2, 19, output);
}

first = 'N';
return;
}

Post Reply

Return to “mikroC PRO for PIC General”