Skip to content

Commit e2235d5

Browse files
committed
Arror fixing
Fixed error which wrong measurement a light level
1 parent 8f13eed commit e2235d5

File tree

8 files changed

+94
-96
lines changed

8 files changed

+94
-96
lines changed

.vs/LightController/v14/.atsuo

512 Bytes
Binary file not shown.
-16 Bytes
Binary file not shown.

LightController/Debug/LightController.hex

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
:1000000009C021C020C01FC01EC01DC04DC01BC0E4
22
:100010001AC01AC011241FBECFE9CDBF10E0A0E660
3-
:10002000B0E0EEEBF3E002C005900D92A236B1070E
3+
:10002000B0E0ECEBF3E002C005900D92A236B10710
44
:10003000D9F720E0A2E6B0E001C01D92AA37B207CE
5-
:10004000E1F741D1BAC1DCCF1F920F920FB60F92E8
5+
:10004000E1F741D1B9C1DCCF1F920F920FB60F92E9
66
:1000500011242F933F938F93EF93FF93809162002E
77
:10006000E82FF0E024B135B1EE0FFF1FEC58FF4F41
88
:10007000318320838F5F823018F48093620002C046
@@ -30,10 +30,10 @@
3030
:1001D00068001092670010926600109265001092FD
3131
:1001E000640010926F0010926E00B09919C0809157
3232
:1001F0006300811115C020917200309173008091CD
33-
:100200007800909179002817390750F0809170009C
33+
:100200007800909179008217930750F080917000E8
3434
:10021000909171000196909371008093700004C0DA
3535
:100220001092710010927000B09917C02091720066
36-
:1002300030917300809178009091790028173907E8
36+
:100230003091730080917800909179008217930734
3737
:1002400060F4B39B0AC080916C0090916D000196A0
3838
:1002500090936D0080936C0004C010926D0010921A
3939
:100260006C0012BE9F918F913F912F910F900FBE06
@@ -45,18 +45,18 @@
4545
:1002C00080937800089518BAD6DFF894C09163003F
4646
:1002D0007894EADFCC23E9F080916E0090916F0072
4747
:1002E000803D9740B0F08091640090916500059743
48-
:1002F00008F461C00EC080916E0090916F00803D47
48+
:1002F00008F460C00EC080916E0090916F00803D48
4949
:10030000974038F08091640090916500059708F45B
50-
:1003100050C02091720030917300809178009091CC
51-
:1003200079002817390758F0B09909C080917000FA
50+
:100310004FC02091720030917300809178009091CD
51+
:1003200079008217930758F0B09909C08091700046
5252
:1003300090917100883B9B4010F0C39AC6CFB09952
5353
:1003400016C02091720030917300809178009091D6
54-
:1003500079002817390758F4B39B09C080916C00C5
54+
:1003500079008217930758F4B39B09C080916C0011
5555
:1003600090916D008938934110F0C398AECFB09949
5656
:100370000FC02091720030917300809178009091AD
57-
:1003800079002817390720F0B39B02C0C39A9DCF8C
58-
:10039000B09B0DC020917200309173008091780065
59-
:1003A000909179002817390710F4C3988ECFC3981D
60-
:0E03B0008CCFC39AA0CFC39A9ECFF894FFCFF4
61-
:0203BE00190024
57+
:1003800079008217930720F0B39B02C0C39A9DCFD8
58+
:10039000B09B9BCF209172003091730080917800C8
59+
:1003A000909179002817390708F08FCFC3988DCF27
60+
:0C03B000C39AA1CFC39A9FCFF894FFCF4F
61+
:0203BC00190026
6262
:00000001FF

LightController/Debug/LightController.lss

+41-44
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ LightController.elf: file format elf32-avr
33

