-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.asm
6715 lines (6624 loc) · 135 KB
/
main.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
;
; dot_matrix1.asm
;
; Created: 18-Dec-22 10:49:34
; Author : janos
;
.include "m1284def.inc" ; 20 Mhz crystal osc.
.include "reg_def.inc"
.dseg
;.org sram_start
flag_reg0: .byte 1
flag_reg1: .byte 1
flag_reg2: .byte 1
flag_reg3: .byte 1
flag_reg4: .byte 1
cnt0: .byte 2
cnt1: .byte 2
cnt2: .byte 1
cnt3: .byte 1
cnt4: .byte 1
cnt5: .byte 1
prg00_cnt: .byte 1
lnef_cnt: .byte 1
_sec: .byte 1
sec_bcd: .byte 2
_min: .byte 1
min_bcd: .byte 2
_hour: .byte 1
hour_bcd: .byte 2
day_bcd: .byte 2
month_bcd: .byte 2
year_bcd: .byte 2
temp_sec: .byte 1
temp_min: .byte 1
temp_hour: .byte 1
temp_day: .byte 2
temp_month: .byte 2
temp_year: .byte 2
sum: .byte 1
gps_char: .byte 1
gps_buf: .byte 80
gps_ptrl: .byte 1
gps_ptrh: .byte 1
gps_udr: .byte 1
s18_lsb: .byte 1
s18_msb: .byte 1
temp_str: .byte 8
blu_bufp: .byte 2
blu_udr: .byte 1
blu_temp: .byte 1
blu_buf: .byte 202
blutx1_buf: .byte 200
blutx1_ptr: .byte 2
dsp_i: .byte 1
dsp_s8reg: .byte 1
dsp_s8regr: .byte 1
dsp_t8reg: .byte 1
dsp_st16reg0: .byte 1
dsp_st16reg1: .byte 1
dsp_st16reg2: .byte 1
dsp_datereg: .byte 1
dsp_tempreg: .byte 1
dsp_clkreg: .byte 1
dsp_speedreg: .byte 1
dsp_16reg: .byte 1
dsp_8reg: .byte 1
dsp_effreg: .byte 1
dsp_invreg: .byte 1
data_64byte: .byte 64
ln16x32_ptr: .byte 2
data_32byte: .byte 32
lnu_ptr: .byte 2
lnm_ptr: .byte 2
lnd_ptr: .byte 2
data_8byte: .byte 8
ln_str: .byte 16
ln_dstr: .byte 128
ln_dstr16: .byte 256
ln_char: .byte 1
max7291_adr: .byte 1
max7291_data: .byte 1
;ln1_textp: .byte 2
ln1_ptr: .byte 2
ln1_cnt : .byte 2
ln1_speed: .byte 1
ln1_speedc: .byte 1
;ln2_textp: .byte 2
ln2_ptr: .byte 2
ln2_cnt : .byte 2
ln2_speed: .byte 1
ln2_speedc: .byte 1
;ln3_textp: .byte 2
ln3_ptr: .byte 2
ln3_cnt : .byte 2
ln3_speed: .byte 1
ln3_speedc: .byte 1
;ln4_textp: .byte 2
ln4_ptr: .byte 2
ln4_cnt : .byte 2
ln4_speed: .byte 1
ln4_speedc: .byte 1
;ln5_textp: .byte 2
ln5_ptr: .byte 2
ln5_cnt : .byte 2
ln5_speed: .byte 1
ln5_speedc: .byte 1
;ln6_textp: .byte 2
ln6_ptr: .byte 2
ln6_cnt : .byte 2
ln6_speed: .byte 1
ln6_speedc: .byte 1
ln1_text: .byte 1024
ln1_textch: .byte 200
ln1_textrch: .byte 200
ln2_text: .byte 1024
ln2_textch: .byte 200
ln2_textrch: .byte 200
ln3_text: .byte 1024
ln3_textch: .byte 200
ln3_textrch: .byte 200
ln4_text: .byte 1024
ln4_textch: .byte 200
ln4_textrch: .byte 200
ln5_text: .byte 1024
ln5_textch: .byte 200
ln5_textrch: .byte 200
ln6_text: .byte 1024
ln6_textch: .byte 200
ln6_textrch: .byte 200
.MACRO delayms20
push temp
ldi temp,@0
delay_loopms:
call wait_20ms
dec temp
tst temp
brne delay_loopms
pop temp
.ENDMACRO
.MACRO delay
push temp
ldi temp,@0
delay_loops:
call wait_1000ms
dec temp
tst temp
brne delay_loops
pop temp
.ENDMACRO
.cseg
.org 0x0000
jmp RESET
;jmp INT0 ; IRQ0
;jmp INT1 ; IRQ1
;jmp INT2 ; IRQ2
;jmp PCINT0 ; PCINT0
;jmp PCINT1 ; PCINT1
;jmp PCINT2 ; PCINT2
;jmp PCINT3 ; PCINT3
;jmp WDT ; Watchdog Timeout
;jmp TIM2_COMPA ; Timer2 CompareA
;jmp TIM2_COMPB ; Timer2 CompareB
.org OVF2addr
jmp TIM2_OVF ; Timer2 Overflow
;jmp TIM1_CAPT ; Timer1 Capture
;jmp TIM1_COMPA ; Timer1 CompareA
;jmp TIM1_COMPB ; Timer1 CompareB
;jmp TIM1_OVF ; Timer1 Overflow
;.org 0x0020
;jmp TIM0_COMPA ; Timer0 CompareA
;.org 0x0022
;jmp TIM0_COMPB ; Timer0 CompareB
;.org 0x0024
;jmp TIM0_OVF ; Timer0 Overflow
;jmp SPI_STC ; SPI Transfer Complete
.org URXC0addr
jmp USART0_RXC ; USART0 RX Complete
;jmp USART0_UDRE ; USART0,UDR Empty
;.org 0x002A
;jmp USART0_TXC ; USART0 TX Complete
;jmp ANA_COMP ; Analog Comparator
;jmp ADC ; ADC Conversion Complete
;jmp EE_RDY ; EEPROM Ready
;jmp TWI ; two-wire Serial
;jmp SPM_RDY ; SPM Ready
.org URXC1addr
jmp USART1_RXC ; USART1 RX Complete
;jmp USART1_UDRE ; USART1,UDR Empty
.org UTXC1addr
jmp USART1_TXC ; USART1 TX Complete
;jmp TIM3_CAPT ; Timer3 Capture(1)
;jmp TIM3_COMPA ; Timer3 Compare(1)
;jmp TIM3_COMPB ; Timer3 CompareB(1)
;jmp TIM3_OVF ; Timer3 Overflow(1)
;********************* mcu stack init
reset:
ldi temp,low(ramend)
out spl,temp
ldi temp,high(ramend)
out sph,temp
;*********************
call wdt_off
call clr_sram
;********************* mcu port init
ldi temp,0b11111111
out ddra,temp
ldi temp,0b00000000
out porta,temp
ldi temp,0b11111110
out ddrb,temp
ldi temp,0b00000000
out portb,temp
ldi temp,0b11111010
out ddrd,temp
ldi temp,0b00000000
out portd,temp
ldi temp,0b11111111
out ddrc,temp
ldi temp,0b00000000
out portc,temp
;********************* mcu init
/*
ldi temp,0b00000011
out tccr0a,temp
ldi temp,0b00000101 ;clk/1024 presc
out tccr0b,temp
ldi temp,0b00000011
sts timsk0,temp
ldi temp,0xfb
out ocr0a,temp
ldi temp,tim0_val
out tcnt0,temp
*/
ldi temp,0b00000000
sts tccr2a,temp
ldi temp,0b00000111 ;clk/1024 presc
sts tccr2b,temp
ldi temp,0b00000001
sts timsk2,temp
ldi temp,tim2_val
sts tcnt2,temp
ldi temp,0 ;set uart 1 BLUETOOTH
sts ubrr1h,temp
ldi temp,0x0a ;set baud rate to 115200 bps
sts ubrr1l,temp
ldi temp,0b11011000
sts ucsr1b,temp
ldi temp,0b00000110
sts ucsr1c,temp
ldi temp,0 ;set uart 0 GPS
sts ubrr0h,temp
ldi temp,0x81 ;set baud rate to 9600 bps
sts ubrr0l,temp
ldi temp,0b10010000
sts ucsr0b,temp
ldi temp,0b00000110
sts ucsr0c,temp
;********************vcc rise delay sec
delayms20 25
call dsp_init
call dsp_clr
delay 5
;********************
sei
;********************
ldi xh,high(table_dspi)
ldi xl,low(table_dspi)
call eeprom_read
sts dsp_i,temp
call dsp_seti
ldi temp,25
sts _sec,temp
ldi temp,00
sts _min,temp
ldi temp,13
sts _hour,temp
ldi temp,'1'
sts day_bcd,temp
ldi temp,'3'
sts day_bcd+1,temp
ldi temp,'1'
sts month_bcd,temp
ldi temp,'2'
sts month_bcd+1,temp
ldi temp,'8'
sts year_bcd,temp
ldi temp,'0'
sts year_bcd+1,temp
call read_temp
call temp_load
call logo_print
delay 3
ldi temp6,8
logo_l:
call logo_printi
delayms20 1
call logo_print
delayms20 3
dec temp6
tst temp6
brne logo_l
call logo_printi
delay 3
call dsp_clr
call read_temp
call temp_load
ldi temp,low(blu_buf)
sts blu_bufp,temp
ldi temp,high(blu_buf)
sts blu_bufp+1,temp
ldi xh,high(table_dsp_s8reg)
ldi xl,low(table_dsp_s8reg)
call eeprom_read
sts dsp_s8reg,temp
adiw x,1
call eeprom_read
sts dsp_s8regr,temp
adiw x,1
call eeprom_read
sts dsp_t8reg,temp
adiw x,1
call eeprom_read
sts dsp_st16reg0,temp
adiw x,1
call eeprom_read
sts dsp_st16reg1,temp
adiw x,1
call eeprom_read
sts dsp_st16reg2,temp
adiw x,1
call eeprom_read
sts dsp_datereg,temp
adiw x,1
call eeprom_read
sts dsp_tempreg,temp
adiw x,1
call eeprom_read
sts dsp_clkreg,temp
adiw x,1
call eeprom_read
sts dsp_effreg,temp
adiw x,1
call eeprom_read
sts dsp_invreg,temp
call load_mem_dsp
main:
call refresh_screen
call blu_rxok
call gps_rxok
call ln24x48_txts
call ln16x32u_txts
call ln16x32d_txts
call ln24x48_txtrs
call ln16x32u_txtrs
call ln16x32d_txtrs
call lnu_txts
call lnm_txts
call lnd_txts
call lnu_txtrs
call lnm_txtrs
call lnd_txtrs
call ln1_txts
call ln2_txts
call ln3_txts
call ln4_txts
call ln5_txts
call ln6_txts
call ln1_txtrs
call ln2_txtrs
call ln3_txtrs
call ln4_txtrs
call ln5_txtrs
call ln6_txtrs
call temp_update
call ln_effect_en
call prg_00
jmp main
prg_00:
lds temp,flag_reg0
sbrs temp,min_p
ret
cbr temp,0x40
sts flag_reg0,temp
lds temp,prg00_cnt
inc temp
sts prg00_cnt,temp
cpi temp,2
breq prg00_exe
ret
prg00_exe:
clr temp
sts prg00_cnt,temp
prg00_main:
call refresh_scr00
call gps_rxok
call blu_rxok
call temp_update
call ln_effect_en
lds temp,flag_reg0
sbrs temp,min_p
jmp prg00_main
cbr temp,0x40
sts flag_reg0,temp
call dsp_clr
call load_mem_dsp
ret
refresh_scr00:
lds temp,flag_reg0
sbrs temp,refresh_scr
ret
cbr temp,0x01
sts flag_reg0,temp
sbi portb,led_
call clock_update
call o16_disp
call d16_disp
call s16_disp
ret
load_mem_dsp:
lds temp,dsp_st16reg0
sbrc temp,lnu_sena
call load_lnu
lds temp,dsp_st16reg0
sbrc temp,lnm_sena
call load_lnm
lds temp,dsp_st16reg0
sbrc temp,lnd_sena
call load_lnd
lds temp,dsp_st16reg1
sbrc temp,lnu_rsena
call load_lnur
lds temp,dsp_st16reg1
sbrc temp,lnm_rsena
call load_lnmr
lds temp,dsp_st16reg1
sbrc temp,lnd_rsena
call load_lndr
lds temp,dsp_st16reg2
sbrc temp,lng_sena
call load_ln24x48
lds temp,dsp_st16reg2
sbrc temp,lng_rsena
call load_ln24x48r
lds temp,dsp_st16reg0
sbrc temp,lnbu_sena
call load_ln16x32u
lds temp,dsp_st16reg0
sbrc temp,lnbd_sena
call load_ln16x32d
lds temp,dsp_st16reg1
sbrc temp,lnbu_rsena
call load_ln16x32ur
lds temp,dsp_st16reg1
sbrc temp,lnbd_rsena
call load_ln16x32dr
lds temp,dsp_s8reg
sbrc temp,ln1_sena
call load_ln1
lds temp,dsp_s8reg
sbrc temp,ln2_sena
call load_ln2
lds temp,dsp_s8reg
sbrc temp,ln3_sena
call load_ln3
lds temp,dsp_s8reg
sbrc temp,ln4_sena
call load_ln4
lds temp,dsp_s8reg
sbrc temp,ln5_sena
call load_ln5
lds temp,dsp_s8reg
sbrc temp,ln6_sena
call load_ln6
lds temp,dsp_s8regr
sbrc temp,ln1_rsena
call load_ln1r
lds temp,dsp_s8regr
sbrc temp,ln2_rsena
call load_ln2r
lds temp,dsp_s8regr
sbrc temp,ln3_rsena
call load_ln3r
lds temp,dsp_s8regr
sbrc temp,ln4_rsena
call load_ln4r
lds temp,dsp_s8regr
sbrc temp,ln5_rsena
call load_ln5r
lds temp,dsp_s8regr
sbrc temp,ln6_rsena
call load_ln6r
call ln1_txt_dsp
call ln2_txt_dsp
call ln3_txt_dsp
call ln4_txt_dsp
call ln5_txt_dsp
call ln6_txt_dsp
call lnu_txt_dsp
call lnm_txt_dsp
call lnd_txt_dsp
call lnbu_txt_dsp
call lnbd_txt_dsp
ret
ln_effect_en:
lds temp,dsp_effreg
sbrc temp,ln1_eff
call ln_effect
lds temp,dsp_effreg
sbrc temp,ln2_eff
call ln_effect
lds temp,dsp_effreg
sbrc temp,ln3_eff
call ln_effect
lds temp,dsp_effreg
sbrc temp,ln4_eff
call ln_effect
lds temp,dsp_effreg
sbrc temp,ln5_eff
call ln_effect
lds temp,dsp_effreg
sbrc temp,ln6_eff
call ln_effect
ret
ln_effect:
lds temp,flag_reg0
sbrs temp,ln_efspeed
ret
cbr temp,0x08
sts flag_reg0,temp
lds temp,flag_reg0
sbrs temp,ln_eff
call inc_lnef
lds temp,flag_reg0
sbrc temp,ln_eff
call dec_lnef
lds temp,lnef_cnt
cpi temp,15
breq set_eff
cpi temp,0
breq clr_eff
ret
clr_eff:
lds temp,flag_reg0
cbr temp,0x10
sts flag_reg0,temp
ret
set_eff:
lds temp,flag_reg0
sbr temp,0x10
sts flag_reg0,temp
tst temp
ret
inc_lnef:
lds temp,lnef_cnt
inc temp
sts lnef_cnt,temp
sts dsp_i,temp
call dsp_seti_ln
ret
dec_lnef:
lds temp,lnef_cnt
dec temp
sts lnef_cnt,temp
sts dsp_i,temp
call dsp_seti_ln
ret
logo_print:
lds temp,dsp_invreg
cbr temp,0x01
sts dsp_invreg,temp
call print128x48p
ret
logo_printi:
lds temp,dsp_invreg
sbr temp,0x01
sts dsp_invreg,temp
call print128x48p
ret
print128x48p:
sbi portb,led_
ldi zl,byte3(table_US_128x48*2)
out RAMPZ,ZL
ldi zh,high(table_US_128x48*2)
ldi zl,low(table_US_128x48*2)
lds temp4,dsp_invreg
ldi temp,1
ln1_ploop128x48:
sts max7291_adr,temp
clr temp3
l1:
elpm temp2,z+
sbrc temp4,logo_i
com temp2
sts max7291_data,temp2
call send_16b
inc temp3
cpi temp3,16
brne l1
call ln1_en
inc temp
cpi temp,9
brne ln1_ploop128x48
ldi temp,1
ln2_ploop128x48:
sts max7291_adr,temp
clr temp3
l2:
elpm temp2,z+
sbrc temp4,logo_i
com temp2
sts max7291_data,temp2
call send_16b
inc temp3
cpi temp3,16
brne l2
call ln2_en
inc temp
cpi temp,9
brne ln2_ploop128x48
ldi temp,1
ln3_ploop128x48:
sts max7291_adr,temp
clr temp3
l3:
elpm temp2,z+
sbrc temp4,logo_i
com temp2
sts max7291_data,temp2
call send_16b
inc temp3
cpi temp3,16
brne l3
call ln3_en
inc temp
cpi temp,9
brne ln3_ploop128x48
ldi temp,1
ln4_ploop128x48:
sts max7291_adr,temp
clr temp3
l4:
elpm temp2,z+
sbrc temp4,logo_i
com temp2
sts max7291_data,temp2
call send_16b
inc temp3
cpi temp3,16
brne l4
call ln4_en
inc temp
cpi temp,9
brne ln4_ploop128x48
ldi temp,1
ln5_ploop128x48:
sts max7291_adr,temp
clr temp3
l5:
elpm temp2,z+
sbrc temp4,logo_i
com temp2
sts max7291_data,temp2
call send_16b
inc temp3
cpi temp3,16
brne l5
call ln5_en
inc temp
cpi temp,9
brne ln5_ploop128x48
ldi temp,1
ln6_ploop128x48:
sts max7291_adr,temp
clr temp3
l6:
elpm temp2,z+
sbrc temp4,logo_i
com temp2
sts max7291_data,temp2
call send_16b
inc temp3
cpi temp3,16
brne l6
call ln6_en
inc temp
cpi temp,9
brne ln6_ploop128x48
ret
ln24x48_txts:
lds temp,dsp_st16reg2
sbrs temp,lng_sena
ret
lds temp,dsp_speedreg
sbrs temp,ln1_speedf
ret
cbr temp,0x80
sts dsp_speedreg,temp
sbi portb,led_
call ln24x48_txtl
ret
ln24x48_txtrs:
lds temp,dsp_st16reg2
sbrs temp,lng_rsena
ret
lds temp,dsp_speedreg
sbrs temp,ln1_speedf
ret
cbr temp,0x80
sts dsp_speedreg,temp
sbi portb,led_
call ln24x48_txtr
ret
ln16x32u_txts:
lds temp,dsp_st16reg0
sbrs temp,lnbu_sena
ret
lds temp,dsp_speedreg
sbrs temp,ln1_speedf
ret
cbr temp,0x80
sts dsp_speedreg,temp
sbi portb,led_
call ln16x32u_txtl
ret
ln16x32u_txtrs:
lds temp,dsp_st16reg1
sbrs temp,lnbu_rsena
ret
lds temp,dsp_speedreg
sbrs temp,ln1_speedf
ret
cbr temp,0x80
sts dsp_speedreg,temp
sbi portb,led_
call ln16x32u_txtr
ret
ln16x32d_txts:
lds temp,dsp_st16reg0
sbrs temp,lnbd_sena
ret
lds temp,dsp_speedreg
sbrs temp,ln3_speedf
ret
cbr temp,0x20
sts dsp_speedreg,temp
sbi portb,led_
call ln16x32d_txtl
ret
ln16x32d_txtrs:
lds temp,dsp_st16reg1
sbrs temp,lnbd_rsena
ret
lds temp,dsp_speedreg
sbrs temp,ln3_speedf
ret
cbr temp,0x20
sts dsp_speedreg,temp
sbi portb,led_
call ln16x32d_txtr
ret
lnu_txts:
lds temp,dsp_st16reg0
sbrs temp,lnu_sena
ret
lds temp,dsp_speedreg
sbrs temp,ln1_speedf
ret
cbr temp,0x80
sts dsp_speedreg,temp
sbi portb,led_
call lnu_txtl
ret
lnu_txtrs:
lds temp,dsp_st16reg1
sbrs temp,lnu_rsena
ret
lds temp,dsp_speedreg
sbrs temp,ln1_speedf
ret
cbr temp,0x80
sts dsp_speedreg,temp
sbi portb,led_
call lnu_txtr
ret
lnm_txts:
lds temp,dsp_st16reg0
sbrs temp,lnm_sena
ret
lds temp,dsp_speedreg
sbrs temp,ln3_speedf
ret
cbr temp,0x20
sts dsp_speedreg,temp
sbi portb,led_
call lnm_txtl
ret
lnm_txtrs:
lds temp,dsp_st16reg1
sbrs temp,lnm_rsena
ret
lds temp,dsp_speedreg
sbrs temp,ln3_speedf
ret
cbr temp,0x20
sts dsp_speedreg,temp
sbi portb,led_
call lnm_txtr
ret
lnd_txts:
lds temp,dsp_st16reg0
sbrs temp,lnd_sena
ret
lds temp,dsp_speedreg
sbrs temp,ln5_speedf
ret
cbr temp,0x08
sts dsp_speedreg,temp
sbi portb,led_
call lnd_txtl
ret
lnd_txtrs:
lds temp,dsp_st16reg1
sbrs temp,lnd_rsena
ret
lds temp,dsp_speedreg
sbrs temp,ln5_speedf
ret
cbr temp,0x08
sts dsp_speedreg,temp
sbi portb,led_
call lnd_txtr
ret
clock_update:
lds temp,_sec
cpi temp,30
brne ntime_sinc
call time_sinc
ntime_sinc:
clr fbin1
clr fbin2
lds fbin0,_hour
call bin3bcd
mov temp,tbcd0
andi temp,0x0f
ori temp,0x30
sts hour_bcd,temp
mov temp,tbcd0
swap temp
andi temp,0x0f
ori temp,0x30
sts hour_bcd+1,temp
clr fbin1
clr fbin2
lds fbin0,_min
call bin3bcd
mov temp,tbcd0
andi temp,0x0f
ori temp,0x30
sts min_bcd,temp
mov temp,tbcd0
swap temp
andi temp,0x0f
ori temp,0x30
sts min_bcd+1,temp
clr fbin1
clr fbin2
lds fbin0,_sec
call bin3bcd
mov temp,tbcd0
andi temp,0x0f
ori temp,0x30
sts sec_bcd,temp
mov temp,tbcd0
swap temp
andi temp,0x0f
ori temp,0x30
sts sec_bcd+1,temp
ret
time_sinc:
lds temp,gps_char
cpi temp,'A'
brne time_false
lds temp,temp_sec
sts _sec,temp
lds temp,temp_min
sts _min,temp
lds temp,temp_hour
sts _hour,temp
lds temp,temp_day
sts day_bcd,temp
lds temp,temp_day+1
sts day_bcd+1,temp
lds temp,temp_month
sts month_bcd,temp
lds temp,temp_month+1
sts month_bcd+1,temp
lds temp,temp_year
sts year_bcd,temp
lds temp,temp_year+1
sts year_bcd+1,temp
call sumt_adj
time_false:
ret
sumt_adj:
lds temp,month_bcd
andi temp,0x0f
swap temp
lds temp2,month_bcd+1
andi temp2,0x0f
or temp,temp2
mov fbcd0,temp
clr fbcd1
clr fbcd2
clr fbcd3
call bcd3bin
mov temp,tbin0
cpi temp,4
brge sumt_on
cpi temp,10
brge wint_on
jmp wint_on
sumt_on:
ldi temp,1
sts sum,temp
ret
wint_on:
clr temp
sts sum,temp
ret
temp_update:
lds temp,flag_reg0
sbrs temp,refresh_temp
ret
cbr temp,0x04
sts flag_reg0,temp