-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathosc.asm
3610 lines (3487 loc) · 158 KB
/
osc.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
GAS LISTING /tmp/ccNcTpZI.s page 1
1 .file "Osciloscope.ino.cpp"
2 __SP_H__ = 0x3e
3 __SP_L__ = 0x3d
4 __SREG__ = 0x3f
5 __RAMPZ__ = 0x3b
6 __tmp_reg__ = 0
7 __zero_reg__ = 1
8 .text
9 .Ltext0:
10 .cfi_sections .debug_frame
11 .section .text.adcMeasure,"ax",@progbits
12 .global adcMeasure
13 .type adcMeasure, @function
14 adcMeasure:
15 .LFB110:
16 .file 1 "/home/arhat109/Arduino/Osciloscope/Osciloscope.ino"
1:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
2:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** extern "C" {
3:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
4:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** typedef enum {REF_AREF=0, REF_AVCC=64, REF_1V=128, REF_256V=192} ADCREF;
5:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** typedef enum {TRIG_ROUND=0, TRIG_COMPARATOR, TRIG_INT0, TRIG_T0A, TRIG_T0OVF, TRIG_T1B, TRIG_T1OVF,
6:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** typedef enum {
7:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** MUX_0=0, MUX_1, MUX_2, MUX_3, MUX_4, MUX_5, MUX_6, MUX_7,
8:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** MUX_G10_00, MUX_G10_10, MUX_G200_00, MUX_G200_10,
9:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** MUX_G10_22, MUX_G10_32, MUX_G200_22, MUX_G200_32,
10:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** MUX_D01, MUX_D11, MUX_D21, MUX_D31, MUX_D41, MUX_D51, MUX_D61, MUX_D71,
11:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** MUX_D02, MUX_D12, MUX_D22, MUX_D32, MUX_D42, MUX_D52,
12:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** MUX_1V, MUX_GND,
13:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** MUX_8, MUX_9, MUX_A, MUX_B, MUX_C, MUX_D, MUX_E, MUX_F,
14:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** MUX_G10_88, MUX_G10_98, MUX_G200_88, MUX_G200_98,
15:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** MUX_G10_AA, MUX_G10_BA, MUX_G200_AA, MUX_G200_BA,
16:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** MUX_D89, MUX_D99, MUX_DA9, MUX_DB9, MUX_DC9, MUX_DD9, MUX_DE9, MUX_DF9,
17:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** MUX_D8A, MUX_D9A, MUX_DAA, MUX_DBA, MUX_DCA, MUX_DDA
18:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** } ADCMUX;
19:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** /*
20:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** #define adcStart() (ADCSRA |= (1<<ADSC))
21:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** #define adc8bit() (ADMUX |= (1<<ADLAR))
22:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** #define adc10bit() (ADMUX &= ~(1<<ADLAR))
23:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** #define adcIntOn() (ADCSRA |= (1<<ADIE))
24:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** #define adcIntOff() (ADCSRA &= ~(1<<ADIE))
25:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** #define adc2comp() (ADCSRB |= (1<<ACME))
26:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** */
27:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // ADMUX: REFS1(7), REFS0(6), ADLAR(5), MUX4..0
28:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // ADCSRA: ADEN(7), ADSC(6), ADATE(5), ADIF(4), ADIE(3), ADPS0..2
29:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // ADCSRB: ACME(6), ADMUX5(3),ADTS0..2
30:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // DIDR0: Closed PINx for noise redusing ADC7..0
31:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // DIDR2: Closed PINx for noise reducing ADC15..8
32:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // PRR0: bit0=1 ADC power off!
33:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
34:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** typedef struct{
35:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** uint8_t mux; // prepared before the ADMUX for channel
36:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** uint8_t pinPos; // to future..
37:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** uint8_t pinNeg; // to future..
38:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** } AdcChannel;
39:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
40:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** #define ADC_SAMPLE_LENGTH 256
41:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** #define ADC_MAX_CHANNELS 1
GAS LISTING /tmp/ccNcTpZI.s page 2
42:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** #define ADC_MAX_SAMPLES 4
43:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** #define ADC_MAX_BUFFER ADC_SAMPLE_LENGTH * ADC_MAX_CHANNELS * ADC_MAX_SAMPLES
44:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
45:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** volatile uint8_t adcBuffer[ADC_MAX_BUFFER]; /** ADC results buffer for all samples and
46:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** volatile uint8_t adcMaxSamples =ADC_MAX_SAMPLES; /** Current repeated samples for each chann
47:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** volatile uint16_t adcSampleLength=ADC_SAMPLE_LENGTH;/** Current one channel sample length <= AD
48:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
49:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** volatile AdcChannel adcChannels[ADC_MAX_CHANNELS]; /** All channels data */
50:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** volatile uint8_t adcMaxChannels = ADC_MAX_CHANNELS;/** Current channels in work [0..ADC_MAX_CH
51:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
52:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** volatile uint8_t adcLevel=32; /** Current sinhrolevel for start in ADC ui
53:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** volatile uint8_t adcSign=0; /** Current edge sinhro level to pos[0] or
54:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** volatile uint8_t adcShift=0; /** Current max strobe shift for last sampl
55:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
56:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** #define adcWaitInt() {while((ADCSRA&(1<<ADIF))==0); ADCSRA &= ~(1<<ADIF);}
57:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** #define adcRead1(p) { adcWaitInt(); (p)=ADCH; }
58:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** #define delayMicro16(__count) \
59:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** __asm__ __volatile__ ( \
60:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** "1: sbiw %0,1 \n\t" \
61:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** "brne 1b\n\t" \
62:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** :: "w" (__count) \
63:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** )
64:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
65:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** /**
66:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** * Fill measures buffer for all channels with presetted channel data, sinhro-level, etc.
67:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** * Before: ADC must be set into free running mode!
68:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** * USAGE:
69:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** * r16,17,30,31 -- ptr for adcChannels
70:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** * r28,29 -- ptr for adcBuffer
71:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** * r26 -- adcMaxSamples
72:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** * r24,25 -- adcSampleLength
73:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** * r23 -- adcMaxChannels
74:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** * r22 -- adcShift
75:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** * r21 -- adcLevel
76:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** * r20 -- adcSign
77:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** * r19,r18 -- local temporary usage
78:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** * All registers and SREG are push/pop into procedure!!!
79:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** */
80:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** void adcMeasure()
81:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** {
17 .loc 1 81 0
18 .cfi_startproc
19 /* prologue: function */
20 /* frame size = 0 */
21 /* stack size = 0 */
22 .L__stack_usage = 0
82:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** asm volatile(
83:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r16 \n\t"
84:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r17 \n\t"
85:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r18 \n\t"
86:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r19 \n\t"
87:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r20 \n\t"
88:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r21 \n\t"
89:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r22 \n\t"
90:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r23 \n\t"
91:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r24 \n\t"
92:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r25 \n\t"
GAS LISTING /tmp/ccNcTpZI.s page 3
93:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r26 \n\t"
94:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r27 \n\t"
95:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r28 \n\t"
96:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r29 \n\t"
97:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r30 \n\t"
98:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r31 \n\t"
99:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " in r31,__SREG__ \n\t"
100:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " push r31 \n\t"
101:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r16,adcChannels ; ptrCh=adcChannels; \n\t"
102:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r17,adcChannels+1 ; \n\t"
103:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " mov r30,r16 ; current doublicate! \n\t"
104:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " mov r31,r17 ; \n\t"
105:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r28,adcBuffer ; buf=adcBuffer; \n\t"
106:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r29,adcBuffer+1 ; \n\t"
107:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r26,adcMaxSamples ; samples=adcMaxSamples; \n\t"
108:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r23,adcMaxChannels ; numCh = adcMaxChannels; \n\t"
109:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r22,adcShift ; shift=adcShift; \n\t"
110:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r21,adcLevel ; level=adcLevel; \n\t"
111:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r20,adcSign ; sign=adcSign; \n\t"
112:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** "SAMPLES: ; do{ \n\t"
113:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r24,adcSampleLength ; 19.measure=adcSampleLength; \n\t"
114:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r25,adcSampleLength ; . \n\t"
115:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // 0. Prepare ADMUX for channel[0]:
116:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " ld r18,Z ; .ADMUX = ptrCh->mux; \n\t"
117:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " sts 0x007c,r18 ; . \n\t"
118:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // 1. search sinhrolevel:
119:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " clr r19 ; .isOk = false \n\t"
120:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // 1.1. wait ADIF and read ADC data:
121:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** "WAIT_L: ; ..while(ADCSRA&(1<<ADIF)==0); \n\t"
122:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r18,122 ; 0... \n\t"
123:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " sbrs r18,4 ; 2... \n\t"
124:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " rjmp WAIT_L ; ... \n\t"
125:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " andi r18,lo8(-17) ; 4..ADCSRA &= ~(1<<ADIF); \n\t"
126:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " sts 122,r18 ; 5.. \n\t"
127:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r18,121 ; 7.._t = ADCH; \n\t"
128:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // 1.2. control sinhro-level:
129:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " cp r18,r21 ; 9..SREG = ADCH ? level; \n\t"
130:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " sbrs r20,0 ; 10..if( sign == 1)skip POS; \n\t"
131:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " rjmp POS ; 11 \n\t"
132:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " brlo ISOK ; 12..go if (NEG & LT) \n\t"
133:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** "FOUNDED: ; \n\t"
134:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " ldi r19,1 ; ..NEG,POS are founded! \n\t"
135:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " rjmp WAIT_L ; ..continue; \n\t"
136:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** "POS: ; \n\t"
137:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " brsh ISOK ; ..go if (POS & GE) \n\t"
138:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " rjmp FOUNDED ; \n\t"
139:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** "ISOK: ; \n\t"
140:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " sbrs r19,0 ; 14(15)..level is ok - start! \n\t"
141:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " rjmp WAIT_L ; ..not founded - continue \n\t"
142:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // 2. Make shift for next sample if need:
143:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r18,0x007a ; 16(17)...stop ADC! \n\t"
144:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " andi r18,lo8(223) ; 18...ADCSRA &= ~(1<<ADATE) \n\t"
145:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " sts 0x007a,r18 ; 19... \n\t"
146:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " cpi r22,0 ; 21.if( _shift == 0 ) \n\t"
147:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " breq START_ADC ; 22.skip shift delay \n\t"
148:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " mov r18,r22 ; 23._t=shift; \n\t"
149:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** "SHIFT: ; \n\t"
GAS LISTING /tmp/ccNcTpZI.s page 4
150:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " dec r18 ; 24/27.._t-- \n\t"
151:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " brne SHIFT ; 25/28.delay _t*250us \n\t"
152:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " dec r22 ; 26/29.shift--; \n\t"
153:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** "START_ADC: ; \n\t"
154:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r18,0x007a ; 24/27/30...start ADC! \n\t"
155:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " ori r18,lo8(32) ; 26/...ADCSRA |= (1<<ADATE) \n\t"
156:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " sts 0x007a,r18 ; 27/... \n\t"
157:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // 3. start all measures for 1 sample:
158:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** "MEASURE: ; .do{//measures \n\t"
159:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " mov r19,r23 ; 29(+3)..numCh = adcMaxChannels; \n\t"
160:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** "CHANNEL: ; ..do{//channels \n\t"
161:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // 3.1 prepare next admux before read!
162:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " dec r19 ; 31...if( --_numChannel > 0 ) \n\t"
163:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " breq LAST_CH ; 32...goto else \n\t"
164:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " adiw r30,3 ; 33....ptrCh++; (sizeof()=3!) \n\t"
165:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " rjmp SET_NEXT ; 34.... \n\t"
166:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** "LAST_CH: ; ...else \n\t"
167:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " mov r30,r16 ; 34....ptrCh=adcChannels; \n\t"
168:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " mov r31,r17 ; 35.... \n\t"
169:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** "SET_NEXT: ; \n\t"
170:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " ld r18,Z ; 36...ADMUX= ptrCh->mux; \n\t"
171:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " sts 0x007c,r18 ; 37... \n\t"
172:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // 2.2 wait and get ADC result:
173:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** "WAIT_D: ; ...while(ADCSRA&(1<<ADIF)==0); \n\t"
174:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r18,122 ; 0... \n\t"
175:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " sbrs r18,4 ; 2... \n\t"
176:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " rjmp WAIT_D ; ... \n\t"
177:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " andi r18,lo8(-17) ; 4..ADCSRA &= ~(1<<ADIF); \n\t"
178:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " sts 122,r18 ; 5.. \n\t"
179:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " lds r18,121 ; 7.._t = ADCH; \n\t"
180:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " st Y+,r18 ; 9... \n\t"
181:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " tst r19 ; 11..}while( numCh > 0 ); \n\t"
182:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " brne CHANNEL ; 12.. \n\t"
183:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " sbiw r24,1 ; 13.}while(--_measures > 0 ); \n\t"
184:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " brne MEASURE ; 15. \n\t"
185:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " dec r26 ; 16}while( --_samples>0 ); \n\t"
186:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " brne SAMPLES ; 17 \n\t"
187:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r31 \n\t"
188:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " out __SREG__,r31 \n\t"
189:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r31 \n\t"
190:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r30 \n\t"
191:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r29 \n\t"
192:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r28 \n\t"
193:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r27 \n\t"
194:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r26 \n\t"
195:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r25 \n\t"
196:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r24 \n\t"
197:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r23 \n\t"
198:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r22 \n\t"
199:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r21 \n\t"
200:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r20 \n\t"
201:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r19 \n\t"
202:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r18 \n\t"
203:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r17 \n\t"
204:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** " pop r16 \n\t"
205:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** ::);
23 .loc 1 205 0
GAS LISTING /tmp/ccNcTpZI.s page 5
24 /* #APP */
25 ; 205 "/home/arhat109/Arduino/Osciloscope/Osciloscope.ino" 1
26 0000 0F93 push r16
27 0002 1F93 push r17
28 0004 2F93 push r18
29 0006 3F93 push r19
30 0008 4F93 push r20
31 000a 5F93 push r21
32 000c 6F93 push r22
33 000e 7F93 push r23
34 0010 8F93 push r24
35 0012 9F93 push r25
36 0014 AF93 push r26
37 0016 BF93 push r27
38 0018 CF93 push r28
39 001a DF93 push r29
40 001c EF93 push r30
41 001e FF93 push r31
42 0020 FFB7 in r31,__SREG__
43 0022 FF93 push r31
44 0024 0091 0000 lds r16,adcChannels ; ptrCh=adcChannels;
45 0028 1091 0000 lds r17,adcChannels+1 ;
46 002c E02F mov r30,r16 ; current doublicate!
47 002e F12F mov r31,r17 ;
48 0030 C091 0000 lds r28,adcBuffer ; buf=adcBuffer;
49 0034 D091 0000 lds r29,adcBuffer+1 ;
50 0038 A091 0000 lds r26,adcMaxSamples ; samples=adcMaxSamples;
51 003c 7091 0000 lds r23,adcMaxChannels ; numCh = adcMaxChannels;
52 0040 6091 0000 lds r22,adcShift ; shift=adcShift;
53 0044 5091 0000 lds r21,adcLevel ; level=adcLevel;
54 0048 4091 0000 lds r20,adcSign ; sign=adcSign;
55 SAMPLES: ; do{
56 004c 8091 0000 lds r24,adcSampleLength ; 19.measure=adcSampleLength;
57 0050 9091 0000 lds r25,adcSampleLength ; .
58 0054 2081 ld r18,Z ; .ADMUX = ptrCh->mux;
59 0056 2093 7C00 sts 0x007c,r18 ; .
60 005a 3327 clr r19 ; .isOk = false
61 WAIT_L: ; ..while(ADCSRA&(1<<ADIF)==0);
62 005c 2091 7A00 lds r18,122 ; 0...
63 0060 24FF sbrs r18,4 ; 2...
64 0062 00C0 rjmp WAIT_L ; ...
65 0064 2F7E andi r18,lo8(-17) ; 4..ADCSRA &= ~(1<<ADIF);
66 0066 2093 7A00 sts 122,r18 ; 5..
67 006a 2091 7900 lds r18,121 ; 7.._t = ADCH;
68 006e 2517 cp r18,r21 ; 9..SREG = ADCH ? level;
69 0070 40FF sbrs r20,0 ; 10..if( sign == 1)skip POS;
70 0072 00C0 rjmp POS ; 11
71 0074 00F0 brlo ISOK ; 12..go if (NEG & LT)
72 FOUNDED: ;
73 0076 31E0 ldi r19,1 ; ..NEG,POS are founded!
74 0078 00C0 rjmp WAIT_L ; ..continue;
75 POS: ;
76 007a 00F4 brsh ISOK ; ..go if (POS & GE)
77 007c 00C0 rjmp FOUNDED ;
78 ISOK: ;
79 007e 30FF sbrs r19,0 ; 14(15)..level is ok - start!
80 0080 00C0 rjmp WAIT_L ; ..not founded - continue
GAS LISTING /tmp/ccNcTpZI.s page 6
81 0082 2091 7A00 lds r18,0x007a ; 16(17)...stop ADC!
82 0086 2F7D andi r18,lo8(223) ; 18...ADCSRA &= ~(1<<ADATE)
83 0088 2093 7A00 sts 0x007a,r18 ; 19...
84 008c 6030 cpi r22,0 ; 21.if( _shift == 0 )
85 008e 01F0 breq START_ADC ; 22.skip shift delay
86 0090 262F mov r18,r22 ; 23._t=shift;
87 SHIFT: ;
88 0092 2A95 dec r18 ; 24/27.._t--
89 0094 01F4 brne SHIFT ; 25/28.delay _t*250us
90 0096 6A95 dec r22 ; 26/29.shift--;
91 START_ADC: ;
92 0098 2091 7A00 lds r18,0x007a ; 24/27/30...start ADC!
93 009c 2062 ori r18,lo8(32) ; 26/...ADCSRA |= (1<<ADATE)
94 009e 2093 7A00 sts 0x007a,r18 ; 27/...
95 MEASURE: ; .do{//measures
96 00a2 372F mov r19,r23 ; 29(+3)..numCh = adcMaxChannels;
97 CHANNEL: ; ..do{//channels
98 00a4 3A95 dec r19 ; 31...if( --_numChannel > 0 )
99 00a6 01F0 breq LAST_CH ; 32...goto else
100 00a8 3396 adiw r30,3 ; 33....ptrCh++; (sizeof()=3!)
101 00aa 00C0 rjmp SET_NEXT ; 34....
102 LAST_CH: ; ...else
103 00ac E02F mov r30,r16 ; 34....ptrCh=adcChannels;
104 00ae F12F mov r31,r17 ; 35....
105 SET_NEXT: ;
106 00b0 2081 ld r18,Z ; 36...ADMUX= ptrCh->mux;
107 00b2 2093 7C00 sts 0x007c,r18 ; 37...
108 WAIT_D: ; ...while(ADCSRA&(1<<ADIF)==0);
109 00b6 2091 7A00 lds r18,122 ; 0...
110 00ba 24FF sbrs r18,4 ; 2...
111 00bc 00C0 rjmp WAIT_D ; ...
112 00be 2F7E andi r18,lo8(-17) ; 4..ADCSRA &= ~(1<<ADIF);
113 00c0 2093 7A00 sts 122,r18 ; 5..
114 00c4 2091 7900 lds r18,121 ; 7.._t = ADCH;
115 00c8 2993 st Y+,r18 ; 9...
116 00ca 3323 tst r19 ; 11..}while( numCh > 0 );
117 00cc 01F4 brne CHANNEL ; 12..
118 00ce 0197 sbiw r24,1 ; 13.}while(--_measures > 0 );
119 00d0 01F4 brne MEASURE ; 15.
120 00d2 AA95 dec r26 ; 16}while( --_samples>0 );
121 00d4 01F4 brne SAMPLES ; 17
122 00d6 FF91 pop r31
123 00d8 FFBF out __SREG__,r31
124 00da FF91 pop r31
125 00dc EF91 pop r30
126 00de DF91 pop r29
127 00e0 CF91 pop r28
128 00e2 BF91 pop r27
129 00e4 AF91 pop r26
130 00e6 9F91 pop r25
131 00e8 8F91 pop r24
132 00ea 7F91 pop r23
133 00ec 6F91 pop r22
134 00ee 5F91 pop r21
135 00f0 4F91 pop r20
136 00f2 3F91 pop r19
137 00f4 2F91 pop r18
GAS LISTING /tmp/ccNcTpZI.s page 7
138 00f6 1F91 pop r17
139 00f8 0F91 pop r16
140
141 ; 0 "" 2
142 /* #NOAPP */
143 00fa 0895 ret
144 .cfi_endproc
145 .LFE110:
146 .size adcMeasure, .-adcMeasure
147 .section .text.setup,"ax",@progbits
148 .global setup
149 .type setup, @function
150 setup:
151 .LFB111:
206:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** /*
207:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** AdcChannel * _ptrChannel = (AdcChannel *)adcChannels;
208:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** uint8_t * _buf = (uint8_t *)adcBuffer;
209:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** uint16_t _measures = adcSampleLength;
210:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** uint8_t _samples = adcMaxSamples;
211:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** uint8_t _level = adcLevel;
212:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** uint8_t _sign = adcSign;
213:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** uint8_t _shift = adcShift;
214:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
215:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** uint8_t _adc, _isSign, _numChannel;
216:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
217:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** do{
218:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** uint8_t _measures = adcSampleLength;
219:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
220:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // 0. Prepare ADMUX for channel[0]:
221:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** ADMUX = _ptrChannel->mux;
222:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
223:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // 1. search sinhrolevel:
224:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** _isSign = 0;
225:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** do{
226:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** _LEVEL:
227:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcRead1(_adc);
228:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** switch(_sign){
229:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** case 0: //to positive //
230:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** if( _adc < _level ){ _isSign = 1; goto _LEVEL; }
231:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** break;
232:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** case 1: // to negative //
233:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** if( _adc > _level ){ _isSign = 1; goto _LEVEL; }
234:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** break;
235:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** }
236:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** }while(_isSign == 0);
237:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
238:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // 2. Make shift for next sample if need:
239:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** if( _shift > 0 ){ delayMicro16( (int)_shift); }
240:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
241:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // 3. start measure for 1 sample:
242:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** do{
243:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** _numChannel = adcMaxChannels;
244:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** do{
245:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // 2.1 prepare next measure before read!
246:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** if( --_numChannel > 0 ){ _ptrChannel++; }
247:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** else { _ptrChannel = (AdcChannel *)adcChannels; }
248:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** ADMUX = _ptrChannel->mux;
GAS LISTING /tmp/ccNcTpZI.s page 8
249:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // 2.2 wait and get ADC result:
250:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcRead1(_adc);
251:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** *_buf++ = _adc;
252:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** }while( _numChannel > 0 );
253:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** }while(--_measures > 0 );
254:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** }while( --_samples>0 );
255:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** */
256:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** }
257:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
258:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** #define MAX_RESULT (ADC_SAMPLE_LENGTH * ADC_MAX_CHANNELS)
259:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** uint8_t resBuffer[MAX_RESULT];
260:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
261:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** }
262:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
263:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** void setup() {
152 .loc 1 263 0
153 .cfi_startproc
154 /* prologue: function */
155 /* frame size = 0 */
156 /* stack size = 0 */
157 .L__stack_usage = 0
158 .LBB8:
264:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** uint8_t _adc;
265:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** unsigned long time;
266:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
267:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** asm volatile ("nop \n\t"::);
159 .loc 1 267 0
160 /* #APP */
161 ; 267 "/home/arhat109/Arduino/Osciloscope/Osciloscope.ino" 1
162 0000 0000 nop
163
164 ; 0 "" 2
165 .LVL0:
166 /* #NOAPP */
167 .LBB9:
168 .LBB10:
169 .file 2 "/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h"
1:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** /*
2:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** HardwareSerial.h - Hardware serial library for Wiring
3:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** Copyright (c) 2006 Nicholas Zambetti. All right reserved.
4:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h ****
5:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** This library is free software; you can redistribute it and/or
6:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** modify it under the terms of the GNU Lesser General Public
7:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** License as published by the Free Software Foundation; either
8:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** version 2.1 of the License, or (at your option) any later version.
9:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h ****
10:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** This library is distributed in the hope that it will be useful,
11:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** but WITHOUT ANY WARRANTY; without even the implied warranty of
12:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** Lesser General Public License for more details.
14:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h ****
15:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** You should have received a copy of the GNU Lesser General Public
16:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** License along with this library; if not, write to the Free Software
17:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h ****
19:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** Modified 28 September 2010 by Mark Sproul
20:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** Modified 14 August 2012 by Alarus
GAS LISTING /tmp/ccNcTpZI.s page 9
21:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** Modified 3 December 2013 by Matthijs Kooijman
22:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** */
23:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h ****
24:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #ifndef HardwareSerial_h
25:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define HardwareSerial_h
26:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h ****
27:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #include <inttypes.h>
28:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h ****
29:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #include "Stream.h"
30:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h ****
31:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // Define constants and variables for buffering incoming serial data. We're
32:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // using a ring buffer (I think), in which head is the index of the location
33:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // to which to write the next incoming character and tail is the index of the
34:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // location from which to read.
35:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // NOTE: a "power of 2" buffer size is reccomended to dramatically
36:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // optimize all the modulo operations for ring buffers.
37:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // WARNING: When buffer sizes are increased to > 256, the buffer index
38:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // variables are automatically increased in size, but the extra
39:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // atomicity guards needed for that are not implemented. This will
40:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // often work, but occasionally a race condition can occur that makes
41:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // Serial behave erratically. See https://github.com/arduino/Arduino/issues/2405
42:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #if !defined(SERIAL_TX_BUFFER_SIZE)
43:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #if ((RAMEND - RAMSTART) < 1023)
44:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_TX_BUFFER_SIZE 16
45:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #else
46:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_TX_BUFFER_SIZE 64
47:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #endif
48:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #endif
49:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #if !defined(SERIAL_RX_BUFFER_SIZE)
50:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #if ((RAMEND - RAMSTART) < 1023)
51:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_RX_BUFFER_SIZE 16
52:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #else
53:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_RX_BUFFER_SIZE 64
54:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #endif
55:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #endif
56:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #if (SERIAL_TX_BUFFER_SIZE>256)
57:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** typedef uint16_t tx_buffer_index_t;
58:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #else
59:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** typedef uint8_t tx_buffer_index_t;
60:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #endif
61:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #if (SERIAL_RX_BUFFER_SIZE>256)
62:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** typedef uint16_t rx_buffer_index_t;
63:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #else
64:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** typedef uint8_t rx_buffer_index_t;
65:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #endif
66:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h ****
67:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // Define config for Serial.begin(baud, config);
68:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_5N1 0x00
69:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_6N1 0x02
70:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_7N1 0x04
71:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_8N1 0x06
72:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_5N2 0x08
73:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_6N2 0x0A
74:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_7N2 0x0C
75:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_8N2 0x0E
76:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_5E1 0x20
77:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_6E1 0x22
GAS LISTING /tmp/ccNcTpZI.s page 10
78:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_7E1 0x24
79:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_8E1 0x26
80:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_5E2 0x28
81:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_6E2 0x2A
82:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_7E2 0x2C
83:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_8E2 0x2E
84:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_5O1 0x30
85:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_6O1 0x32
86:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_7O1 0x34
87:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_8O1 0x36
88:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_5O2 0x38
89:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_6O2 0x3A
90:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_7O2 0x3C
91:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** #define SERIAL_8O2 0x3E
92:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h ****
93:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** class HardwareSerial : public Stream
94:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** {
95:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** protected:
96:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** volatile uint8_t * const _ubrrh;
97:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** volatile uint8_t * const _ubrrl;
98:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** volatile uint8_t * const _ucsra;
99:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** volatile uint8_t * const _ucsrb;
100:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** volatile uint8_t * const _ucsrc;
101:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** volatile uint8_t * const _udr;
102:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // Has any byte been written to the UART since begin()
103:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** bool _written;
104:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h ****
105:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** volatile rx_buffer_index_t _rx_buffer_head;
106:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** volatile rx_buffer_index_t _rx_buffer_tail;
107:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** volatile tx_buffer_index_t _tx_buffer_head;
108:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** volatile tx_buffer_index_t _tx_buffer_tail;
109:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h ****
110:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // Don't put any members after these buffers, since only the first
111:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // 32 bytes of this struct can be accessed quickly using the ldd
112:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** // instruction.
113:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** unsigned char _rx_buffer[SERIAL_RX_BUFFER_SIZE];
114:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** unsigned char _tx_buffer[SERIAL_TX_BUFFER_SIZE];
115:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h ****
116:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** public:
117:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** inline HardwareSerial(
118:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
119:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
120:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** volatile uint8_t *ucsrc, volatile uint8_t *udr);
121:/home/arhat109/progs/arduino-1.8.2/hardware/arduino/avr/cores/arduino/HardwareSerial.h **** void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }
170 .loc 2 121 0
171 0002 26E0 ldi r18,lo8(6)
172 0004 40E0 ldi r20,0
173 0006 52EC ldi r21,lo8(-62)
174 0008 61E0 ldi r22,lo8(1)
175 000a 70E0 ldi r23,0
176 000c 80E0 ldi r24,lo8(Serial)
177 000e 90E0 ldi r25,hi8(Serial)
178 0010 0E94 0000 call _ZN14HardwareSerial5beginEmh
179 .LVL1:
180 .LBE10:
181 .LBE9:
268:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** Serial.begin(115200);
GAS LISTING /tmp/ccNcTpZI.s page 11
269:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** while (!Serial);
270:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
271:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** TCCR1A = 128+32+8+1; // A,B,C normal + 01 - WGM1,WGM0 "1mode:PhaseCorrectPWM255"
182 .loc 1 271 0
183 0014 89EA ldi r24,lo8(-87)
184 0016 8093 8000 sts 128,r24
272:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** TCCR1B = 0+2; // WGM3,WGM2=01-"5mode:FastPWM255", Prescaler:1=16Mhz, 2=2Mhz
185 .loc 1 272 0
186 001a 82E0 ldi r24,lo8(2)
187 001c 8093 8100 sts 129,r24
273:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** OCR1A = 192;
188 .loc 1 273 0
189 0020 80EC ldi r24,lo8(-64)
190 0022 90E0 ldi r25,0
191 0024 9093 8900 sts 136+1,r25
192 0028 8093 8800 sts 136,r24
274:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** OCR1B = 128;
193 .loc 1 274 0
194 002c 80E8 ldi r24,lo8(-128)
195 002e 90E0 ldi r25,0
196 0030 9093 8B00 sts 138+1,r25
197 0034 8093 8A00 sts 138,r24
275:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** OCR1C = 64;
198 .loc 1 275 0
199 0038 80E4 ldi r24,lo8(64)
200 003a 90E0 ldi r25,0
201 003c 9093 8D00 sts 140+1,r25
202 0040 8093 8C00 sts 140,r24
276:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** DDRB = _BV(5)|_BV(6)|_BV(7); // T1 A,B,C for ATmega128a,ATmega2560
203 .loc 1 276 0
204 0044 80EE ldi r24,lo8(-32)
205 0046 84B9 out 0x4,r24
277:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
278:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // Serial.print("ADIF="); Serial.println(ADCSRA&(1<<ADIF), DEC);
279:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** ADMUX = 64|32; // src=+5v + ADLAR<-left
206 .loc 1 279 0
207 0048 80E6 ldi r24,lo8(96)
208 004a 8093 7C00 sts 124,r24
280:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** DIDR0 = 1;
209 .loc 1 280 0
210 004e 81E0 ldi r24,lo8(1)
211 0050 8093 7E00 sts 126,r24
281:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** ADCSRB = TRIG_ROUND;
212 .loc 1 281 0
213 0054 1092 7B00 sts 123,__zero_reg__
282:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** ADCSRA = (1<<ADEN) | (1<<ADSC) | (1<<ADATE) | 1; // 1:2 = 8Mhz
214 .loc 1 282 0
215 0058 81EE ldi r24,lo8(-31)
216 005a 8093 7A00 sts 122,r24
217 .L3:
283:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // ADCSRA = (1<<ADEN) | (1<<ADSC) | (1<<ADFR) | 1; // 1:2 = 8Mhz
284:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
285:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcRead1(adcBuffer[0]);
218 .loc 1 285 0 discriminator 1
219 005e 8091 7A00 lds r24,122
220 0062 84FF sbrs r24,4
221 0064 00C0 rjmp .L3
GAS LISTING /tmp/ccNcTpZI.s page 12
222 .loc 1 285 0 is_stmt 0 discriminator 2
223 0066 8091 7A00 lds r24,122
224 006a 8F7E andi r24,lo8(-17)
225 006c 8093 7A00 sts 122,r24
226 0070 8091 7900 lds r24,121
227 0074 8093 0000 sts adcBuffer,r24
286:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** /* adcRead1(adcBuffer[1]);
287:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcRead1(adcBuffer[2]);
288:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcRead1(adcBuffer[3]);
289:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcRead1(adcBuffer[4]);
290:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcRead1(adcBuffer[5]);
291:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcRead1(adcBuffer[6]);
292:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcRead1(adcBuffer[7]);
293:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcRead1(adcBuffer[8]);
294:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcRead1(adcBuffer[9]);
295:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
296:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** time = micros()-time;
297:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** Serial.print("time="); Serial.println(time, DEC);
298:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** Serial.print("ADIF="); Serial.println(ADCSRA&(1<<ADIF), DEC);
299:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** for(uint8_t i=0; i<10; i++){ Serial.println(adcBuffer[i], DEC);}
300:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** */
301:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcMaxChannels = 2;
228 .loc 1 301 0 is_stmt 1 discriminator 2
229 0078 82E0 ldi r24,lo8(2)
230 007a 8093 0000 sts adcMaxChannels,r24
302:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcMaxSamples = 1;
231 .loc 1 302 0 discriminator 2
232 007e 81E0 ldi r24,lo8(1)
233 0080 8093 0000 sts adcMaxSamples,r24
303:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcLevel = 64;
234 .loc 1 303 0 discriminator 2
235 0084 80E4 ldi r24,lo8(64)
236 0086 8093 0000 sts adcLevel,r24
304:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcChannels[0].mux = 64|32|0; // +5v, ADCH, pin A0
237 .loc 1 304 0 discriminator 2
238 008a 80E6 ldi r24,lo8(96)
239 008c 8093 0000 sts adcChannels,r24
305:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcChannels[0].mux = 64|32|2; // +5v, ADCH, pin A0
240 .loc 1 305 0 discriminator 2
241 0090 82E6 ldi r24,lo8(98)
242 0092 8093 0000 sts adcChannels,r24
243 0096 0895 ret
244 .LBE8:
245 .cfi_endproc
246 .LFE111:
247 .size setup, .-setup
248 .section .rodata.str1.1,"aMS",@progbits,1
249 .LC0:
250 0000 7469 6D65 .string "time="
250 3D00
251 .section .text.loop,"ax",@progbits
252 .global loop
253 .type loop, @function
254 loop:
255 .LFB112:
306:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
307:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // Serial.println("ASCII Table ~ Character Map");
GAS LISTING /tmp/ccNcTpZI.s page 13
308:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** }
309:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
310:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** void loop() {
256 .loc 1 310 0
257 .cfi_startproc
258 0000 8F92 push r8
259 .LCFI0:
260 .cfi_def_cfa_offset 4
261 .cfi_offset 8, -3
262 0002 9F92 push r9
263 .LCFI1:
264 .cfi_def_cfa_offset 5
265 .cfi_offset 9, -4
266 0004 AF92 push r10
267 .LCFI2:
268 .cfi_def_cfa_offset 6
269 .cfi_offset 10, -5
270 0006 BF92 push r11
271 .LCFI3:
272 .cfi_def_cfa_offset 7
273 .cfi_offset 11, -6
274 0008 CF92 push r12
275 .LCFI4:
276 .cfi_def_cfa_offset 8
277 .cfi_offset 12, -7
278 000a DF92 push r13
279 .LCFI5:
280 .cfi_def_cfa_offset 9
281 .cfi_offset 13, -8
282 000c EF92 push r14
283 .LCFI6:
284 .cfi_def_cfa_offset 10
285 .cfi_offset 14, -9
286 000e FF92 push r15
287 .LCFI7:
288 .cfi_def_cfa_offset 11
289 .cfi_offset 15, -10
290 0010 0F93 push r16
291 .LCFI8:
292 .cfi_def_cfa_offset 12
293 .cfi_offset 16, -11
294 0012 1F93 push r17
295 .LCFI9:
296 .cfi_def_cfa_offset 13
297 .cfi_offset 17, -12
298 0014 CF93 push r28
299 .LCFI10:
300 .cfi_def_cfa_offset 14
301 .cfi_offset 28, -13
302 0016 DF93 push r29
303 .LCFI11:
304 .cfi_def_cfa_offset 15
305 .cfi_offset 29, -14
306 /* prologue: function */
307 /* frame size = 0 */
308 /* stack size = 12 */
309 .L__stack_usage = 12
GAS LISTING /tmp/ccNcTpZI.s page 14
310 .LBB11:
311:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** int i,j;
312:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** unsigned long time;
313:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // uint8_t * ptrRes;
314:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** uint8_t * ptrBuf;
315:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino ****
316:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** time = micros();
311 .loc 1 316 0
312 0018 0E94 0000 call micros
313 .LVL2:
314 001c 4B01 movw r8,r22
315 001e 5C01 movw r10,r24
316 .LVL3:
317:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** adcMeasure();
317 .loc 1 317 0
318 0020 0E94 0000 call adcMeasure
319 .LVL4:
318:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** time = micros()-time;
320 .loc 1 318 0
321 0024 0E94 0000 call micros
322 .LVL5:
323 0028 6B01 movw r12,r22
324 002a 7C01 movw r14,r24
325 002c C818 sub r12,r8
326 002e D908 sbc r13,r9
327 0030 EA08 sbc r14,r10
328 0032 FB08 sbc r15,r11
329 .LVL6:
319:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** Serial.print("time="); Serial.println(time, DEC);
330 .loc 1 319 0
331 0034 60E0 ldi r22,lo8(.LC0)
332 0036 70E0 ldi r23,hi8(.LC0)
333 0038 80E0 ldi r24,lo8(Serial)
334 003a 90E0 ldi r25,hi8(Serial)
335 003c 0E94 0000 call _ZN5Print5printEPKc
336 .LVL7:
337 0040 2AE0 ldi r18,lo8(10)
338 0042 30E0 ldi r19,0
339 0044 B701 movw r22,r14
340 0046 A601 movw r20,r12
341 0048 80E0 ldi r24,lo8(Serial)
342 004a 90E0 ldi r25,hi8(Serial)
343 004c 0E94 0000 call _ZN5Print7printlnEmi
344 .LVL8:
345 .LBB12:
320:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** /*
321:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** ptrRes = resBuffer;
322:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** ptrBuf = adcBuffer;
323:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** for(i=0; i<adcSampleLength; i++){
324:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** for(j=0; j<adcMaxChannels; j++){
325:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** *ptrRes++ = *ptrBuf++;
326:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** }
327:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** }
328:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** */
329:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** // Serial.print("Hello!");
330:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** ptrBuf = (uint8_t *)adcBuffer;
331:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** for(int j=0; j<adcMaxSamples; j++){
GAS LISTING /tmp/ccNcTpZI.s page 15
346 .loc 1 331 0
347 0050 00E0 ldi r16,0
348 0052 10E0 ldi r17,0
349 .LVL9:
350 .L8:
351 .loc 1 331 0 is_stmt 0 discriminator 1
352 0054 8091 0000 lds r24,adcMaxSamples
353 0058 90E0 ldi r25,0
354 005a 0817 cp r16,r24
355 005c 1907 cpc r17,r25
356 005e 04F0 brlt .+2
357 0060 00C0 rjmp .L14
358 .LBB13:
332:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** Serial.println(adcLevel, DEC);
359 .loc 1 332 0 is_stmt 1
360 0062 6091 0000 lds r22,adcLevel
361 0066 4AE0 ldi r20,lo8(10)
362 0068 50E0 ldi r21,0
363 006a 80E0 ldi r24,lo8(Serial)
364 006c 90E0 ldi r25,hi8(Serial)
365 006e 0E94 0000 call _ZN5Print7printlnEhi
366 .LVL10:
333:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** Serial.println(adcLevel, DEC);
367 .loc 1 333 0
368 0072 6091 0000 lds r22,adcLevel
369 0076 4AE0 ldi r20,lo8(10)
370 0078 50E0 ldi r21,0
371 007a 80E0 ldi r24,lo8(Serial)
372 007c 90E0 ldi r25,hi8(Serial)
373 007e 0E94 0000 call _ZN5Print7printlnEhi
374 .LVL11:
334:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** Serial.println(adcLevel, DEC);
375 .loc 1 334 0
376 0082 6091 0000 lds r22,adcLevel
377 0086 4AE0 ldi r20,lo8(10)
378 0088 50E0 ldi r21,0
379 008a 80E0 ldi r24,lo8(Serial)
380 008c 90E0 ldi r25,hi8(Serial)
381 008e 0E94 0000 call _ZN5Print7printlnEhi
382 .LVL12:
383 .LBB14:
335:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** for(int k=0; k<adcMaxChannels; k++){
384 .loc 1 335 0
385 0092 E12C mov r14,__zero_reg__
386 0094 F12C mov r15,__zero_reg__
387 .LVL13:
388 .L9:
389 .loc 1 335 0 is_stmt 0 discriminator 1
390 0096 8091 0000 lds r24,adcMaxChannels
391 009a 90E0 ldi r25,0
392 .LBB15:
336:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** Serial.println(adcLevel, DEC);
393 .loc 1 336 0 is_stmt 1 discriminator 1
394 009c 6091 0000 lds r22,adcLevel
395 00a0 4AE0 ldi r20,lo8(10)
396 00a2 50E0 ldi r21,0
397 .LBE15:
GAS LISTING /tmp/ccNcTpZI.s page 16
335:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** for(int k=0; k<adcMaxChannels; k++){
398 .loc 1 335 0 discriminator 1
399 00a4 E816 cp r14,r24
400 00a6 F906 cpc r15,r25
401 00a8 04F0 brlt .+2
402 00aa 00C0 rjmp .L15
403 .LBB17:
404 .loc 1 336 0
405 00ac 80E0 ldi r24,lo8(Serial)
406 00ae 90E0 ldi r25,hi8(Serial)
407 00b0 0E94 0000 call _ZN5Print7printlnEhi
408 .LVL14:
337:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** Serial.println(adcLevel, DEC);
409 .loc 1 337 0
410 00b4 6091 0000 lds r22,adcLevel
411 00b8 4AE0 ldi r20,lo8(10)
412 00ba 50E0 ldi r21,0
413 00bc 80E0 ldi r24,lo8(Serial)
414 00be 90E0 ldi r25,hi8(Serial)
415 00c0 0E94 0000 call _ZN5Print7printlnEhi
416 .LVL15:
338:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** Serial.println(adcLevel, DEC);
417 .loc 1 338 0
418 00c4 6091 0000 lds r22,adcLevel
419 00c8 4AE0 ldi r20,lo8(10)
420 00ca 50E0 ldi r21,0
421 00cc 80E0 ldi r24,lo8(Serial)
422 00ce 90E0 ldi r25,hi8(Serial)
423 00d0 0E94 0000 call _ZN5Print7printlnEhi
424 .LVL16:
339:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** ptrBuf = (uint8_t *)adcBuffer + k + j*adcSampleLength;
425 .loc 1 339 0
426 00d4 8091 0000 lds r24,adcSampleLength
427 00d8 9091 0000 lds r25,adcSampleLength+1
428 00dc 089F mul r16,r24
429 00de E001 movw r28,r0
430 00e0 099F mul r16,r25
431 00e2 D00D add r29,r0
432 00e4 189F mul r17,r24
433 00e6 D00D add r29,r0
434 00e8 1124 clr r1
435 00ea CE0D add r28,r14
436 00ec DF1D adc r29,r15
437 00ee C050 subi r28,lo8(-(adcBuffer))
438 00f0 D040 sbci r29,hi8(-(adcBuffer))
439 .LVL17:
440 .LBB16:
340:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** for(int i=0; i<adcSampleLength; i++){
441 .loc 1 340 0
442 00f2 C12C mov r12,__zero_reg__
443 00f4 D12C mov r13,__zero_reg__
444 .LVL18:
445 .L10:
446 .loc 1 340 0 is_stmt 0 discriminator 1
447 00f6 8091 0000 lds r24,adcSampleLength
448 00fa 9091 0000 lds r25,adcSampleLength+1
449 00fe C816 cp r12,r24
GAS LISTING /tmp/ccNcTpZI.s page 17
450 0100 D906 cpc r13,r25
451 0102 00F4 brsh .L16
341:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** Serial.println( *ptrBuf, DEC);
452 .loc 1 341 0 is_stmt 1 discriminator 3
453 0104 4AE0 ldi r20,lo8(10)
454 0106 50E0 ldi r21,0
455 0108 6881 ld r22,Y
456 010a 80E0 ldi r24,lo8(Serial)
457 010c 90E0 ldi r25,hi8(Serial)
458 010e 0E94 0000 call _ZN5Print7printlnEhi
459 .LVL19:
342:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** ptrBuf += adcMaxChannels;
460 .loc 1 342 0 discriminator 3
461 0112 8091 0000 lds r24,adcMaxChannels
462 0116 C80F add r28,r24
463 0118 D11D adc r29,__zero_reg__
464 .LVL20:
340:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** for(int i=0; i<adcSampleLength; i++){
465 .loc 1 340 0 discriminator 3
466 011a 8FEF ldi r24,-1
467 011c C81A sub r12,r24
468 011e D80A sbc r13,r24
469 .LVL21:
470 0120 00C0 rjmp .L10
471 .L16:
472 .LBE16:
343:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** }
344:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** Serial.println(adcLevel, DEC);
473 .loc 1 344 0 discriminator 2
474 0122 6091 0000 lds r22,adcLevel
475 0126 4AE0 ldi r20,lo8(10)
476 0128 50E0 ldi r21,0
477 012a 80E0 ldi r24,lo8(Serial)
478 012c 90E0 ldi r25,hi8(Serial)
479 012e 0E94 0000 call _ZN5Print7printlnEhi
480 .LVL22:
345:/home/arhat109/Arduino/Osciloscope/Osciloscope.ino **** Serial.println(adcLevel, DEC);