44
Sections:
55
Idx Name Size VMA LMA File off Algn
6-
0 .text 000003be 00000000 00000000 00000094 2**1
6+
0 .text 000003bc 00000000 00000000 00000094 2**1
77
CONTENTS, ALLOC, LOAD, READONLY, CODE
8-
1 .data 00000002 00800060 000003be 00000452 2**0
8+
1 .data 00000002 00800060 000003bc 00000450 2**0
99
CONTENTS, ALLOC, LOAD, DATA
10-
2 .bss 00000018 00800062 00800062 00000454 2**0
10+
2 .bss 00000018 00800062 00800062 00000452 2**0
1111
ALLOC
12-
3 .comment 00000030 00000000 00000000 00000454 2**0
12+
3 .comment 00000030 00000000 00000000 00000452 2**0
1313
CONTENTS, READONLY
1414
4 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00000484 2**2
1515
CONTENTS, READONLY
@@ -19,15 +19,15 @@ Idx Name Size VMA LMA File off Algn
1919
CONTENTS, READONLY, DEBUGGING
2020
7 .debug_abbrev 00000422 00000000 00000000 00000aa9 2**0
2121
CONTENTS, READONLY, DEBUGGING
22-
8 .debug_line 0000047d 00000000 00000000 00000ecb 2**0
22+
8 .debug_line 00000477 00000000 00000000 00000ecb 2**0
2323
CONTENTS, READONLY, DEBUGGING
24-
9 .debug_frame 000000a8 00000000 00000000 00001348 2**2
24+
9 .debug_frame 000000a8 00000000 00000000 00001344 2**2
2525
CONTENTS, READONLY, DEBUGGING
26-
10 .debug_str 000003a6 00000000 00000000 000013f0 2**0
26+
10 .debug_str 0000039a 00000000 00000000 000013ec 2**0
2727
CONTENTS, READONLY, DEBUGGING
28-
11 .debug_loc 000000d3 00000000 00000000 00001796 2**0
28+
11 .debug_loc 000000d3 00000000 00000000 00001786 2**0
2929
CONTENTS, READONLY, DEBUGGING
30-
12 .debug_ranges 00000030 00000000 00000000 00001869 2**0
30+
12 .debug_ranges 00000030 00000000 00000000 00001859 2**0
3131
CONTENTS, READONLY, DEBUGGING
3232

3333
Disassembly of section .text:
@@ -54,7 +54,7 @@ Disassembly of section .text:
5454
1c: 10 e0 ldi r17, 0x00 ; 0
5555
1e: a0 e6 ldi r26, 0x60 ; 96
5656
20: b0 e0 ldi r27, 0x00 ; 0
57-
22: ee eb ldi r30, 0xBE ; 190
57+
22: ec eb ldi r30, 0xBC ; 188
5858
24: f3 e0 ldi r31, 0x03 ; 3
5959
26: 02 c0 rjmp .+4 ; 0x2c <__do_copy_data+0x10>
6060
28: 05 90 lpm r0, Z+
@@ -77,7 +77,7 @@ Disassembly of section .text:
7777
3e: b2 07 cpc r27, r18
7878
40: e1 f7 brne .-8 ; 0x3a <.do_clear_bss_loop>
7979
42: 41 d1 rcall .+642 ; 0x2c6 <main>
80-
44: ba c1 rjmp .+884 ; 0x3ba <_exit>
80+
44: b9 c1 rjmp .+882 ; 0x3b8 <_exit>
8181

8282
00000046 <__bad_interrupt>:
8383
46: dc cf rjmp .-72 ; 0x0 <__vectors>
@@ -331,7 +331,7 @@ ISR (TIM0_COMPA_vect)
331331
}
332332

333333
//Switch on delay and Pir sensor debounce;
334-
if ((!(PIR_STATUS)) && (keyFlag == 0) && (photoSeensor >= sensivity))
334+
if ((!(PIR_STATUS)) && (keyFlag == 0) && (photoSeensor <= sensivity))
335335
1ea: b0 99 sbic 0x16, 0 ; 22
336336
1ec: 19 c0 rjmp .+50 ; 0x220 <__vector_6+0x178>
337337
1ee: 80 91 63 00 lds r24, 0x0063 ; 0x800063 <keyFlag>
@@ -341,8 +341,8 @@ ISR (TIM0_COMPA_vect)
341341
1fa: 30 91 73 00 lds r19, 0x0073 ; 0x800073 <photoSeensor+0x1>
342342
1fe: 80 91 78 00 lds r24, 0x0078 ; 0x800078 <sensivity>
343343
202: 90 91 79 00 lds r25, 0x0079 ; 0x800079 <sensivity+0x1>
344-
206: 28 17 cp r18, r24
345-
208: 39 07 cpc r19, r25
344+
206: 82 17 cp r24, r18
345+
208: 93 07 cpc r25, r19
346346
20a: 50 f0 brcs .+20 ; 0x220 <__vector_6+0x178>
347347
on++;
348348
20c: 80 91 70 00 lds r24, 0x0070 ; 0x800070 <on>
@@ -355,15 +355,15 @@ ISR (TIM0_COMPA_vect)
355355
220: 10 92 71 00 sts 0x0071, r1 ; 0x800071 <on+0x1>
356356
224: 10 92 70 00 sts 0x0070, r1 ; 0x800070 <on>
357357

