-
Notifications
You must be signed in to change notification settings - Fork 0
/
period.asm
1002 lines (997 loc) · 29 KB
/
period.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
;--------------------------------------------------------
; File Created by C51
; Version 1.0.0 #1069 (Apr 23 2015) (MSVC)
; This file was generated Wed Feb 28 16:14:18 2018
;--------------------------------------------------------
$name period
$optc51 --model-small
$printf_float
R_DSEG segment data
R_CSEG segment code
R_BSEG segment bit
R_XSEG segment xdata
R_PSEG segment xdata
R_ISEG segment idata
R_OSEG segment data overlay
BIT_BANK segment data overlay
R_HOME segment code
R_GSINIT segment code
R_IXSEG segment xdata
R_CONST segment code
R_XINIT segment code
R_DINIT segment code
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
public _main
public _TIMER0_Init
public _waitms
public _Timer3us
public __c51_external_startup
public _overflow_count
;--------------------------------------------------------
; Special Function Registers
;--------------------------------------------------------
_ACC DATA 0xe0
_ADC0ASAH DATA 0xb6
_ADC0ASAL DATA 0xb5
_ADC0ASCF DATA 0xa1
_ADC0ASCT DATA 0xc7
_ADC0CF0 DATA 0xbc
_ADC0CF1 DATA 0xb9
_ADC0CF2 DATA 0xdf
_ADC0CN0 DATA 0xe8
_ADC0CN1 DATA 0xb2
_ADC0CN2 DATA 0xb3
_ADC0GTH DATA 0xc4
_ADC0GTL DATA 0xc3
_ADC0H DATA 0xbe
_ADC0L DATA 0xbd
_ADC0LTH DATA 0xc6
_ADC0LTL DATA 0xc5
_ADC0MX DATA 0xbb
_B DATA 0xf0
_CKCON0 DATA 0x8e
_CKCON1 DATA 0xa6
_CLEN0 DATA 0xc6
_CLIE0 DATA 0xc7
_CLIF0 DATA 0xe8
_CLKSEL DATA 0xa9
_CLOUT0 DATA 0xd1
_CLU0CF DATA 0xb1
_CLU0FN DATA 0xaf
_CLU0MX DATA 0x84
_CLU1CF DATA 0xb3
_CLU1FN DATA 0xb2
_CLU1MX DATA 0x85
_CLU2CF DATA 0xb6
_CLU2FN DATA 0xb5
_CLU2MX DATA 0x91
_CLU3CF DATA 0xbf
_CLU3FN DATA 0xbe
_CLU3MX DATA 0xae
_CMP0CN0 DATA 0x9b
_CMP0CN1 DATA 0x99
_CMP0MD DATA 0x9d
_CMP0MX DATA 0x9f
_CMP1CN0 DATA 0xbf
_CMP1CN1 DATA 0xac
_CMP1MD DATA 0xab
_CMP1MX DATA 0xaa
_CRC0CN0 DATA 0xce
_CRC0CN1 DATA 0x86
_CRC0CNT DATA 0xd3
_CRC0DAT DATA 0xcb
_CRC0FLIP DATA 0xcf
_CRC0IN DATA 0xca
_CRC0ST DATA 0xd2
_DAC0CF0 DATA 0x91
_DAC0CF1 DATA 0x92
_DAC0H DATA 0x85
_DAC0L DATA 0x84
_DAC1CF0 DATA 0x93
_DAC1CF1 DATA 0x94
_DAC1H DATA 0x8a
_DAC1L DATA 0x89
_DAC2CF0 DATA 0x95
_DAC2CF1 DATA 0x96
_DAC2H DATA 0x8c
_DAC2L DATA 0x8b
_DAC3CF0 DATA 0x9a
_DAC3CF1 DATA 0x9c
_DAC3H DATA 0x8e
_DAC3L DATA 0x8d
_DACGCF0 DATA 0x88
_DACGCF1 DATA 0x98
_DACGCF2 DATA 0xa2
_DERIVID DATA 0xad
_DEVICEID DATA 0xb5
_DPH DATA 0x83
_DPL DATA 0x82
_EIE1 DATA 0xe6
_EIE2 DATA 0xf3
_EIP1 DATA 0xbb
_EIP1H DATA 0xee
_EIP2 DATA 0xed
_EIP2H DATA 0xf6
_EMI0CN DATA 0xe7
_FLKEY DATA 0xb7
_HFO0CAL DATA 0xc7
_HFO1CAL DATA 0xd6
_HFOCN DATA 0xef
_I2C0ADM DATA 0xff
_I2C0CN0 DATA 0xba
_I2C0DIN DATA 0xbc
_I2C0DOUT DATA 0xbb
_I2C0FCN0 DATA 0xad
_I2C0FCN1 DATA 0xab
_I2C0FCT DATA 0xf5
_I2C0SLAD DATA 0xbd
_I2C0STAT DATA 0xb9
_IE DATA 0xa8
_IP DATA 0xb8
_IPH DATA 0xf2
_IT01CF DATA 0xe4
_LFO0CN DATA 0xb1
_P0 DATA 0x80
_P0MASK DATA 0xfe
_P0MAT DATA 0xfd
_P0MDIN DATA 0xf1
_P0MDOUT DATA 0xa4
_P0SKIP DATA 0xd4
_P1 DATA 0x90
_P1MASK DATA 0xee
_P1MAT DATA 0xed
_P1MDIN DATA 0xf2
_P1MDOUT DATA 0xa5
_P1SKIP DATA 0xd5
_P2 DATA 0xa0
_P2MASK DATA 0xfc
_P2MAT DATA 0xfb
_P2MDIN DATA 0xf3
_P2MDOUT DATA 0xa6
_P2SKIP DATA 0xcc
_P3 DATA 0xb0
_P3MDIN DATA 0xf4
_P3MDOUT DATA 0x9c
_PCA0CENT DATA 0x9e
_PCA0CLR DATA 0x9c
_PCA0CN0 DATA 0xd8
_PCA0CPH0 DATA 0xfc
_PCA0CPH1 DATA 0xea
_PCA0CPH2 DATA 0xec
_PCA0CPH3 DATA 0xf5
_PCA0CPH4 DATA 0x85
_PCA0CPH5 DATA 0xde
_PCA0CPL0 DATA 0xfb
_PCA0CPL1 DATA 0xe9
_PCA0CPL2 DATA 0xeb
_PCA0CPL3 DATA 0xf4
_PCA0CPL4 DATA 0x84
_PCA0CPL5 DATA 0xdd
_PCA0CPM0 DATA 0xda
_PCA0CPM1 DATA 0xdb
_PCA0CPM2 DATA 0xdc
_PCA0CPM3 DATA 0xae
_PCA0CPM4 DATA 0xaf
_PCA0CPM5 DATA 0xcc
_PCA0H DATA 0xfa
_PCA0L DATA 0xf9
_PCA0MD DATA 0xd9
_PCA0POL DATA 0x96
_PCA0PWM DATA 0xf7
_PCON0 DATA 0x87
_PCON1 DATA 0xcd
_PFE0CN DATA 0xc1
_PRTDRV DATA 0xf6
_PSCTL DATA 0x8f
_PSTAT0 DATA 0xaa
_PSW DATA 0xd0
_REF0CN DATA 0xd1
_REG0CN DATA 0xc9
_REVID DATA 0xb6
_RSTSRC DATA 0xef
_SBCON1 DATA 0x94
_SBRLH1 DATA 0x96
_SBRLL1 DATA 0x95
_SBUF DATA 0x99
_SBUF0 DATA 0x99
_SBUF1 DATA 0x92
_SCON DATA 0x98
_SCON0 DATA 0x98
_SCON1 DATA 0xc8
_SFRPAGE DATA 0xa7
_SFRPGCN DATA 0xbc
_SFRSTACK DATA 0xd7
_SMB0ADM DATA 0xd6
_SMB0ADR DATA 0xd7
_SMB0CF DATA 0xc1
_SMB0CN0 DATA 0xc0
_SMB0DAT DATA 0xc2
_SMB0FCN0 DATA 0xc3
_SMB0FCN1 DATA 0xc4
_SMB0FCT DATA 0xef
_SMB0RXLN DATA 0xc5
_SMB0TC DATA 0xac
_SMOD1 DATA 0x93
_SP DATA 0x81
_SPI0CFG DATA 0xa1
_SPI0CKR DATA 0xa2
_SPI0CN0 DATA 0xf8
_SPI0DAT DATA 0xa3
_SPI0FCN0 DATA 0x9a
_SPI0FCN1 DATA 0x9b
_SPI0FCT DATA 0xf7
_SPI0PCF DATA 0xdf
_TCON DATA 0x88
_TH0 DATA 0x8c
_TH1 DATA 0x8d
_TL0 DATA 0x8a
_TL1 DATA 0x8b
_TMOD DATA 0x89
_TMR2CN0 DATA 0xc8
_TMR2CN1 DATA 0xfd
_TMR2H DATA 0xcf
_TMR2L DATA 0xce
_TMR2RLH DATA 0xcb
_TMR2RLL DATA 0xca
_TMR3CN0 DATA 0x91
_TMR3CN1 DATA 0xfe
_TMR3H DATA 0x95
_TMR3L DATA 0x94
_TMR3RLH DATA 0x93
_TMR3RLL DATA 0x92
_TMR4CN0 DATA 0x98
_TMR4CN1 DATA 0xff
_TMR4H DATA 0xa5
_TMR4L DATA 0xa4
_TMR4RLH DATA 0xa3
_TMR4RLL DATA 0xa2
_TMR5CN0 DATA 0xc0
_TMR5CN1 DATA 0xf1
_TMR5H DATA 0xd5
_TMR5L DATA 0xd4
_TMR5RLH DATA 0xd3
_TMR5RLL DATA 0xd2
_UART0PCF DATA 0xd9
_UART1FCN0 DATA 0x9d
_UART1FCN1 DATA 0xd8
_UART1FCT DATA 0xfa
_UART1LIN DATA 0x9e
_UART1PCF DATA 0xda
_VDM0CN DATA 0xff
_WDTCN DATA 0x97
_XBR0 DATA 0xe1
_XBR1 DATA 0xe2
_XBR2 DATA 0xe3
_XOSC0CN DATA 0x86
_DPTR DATA 0x8382
_TMR2RL DATA 0xcbca
_TMR3RL DATA 0x9392
_TMR4RL DATA 0xa3a2
_TMR5RL DATA 0xd3d2
_TMR0 DATA 0x8c8a
_TMR1 DATA 0x8d8b
_TMR2 DATA 0xcfce
_TMR3 DATA 0x9594
_TMR4 DATA 0xa5a4
_TMR5 DATA 0xd5d4
_SBRL1 DATA 0x9695
_PCA0 DATA 0xfaf9
_PCA0CP0 DATA 0xfcfb
_PCA0CP1 DATA 0xeae9
_PCA0CP2 DATA 0xeceb
_PCA0CP3 DATA 0xf5f4
_PCA0CP4 DATA 0x8584
_PCA0CP5 DATA 0xdedd
_ADC0ASA DATA 0xb6b5
_ADC0GT DATA 0xc4c3
_ADC0 DATA 0xbebd
_ADC0LT DATA 0xc6c5
_DAC0 DATA 0x8584
_DAC1 DATA 0x8a89
_DAC2 DATA 0x8c8b
_DAC3 DATA 0x8e8d
;--------------------------------------------------------
; special function bits
;--------------------------------------------------------
_ACC_0 BIT 0xe0
_ACC_1 BIT 0xe1
_ACC_2 BIT 0xe2
_ACC_3 BIT 0xe3
_ACC_4 BIT 0xe4
_ACC_5 BIT 0xe5
_ACC_6 BIT 0xe6
_ACC_7 BIT 0xe7
_TEMPE BIT 0xe8
_ADGN0 BIT 0xe9
_ADGN1 BIT 0xea
_ADWINT BIT 0xeb
_ADBUSY BIT 0xec
_ADINT BIT 0xed
_IPOEN BIT 0xee
_ADEN BIT 0xef
_B_0 BIT 0xf0
_B_1 BIT 0xf1
_B_2 BIT 0xf2
_B_3 BIT 0xf3
_B_4 BIT 0xf4
_B_5 BIT 0xf5
_B_6 BIT 0xf6
_B_7 BIT 0xf7
_C0FIF BIT 0xe8
_C0RIF BIT 0xe9
_C1FIF BIT 0xea
_C1RIF BIT 0xeb
_C2FIF BIT 0xec
_C2RIF BIT 0xed
_C3FIF BIT 0xee
_C3RIF BIT 0xef
_D1SRC0 BIT 0x88
_D1SRC1 BIT 0x89
_D1AMEN BIT 0x8a
_D01REFSL BIT 0x8b
_D3SRC0 BIT 0x8c
_D3SRC1 BIT 0x8d
_D3AMEN BIT 0x8e
_D23REFSL BIT 0x8f
_D0UDIS BIT 0x98
_D1UDIS BIT 0x99
_D2UDIS BIT 0x9a
_D3UDIS BIT 0x9b
_EX0 BIT 0xa8
_ET0 BIT 0xa9
_EX1 BIT 0xaa
_ET1 BIT 0xab
_ES0 BIT 0xac
_ET2 BIT 0xad
_ESPI0 BIT 0xae
_EA BIT 0xaf
_PX0 BIT 0xb8
_PT0 BIT 0xb9
_PX1 BIT 0xba
_PT1 BIT 0xbb
_PS0 BIT 0xbc
_PT2 BIT 0xbd
_PSPI0 BIT 0xbe
_P0_0 BIT 0x80
_P0_1 BIT 0x81
_P0_2 BIT 0x82
_P0_3 BIT 0x83
_P0_4 BIT 0x84
_P0_5 BIT 0x85
_P0_6 BIT 0x86
_P0_7 BIT 0x87
_P1_0 BIT 0x90
_P1_1 BIT 0x91
_P1_2 BIT 0x92
_P1_3 BIT 0x93
_P1_4 BIT 0x94
_P1_5 BIT 0x95
_P1_6 BIT 0x96
_P1_7 BIT 0x97
_P2_0 BIT 0xa0
_P2_1 BIT 0xa1
_P2_2 BIT 0xa2
_P2_3 BIT 0xa3
_P2_4 BIT 0xa4
_P2_5 BIT 0xa5
_P2_6 BIT 0xa6
_P3_0 BIT 0xb0
_P3_1 BIT 0xb1
_P3_2 BIT 0xb2
_P3_3 BIT 0xb3
_P3_4 BIT 0xb4
_P3_7 BIT 0xb7
_CCF0 BIT 0xd8
_CCF1 BIT 0xd9
_CCF2 BIT 0xda
_CCF3 BIT 0xdb
_CCF4 BIT 0xdc
_CCF5 BIT 0xdd
_CR BIT 0xde
_CF BIT 0xdf
_PARITY BIT 0xd0
_F1 BIT 0xd1
_OV BIT 0xd2
_RS0 BIT 0xd3
_RS1 BIT 0xd4
_F0 BIT 0xd5
_AC BIT 0xd6
_CY BIT 0xd7
_RI BIT 0x98
_TI BIT 0x99
_RB8 BIT 0x9a
_TB8 BIT 0x9b
_REN BIT 0x9c
_CE BIT 0x9d
_SMODE BIT 0x9e
_RI1 BIT 0xc8
_TI1 BIT 0xc9
_RBX1 BIT 0xca
_TBX1 BIT 0xcb
_REN1 BIT 0xcc
_PERR1 BIT 0xcd
_OVR1 BIT 0xce
_SI BIT 0xc0
_ACK BIT 0xc1
_ARBLOST BIT 0xc2
_ACKRQ BIT 0xc3
_STO BIT 0xc4
_STA BIT 0xc5
_TXMODE BIT 0xc6
_MASTER BIT 0xc7
_SPIEN BIT 0xf8
_TXNF BIT 0xf9
_NSSMD0 BIT 0xfa
_NSSMD1 BIT 0xfb
_RXOVRN BIT 0xfc
_MODF BIT 0xfd
_WCOL BIT 0xfe
_SPIF BIT 0xff
_IT0 BIT 0x88
_IE0 BIT 0x89
_IT1 BIT 0x8a
_IE1 BIT 0x8b
_TR0 BIT 0x8c
_TF0 BIT 0x8d
_TR1 BIT 0x8e
_TF1 BIT 0x8f
_T2XCLK0 BIT 0xc8
_T2XCLK1 BIT 0xc9
_TR2 BIT 0xca
_T2SPLIT BIT 0xcb
_TF2CEN BIT 0xcc
_TF2LEN BIT 0xcd
_TF2L BIT 0xce
_TF2H BIT 0xcf
_T4XCLK0 BIT 0x98
_T4XCLK1 BIT 0x99
_TR4 BIT 0x9a
_T4SPLIT BIT 0x9b
_TF4CEN BIT 0x9c
_TF4LEN BIT 0x9d
_TF4L BIT 0x9e
_TF4H BIT 0x9f
_T5XCLK0 BIT 0xc0
_T5XCLK1 BIT 0xc1
_TR5 BIT 0xc2
_T5SPLIT BIT 0xc3
_TF5CEN BIT 0xc4
_TF5LEN BIT 0xc5
_TF5L BIT 0xc6
_TF5H BIT 0xc7
_RIE BIT 0xd8
_RXTO0 BIT 0xd9
_RXTO1 BIT 0xda
_RFRQ BIT 0xdb
_TIE BIT 0xdc
_TXHOLD BIT 0xdd
_TXNF1 BIT 0xde
_TFRQ BIT 0xdf
;--------------------------------------------------------
; overlayable register banks
;--------------------------------------------------------
rbank0 segment data overlay
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
rseg R_DSEG
_overflow_count:
ds 1
;--------------------------------------------------------
; overlayable items in internal ram
;--------------------------------------------------------
rseg R_OSEG
;--------------------------------------------------------
; indirectly addressable internal ram data
;--------------------------------------------------------
rseg R_ISEG
;--------------------------------------------------------
; absolute internal ram data
;--------------------------------------------------------
DSEG
;--------------------------------------------------------
; bit data
;--------------------------------------------------------
rseg R_BSEG
;--------------------------------------------------------
; paged external ram data
;--------------------------------------------------------
rseg R_PSEG
;--------------------------------------------------------
; external ram data
;--------------------------------------------------------
rseg R_XSEG
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
XSEG
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
rseg R_IXSEG
rseg R_HOME
rseg R_GSINIT
rseg R_CSEG
;--------------------------------------------------------
; Reset entry point and interrupt vectors
;--------------------------------------------------------
CSEG at 0x0000
ljmp _crt0
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
rseg R_HOME
rseg R_GSINIT
rseg R_GSINIT
;--------------------------------------------------------
; data variables initialization
;--------------------------------------------------------
rseg R_DINIT
; The linker places a 'ret' at the end of segment R_DINIT.
;--------------------------------------------------------
; code
;--------------------------------------------------------
rseg R_CSEG
;------------------------------------------------------------
;Allocation info for local variables in function '_c51_external_startup'
;------------------------------------------------------------
;------------------------------------------------------------
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:16: char _c51_external_startup (void)
; -----------------------------------------
; function _c51_external_startup
; -----------------------------------------
__c51_external_startup:
using 0
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:19: SFRPAGE = 0x00;
mov _SFRPAGE,#0x00
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:20: WDTCN = 0xDE; //First key
mov _WDTCN,#0xDE
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:21: WDTCN = 0xAD; //Second key
mov _WDTCN,#0xAD
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:23: VDM0CN |= 0x80;
orl _VDM0CN,#0x80
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:24: RSTSRC = 0x02;
mov _RSTSRC,#0x02
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:31: SFRPAGE = 0x10;
mov _SFRPAGE,#0x10
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:32: PFE0CN = 0x20; // SYSCLK < 75 MHz.
mov _PFE0CN,#0x20
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:33: SFRPAGE = 0x00;
mov _SFRPAGE,#0x00
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:54: CLKSEL = 0x00;
mov _CLKSEL,#0x00
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:55: CLKSEL = 0x00;
mov _CLKSEL,#0x00
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:56: while ((CLKSEL & 0x80) == 0);
L002001?:
mov a,_CLKSEL
jnb acc.7,L002001?
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:57: CLKSEL = 0x03;
mov _CLKSEL,#0x03
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:58: CLKSEL = 0x03;
mov _CLKSEL,#0x03
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:59: while ((CLKSEL & 0x80) == 0);
L002004?:
mov a,_CLKSEL
jnb acc.7,L002004?
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:64: P0MDOUT |= 0x10; // Enable UART0 TX as push-pull output
orl _P0MDOUT,#0x10
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:65: XBR0 = 0x01; // Enable UART0 on P0.4(TX) and P0.5(RX)
mov _XBR0,#0x01
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:66: XBR1 = 0X00;
mov _XBR1,#0x00
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:67: XBR2 = 0x40; // Enable crossbar and weak pull-ups
mov _XBR2,#0x40
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:73: SCON0 = 0x10;
mov _SCON0,#0x10
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:74: CKCON0 |= 0b_0000_0000 ; // Timer 1 uses the system clock divided by 12.
mov _CKCON0,_CKCON0
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:75: TH1 = 0x100-((SYSCLK/BAUDRATE)/(2L*12L));
mov _TH1,#0xE6
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:76: TL1 = TH1; // Init Timer1
mov _TL1,_TH1
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:77: TMOD &= ~0xf0; // TMOD: timer 1 in 8-bit auto-reload
anl _TMOD,#0x0F
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:78: TMOD |= 0x20;
orl _TMOD,#0x20
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:79: TR1 = 1; // START Timer1
setb _TR1
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:80: TI = 1; // Indicate TX0 ready
setb _TI
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:82: return 0;
mov dpl,#0x00
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'Timer3us'
;------------------------------------------------------------
;us Allocated to registers r2
;i Allocated to registers r3
;------------------------------------------------------------
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:86: void Timer3us(unsigned char us)
; -----------------------------------------
; function Timer3us
; -----------------------------------------
_Timer3us:
mov r2,dpl
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:91: CKCON0|=0b_0100_0000;
orl _CKCON0,#0x40
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:93: TMR3RL = (-(SYSCLK)/1000000L); // Set Timer3 to overflow in 1us.
mov _TMR3RL,#0xB8
mov (_TMR3RL >> 8),#0xFF
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:94: TMR3 = TMR3RL; // Initialize Timer3 for first overflow
mov _TMR3,_TMR3RL
mov (_TMR3 >> 8),(_TMR3RL >> 8)
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:96: TMR3CN0 = 0x04; // Sart Timer3 and clear overflow flag
mov _TMR3CN0,#0x04
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:97: for (i = 0; i < us; i++) // Count <us> overflows
mov r3,#0x00
L003004?:
clr c
mov a,r3
subb a,r2
jnc L003007?
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:99: while (!(TMR3CN0 & 0x80)); // Wait for overflow
L003001?:
mov a,_TMR3CN0
jnb acc.7,L003001?
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:100: TMR3CN0 &= ~(0x80); // Clear overflow indicator
anl _TMR3CN0,#0x7F
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:97: for (i = 0; i < us; i++) // Count <us> overflows
inc r3
sjmp L003004?
L003007?:
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:102: TMR3CN0 = 0 ; // Stop Timer3 and clear overflow flag
mov _TMR3CN0,#0x00
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'waitms'
;------------------------------------------------------------
;ms Allocated to registers r2 r3
;j Allocated to registers r2 r3
;------------------------------------------------------------
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:105: void waitms (unsigned int ms)
; -----------------------------------------
; function waitms
; -----------------------------------------
_waitms:
mov r2,dpl
mov r3,dph
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:108: for(j=ms; j!=0; j--)
L004001?:
cjne r2,#0x00,L004010?
cjne r3,#0x00,L004010?
ret
L004010?:
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:110: Timer3us(249);
mov dpl,#0xF9
push ar2
push ar3
lcall _Timer3us
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:111: Timer3us(249);
mov dpl,#0xF9
lcall _Timer3us
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:112: Timer3us(249);
mov dpl,#0xF9
lcall _Timer3us
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:113: Timer3us(250);
mov dpl,#0xFA
lcall _Timer3us
pop ar3
pop ar2
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:108: for(j=ms; j!=0; j--)
dec r2
cjne r2,#0xff,L004011?
dec r3
L004011?:
sjmp L004001?
;------------------------------------------------------------
;Allocation info for local variables in function 'TIMER0_Init'
;------------------------------------------------------------
;------------------------------------------------------------
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:117: void TIMER0_Init(void)
; -----------------------------------------
; function TIMER0_Init
; -----------------------------------------
_TIMER0_Init:
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:119: TMOD&=0b_1111_0000; // Set the bits of Timer/Counter 0 to zero
anl _TMOD,#0xF0
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:120: TMOD|=0b_0000_0001; // Timer/Counter 0 used as a 16-bit timer
orl _TMOD,#0x01
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:121: TR0=0; // Stop Timer/Counter 0
clr _TR0
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'main'
;------------------------------------------------------------
;period Allocated to registers r2 r3 r4 r5
;------------------------------------------------------------
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:124: void main (void)
; -----------------------------------------
; function main
; -----------------------------------------
_main:
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:128: TIMER0_Init();
lcall _TIMER0_Init
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:130: waitms(500); // Give PuTTY a chance to start.
mov dptr,#0x01F4
lcall _waitms
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:131: printf("\x1b[2J"); // Clear screen using ANSI escape sequence.
mov a,#__str_0
push acc
mov a,#(__str_0 >> 8)
push acc
mov a,#0x80
push acc
lcall _printf
dec sp
dec sp
dec sp
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:136: __FILE__, __DATE__, __TIME__);
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:135: "Compiled: %s, %s\n\n",
mov a,#__str_4
push acc
mov a,#(__str_4 >> 8)
push acc
mov a,#0x80
push acc
mov a,#__str_3
push acc
mov a,#(__str_3 >> 8)
push acc
mov a,#0x80
push acc
mov a,#__str_2
push acc
mov a,#(__str_2 >> 8)
push acc
mov a,#0x80
push acc
mov a,#__str_1
push acc
mov a,#(__str_1 >> 8)
push acc
mov a,#0x80
push acc
lcall _printf
mov a,sp
add a,#0xf4
mov sp,a
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:138: while (1)
L006018?:
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:141: TL0=0;
mov _TL0,#0x00
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:142: TH0=0;
mov _TH0,#0x00
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:143: TF0=0;
clr _TF0
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:144: overflow_count=0;
mov _overflow_count,#0x00
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:146: while(P0_1!=0); // Wait for the signal to be zero
L006001?:
jb _P0_1,L006001?
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:147: while(P0_1!=1); // Wait for the signal to be one
L006004?:
jnb _P0_1,L006004?
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:148: TR0=1; // Start the timer
setb _TR0
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:149: while(P0_1!=0) // Wait for the signal to be zero
L006009?:
jnb _P0_1,L006014?
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:151: if(TF0==1) // Did the 16-bit timer overflow?
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:153: TF0=0;
jbc _TF0,L006035?
sjmp L006009?
L006035?:
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:154: overflow_count++;
inc _overflow_count
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:157: while(P0_1!=1) // Wait for the signal to be one
sjmp L006009?
L006014?:
jb _P0_1,L006016?
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:159: if(TF0==1) // Did the 16-bit timer overflow?
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:161: TF0=0;
jbc _TF0,L006037?
sjmp L006014?
L006037?:
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:162: overflow_count++;
inc _overflow_count
sjmp L006014?
L006016?:
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:165: TR0=0; // Stop timer 0, the 24-bit number [overflow_count-TH0-TL0] has the period!
clr _TR0
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:166: period=(overflow_count*65536.0+TH0*256.0+TL0)*(12.0/SYSCLK);
mov dpl,_overflow_count
lcall ___uchar2fs
mov r2,dpl
mov r3,dph
mov r4,b
mov r5,a
push ar2
push ar3
push ar4
push ar5
mov dptr,#0x0000
mov b,#0x80
mov a,#0x47
lcall ___fsmul
mov r2,dpl
mov r3,dph
mov r4,b
mov r5,a
mov a,sp
add a,#0xfc
mov sp,a
mov dpl,_TH0
push ar2
push ar3
push ar4
push ar5
lcall ___uchar2fs
mov r6,dpl
mov r7,dph
mov r0,b
mov r1,a
push ar6
push ar7
push ar0
push ar1
mov dptr,#0x0000
mov b,#0x80
mov a,#0x43
lcall ___fsmul
mov r6,dpl
mov r7,dph
mov r0,b
mov r1,a
mov a,sp
add a,#0xfc
mov sp,a
pop ar5
pop ar4
pop ar3
pop ar2
push ar6
push ar7
push ar0
push ar1
mov dpl,r2
mov dph,r3
mov b,r4
mov a,r5
lcall ___fsadd
mov r2,dpl
mov r3,dph
mov r4,b
mov r5,a
mov a,sp
add a,#0xfc
mov sp,a
mov r6,_TL0
mov r7,#0x00
mov dpl,r6
mov dph,r7
push ar2
push ar3
push ar4
push ar5
lcall ___sint2fs
mov r6,dpl
mov r7,dph
mov r0,b
mov r1,a
pop ar5
pop ar4
pop ar3
pop ar2
push ar6
push ar7
push ar0
push ar1
mov dpl,r2
mov dph,r3
mov b,r4
mov a,r5
lcall ___fsadd
mov r2,dpl
mov r3,dph
mov r4,b
mov r5,a
mov a,sp
add a,#0xfc
mov sp,a
push ar2
push ar3
push ar4
push ar5
mov dptr,#0xF4FC
mov b,#0x32
mov a,#0x34
lcall ___fsmul
mov r2,dpl
mov r3,dph
mov r4,b
mov r5,a
mov a,sp
add a,#0xfc
mov sp,a
; C:\Users\carso\Documents\1. School\0. Spring 2018\Elec 292\lab4\period.c:168: printf( "\rT=%f ms ", period*1000.0);
push ar2
push ar3
push ar4
push ar5
mov dptr,#0x0000
mov b,#0x7A
mov a,#0x44
lcall ___fsmul
mov r2,dpl
mov r3,dph
mov r4,b
mov r5,a
mov a,sp
add a,#0xfc
mov sp,a
push ar2
push ar3
push ar4
push ar5
mov a,#__str_5
push acc
mov a,#(__str_5 >> 8)
push acc
mov a,#0x80
push acc
lcall _printf
mov a,sp
add a,#0xf9
mov sp,a
ljmp L006018?
rseg R_CSEG
rseg R_XINIT
rseg R_CONST
__str_0:
db 0x1B
db '[2J'
db 0x00
__str_1:
db 'EFM8 Period measurement at pin P0.1 using Timer 0.'
db 0x0A
db 'File: %s'
db 0x0A
db 'Compiled: %s, %s'
db 0x0A
db 0x0A
db 0x00
__str_2:
db 'C:'
db 0x5C
db 'Users'
db 0x5C
db 'carso'
db 0x5C
db 'Documents'
db 0x5C
db '1. School'
db 0x5C
db '0. Spring 2018'
db 0x5C
db 'Elec 292'
db 0x5C
db 'l'
db 'ab4'
db 0x5C
db 'period.c'
db 0x00
__str_3:
db 'Feb 28 2018'
db 0x00
__str_4:
db '16:14:18'
db 0x00
__str_5:
db 0x0D
db 'T=%f ms '
db 0x00
CSEG