358-
if ((!(PIR_STATUS)) && (photoSeensor < sensivity) && (BULB_STATUS))
358+
if ((!(PIR_STATUS)) && (photoSeensor > sensivity) && (BULB_STATUS))
359359
228: b0 99 sbic 0x16, 0 ; 22
360360
22a: 17 c0 rjmp .+46 ; 0x25a <__vector_6+0x1b2>
361361
22c: 20 91 72 00 lds r18, 0x0072 ; 0x800072 <photoSeensor>
362362
230: 30 91 73 00 lds r19, 0x0073 ; 0x800073 <photoSeensor+0x1>
363363
234: 80 91 78 00 lds r24, 0x0078 ; 0x800078 <sensivity>
364364
238: 90 91 79 00 lds r25, 0x0079 ; 0x800079 <sensivity+0x1>
365-
23c: 28 17 cp r18, r24
366-
23e: 39 07 cpc r19, r25
365+
23c: 82 17 cp r24, r18
366+
23e: 93 07 cpc r25, r19
367367
240: 60 f4 brcc .+24 ; 0x25a <__vector_6+0x1b2>
368368
242: b3 9b sbis 0x16, 3 ; 22
369369
244: 0a c0 rjmp .+20 ; 0x25a <__vector_6+0x1b2>
@@ -516,7 +516,7 @@ int main(void)
516516
2ea: 90 91 65 00 lds r25, 0x0065 ; 0x800065 <hours+0x1>
517517
2ee: 05 97 sbiw r24, 0x05 ; 5
518518
2f0: 08 f4 brcc .+2 ; 0x2f4 <main+0x2e>
519-
2f2: 61 c0 rjmp .+194 ; 0x3b6 <main+0xf0>
519+
2f2: 60 c0 rjmp .+192 ; 0x3b4 <main+0xee>
520520
2f4: 0e c0 rjmp .+28 ; 0x312 <main+0x4c>
521521
2f6: 80 91 6e 00 lds r24, 0x006E ; 0x80006e <timeCounter>
522522
2fa: 90 91 6f 00 lds r25, 0x006F ; 0x80006f <timeCounter+0x1>
@@ -527,19 +527,19 @@ int main(void)
527527
308: 90 91 65 00 lds r25, 0x0065 ; 0x800065 <hours+0x1>
528528
30c: 05 97 sbiw r24, 0x05 ; 5
529529
30e: 08 f4 brcc .+2 ; 0x312 <main+0x4c>
530-
310: 50 c0 rjmp .+160 ; 0x3b2 <main+0xec>
530+
310: 4f c0 rjmp .+158 ; 0x3b0 <main+0xea>
531531
{
532532
BULB_ON;
533533
}
534534

535535
//PIR=0,Switch=1;
536-
if ((photoSeensor >= sensivity) && (!(PIR_STATUS)) && (on >= PIRDELAY))
536+
if ((photoSeensor <= sensivity) && (!(PIR_STATUS)) && (on >= PIRDELAY))
537537
312: 20 91 72 00 lds r18, 0x0072 ; 0x800072 <photoSeensor>
538538
316: 30 91 73 00 lds r19, 0x0073 ; 0x800073 <photoSeensor+0x1>
539539
31a: 80 91 78 00 lds r24, 0x0078 ; 0x800078 <sensivity>
540540
31e: 90 91 79 00 lds r25, 0x0079 ; 0x800079 <sensivity+0x1>
541-
322: 28 17 cp r18, r24
542-
324: 39 07 cpc r19, r25
541+
322: 82 17 cp r24, r18
542+
324: 93 07 cpc r25, r19
543543
326: 58 f0 brcs .+22 ; 0x33e <main+0x78>
544544
328: b0 99 sbic 0x16, 0 ; 22
545545
32a: 09 c0 rjmp .+18 ; 0x33e <main+0x78>
@@ -554,15 +554,15 @@ int main(void)
554554
33a: c3 9a sbi 0x18, 3 ; 24
555555
33c: c6 cf rjmp .-116 ; 0x2ca <main+0x4>
556556

557-
else if ((!(PIR_STATUS)) && (photoSeensor < sensivity) && (BULB_STATUS) && (timeCounterDown > PHOTOOFFSET))
557+
else if ((!(PIR_STATUS)) && (photoSeensor > sensivity) && (BULB_STATUS) && (timeCounterDown > PHOTOOFFSET))
558558
33e: b0 99 sbic 0x16, 0 ; 22
559559
340: 16 c0 rjmp .+44 ; 0x36e <main+0xa8>
560560
342: 20 91 72 00 lds r18, 0x0072 ; 0x800072 <photoSeensor>
561561
346: 30 91 73 00 lds r19, 0x0073 ; 0x800073 <photoSeensor+0x1>
562562
34a: 80 91 78 00 lds r24, 0x0078 ; 0x800078 <sensivity>
563563
34e: 90 91 79 00 lds r25, 0x0079 ; 0x800079 <sensivity+0x1>
564-
352: 28 17 cp r18, r24
565-
354: 39 07 cpc r19, r25
564+
352: 82 17 cp r24, r18
565+
354: 93 07 cpc r25, r19
566566
356: 58 f4 brcc .+22 ; 0x36e <main+0xa8>
567567
358: b3 9b sbis 0x16, 3 ; 22
568568
35a: 09 c0 rjmp .+18 ; 0x36e <main+0xa8>
@@ -576,15 +576,15 @@ int main(void)
576576
36a: c3 98 cbi 0x18, 3 ; 24
577577
36c: ae cf rjmp .-164 ; 0x2ca <main+0x4>
578578

579-
else if ((!(PIR_STATUS)) && (!switchOn || switchOn) && (photoSeensor>=sensivity) && (BULB_STATUS))
579+
else if ((!(PIR_STATUS)) && (!switchOn || switchOn) && (photoSeensor<=sensivity) && (BULB_STATUS))
580580
36e: b0 99 sbic 0x16, 0 ; 22
581581
370: 0f c0 rjmp .+30 ; 0x390 <main+0xca>
582582
372: 20 91 72 00 lds r18, 0x0072 ; 0x800072 <photoSeensor>
583583
376: 30 91 73 00 lds r19, 0x0073 ; 0x800073 <photoSeensor+0x1>
584584
37a: 80 91 78 00 lds r24, 0x0078 ; 0x800078 <sensivity>
585585
37e: 90 91 79 00 lds r25, 0x0079 ; 0x800079 <sensivity+0x1>
586-
382: 28 17 cp r18, r24
587-
384: 39 07 cpc r19, r25
586+
382: 82 17 cp r24, r18
587+
384: 93 07 cpc r25, r19
588588
386: 20 f0 brcs .+8 ; 0x390 <main+0xca>
589589
388: b3 9b sbis 0x16, 3 ; 22
590590
38a: 02 c0 rjmp .+4 ; 0x390 <main+0xca>
@@ -595,35 +595,32 @@ int main(void)
595595

596596
else if (PIR_STATUS && (photoSeensor < sensivity))
597597
390: b0 9b sbis 0x16, 0 ; 22
598-
392: 0d c0 rjmp .+26 ; 0x3ae <main+0xe8>
598+
392: 9b cf rjmp .-202 ; 0x2ca <main+0x4>
599599
394: 20 91 72 00 lds r18, 0x0072 ; 0x800072 <photoSeensor>
600600
398: 30 91 73 00 lds r19, 0x0073 ; 0x800073 <photoSeensor+0x1>
601601
39c: 80 91 78 00 lds r24, 0x0078 ; 0x800078 <sensivity>
602602
3a0: 90 91 79 00 lds r25, 0x0079 ; 0x800079 <sensivity+0x1>
603603
3a4: 28 17 cp r18, r24
604604
3a6: 39 07 cpc r19, r25
605-
3a8: 10 f4 brcc .+4 ; 0x3ae <main+0xe8>
605+
3a8: 08 f0 brcs .+2 ; 0x3ac <main+0xe6>
606+
3aa: 8f cf rjmp .-226 ; 0x2ca <main+0x4>
606607

607608
BULB_OFF;
608-
3aa: c3 98 cbi 0x18, 3 ; 24
609-
3ac: 8e cf rjmp .-228 ; 0x2ca <main+0x4>
610-
611-
else BULB_OFF;
612-
3ae: c3 98 cbi 0x18, 3 ; 24
613-
3b0: 8c cf rjmp .-232 ; 0x2ca <main+0x4>
609+
3ac: c3 98 cbi 0x18, 3 ; 24
610+
3ae: 8d cf rjmp .-230 ; 0x2ca <main+0x4>
614611
// ADC read function(10bit);
615612
AdcInputsRead();
616613
//AC switch priority;
617614
while (switchOn && (timeCounter >= DEBOUNCE) && (hours < AC_SWITCHOFF_DELAY))
618615
{
619616
BULB_ON;
620-
3b2: c3 9a sbi 0x18, 3 ; 24
621-
3b4: a0 cf rjmp .-192 ; 0x2f6 <main+0x30>
622-
3b6: c3 9a sbi 0x18, 3 ; 24
623-
3b8: 9e cf rjmp .-196 ; 0x2f6 <main+0x30>
617+
3b0: c3 9a sbi 0x18, 3 ; 24
618+
3b2: a1 cf rjmp .-190 ; 0x2f6 <main+0x30>
619+
3b4: c3 9a sbi 0x18, 3 ; 24
620+
3b6: 9f cf rjmp .-194 ; 0x2f6 <main+0x30>
624621

625-
000003ba <_exit>:
626-
3ba: f8 94 cli
622+
000003b8 <_exit>:
623+
3b8: f8 94 cli
627624

628-
000003bc <__stop_program>:
629-
3bc: ff cf rjmp .-2 ; 0x3bc <__stop_program>
625+
000003ba <__stop_program>:
626+
3ba: ff cf rjmp .-2 ; 0x3ba <__stop_program>

LightController/Debug/LightController.map

+16-16
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ END GROUP
193193
.rela.plt
194194
*(.rela.plt)
195195

196-
.text 0x00000000 0x3be
196+
.text 0x00000000 0x3bc
197197
*(.vectors)
198198
.vectors 0x00000000 0x14 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.1.102/gcc/dev/attiny13a/avr25/tiny-stack/crtattiny13a.o
199199
0x00000000 __vector_default
@@ -273,13 +273,13 @@ END GROUP
273273
.text.AdcInputsRead
274274
0x000002a8 0x1e main.o
275275
0x000002a8 AdcInputsRead
276-
.text.main 0x000002c6 0xf4 main.o
276+
.text.main 0x000002c6 0xf2 main.o
277277
0x000002c6 main
278-
0x000003ba . = ALIGN (0x2)
278+
0x000003b8 . = ALIGN (0x2)
279279
*(.fini9)
280-
.fini9 0x000003ba 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o)
281-
0x000003ba _exit
282-
0x000003ba exit
280+
.fini9 0x000003b8 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o)
281+
0x000003b8 _exit
282+
0x000003b8 exit
283283
*(.fini9)
284284
*(.fini8)
285285
*(.fini8)
@@ -298,11 +298,11 @@ END GROUP
298298
*(.fini1)
299299
*(.fini1)
300300
*(.fini0)
301-
.fini0 0x000003ba 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o)
301+
.fini0 0x000003b8 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o)
302302
*(.fini0)
303-
0x000003be _etext = .
303+
0x000003bc _etext = .
304304

305-
.data 0x00800060 0x2 load address 0x000003be
305+
.data 0x00800060 0x2 load address 0x000003bc
306306
0x00800060 PROVIDE (__data_start, .)
307307
*(.data)
308308
*(.data*)
@@ -347,8 +347,8 @@ END GROUP
347347
0x00800074 adcScanningData
348348
0x00800078 sensivity
349349
0x0080007a PROVIDE (__bss_end, .)
350-
0x000003be __data_load_start = LOADADDR (.data)
351-
0x000003c0 __data_load_end = (__data_load_start + SIZEOF (.data))
350+
0x000003bc __data_load_start = LOADADDR (.data)
351+
0x000003be __data_load_end = (__data_load_start + SIZEOF (.data))
352352

353353
.noinit 0x0080007a 0x0
354354
[!provide] PROVIDE (__noinit_start, .)
@@ -437,20 +437,20 @@ END GROUP
437437
.debug_abbrev 0x00000000 0x2b6 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.1.102/gcc/dev/attiny13a/avr25/tiny-stack/crtattiny13a.o
438438
.debug_abbrev 0x000002b6 0x16c main.o
439439

440-
.debug_line 0x00000000 0x47d
440+
.debug_line 0x00000000 0x477
441441
*(.debug_line .debug_line.* .debug_line_end)
442442
.debug_line 0x00000000 0xca C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.1.102/gcc/dev/attiny13a/avr25/tiny-stack/crtattiny13a.o
443-
.debug_line 0x000000ca 0x3b3 main.o
443+
.debug_line 0x000000ca 0x3ad main.o
444444

445445
.debug_frame 0x00000000 0xa8
446446
*(.debug_frame)
447447
.debug_frame 0x00000000 0xa8 main.o
448448

449-
.debug_str 0x00000000 0x3a6
449+
.debug_str 0x00000000 0x39a
450450
*(.debug_str)
451451
.debug_str 0x00000000 0x100 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.1.102/gcc/dev/attiny13a/avr25/tiny-stack/crtattiny13a.o
452-
.debug_str 0x00000100 0x2a6 main.o
453-
0x2da (size before relaxing)
452+
.debug_str 0x00000100 0x29a main.o
453+
0x2ce (size before relaxing)
454454

455455
.debug_loc 0x00000000 0xd3
456456
*(.debug_loc)

0 commit comments

Comments
 (0)