-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathleddriver16bit.asm
More file actions
141 lines (105 loc) · 2.4 KB
/
Copy pathleddriver16bit.asm
File metadata and controls
141 lines (105 loc) · 2.4 KB
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
.module softpwmpdk
BUFSIZE=8
.include "pdk.asm"
.include "delay.asm"
.include "settings.asm"
.include "uart2.asm"
.include "softpwm16.asm"
.area DATA (ABS)
.org 0x00
; bitwise ops need to have an address < 16
shiftreg: .ds 1
error: .ds 1
uart_state: .ds 1
pin_mask_cur: .ds 1
pinmask: .ds 1
uart_tmp: .ds 1
low1_staging: .ds 1
low2_staging: .ds 1
low3_staging: .ds 1
refresh: .ds 1
; word aligned
;...
p_lo: .ds 1
p_hi: .ds 1
out0: .ds 1
out1: .ds 1
cycle: .ds 1
switch_channel: .ds 1
high: .ds 1
high1: .ds 1
high2: .ds 1
high3: .ds 1
high1_staging: .ds 1
high2_staging: .ds 1
high3_staging: .ds 1
low: .ds 1
low1: .ds 1
low2: .ds 1
low3: .ds 1
dith: .ds 1
dith1: .ds 1
dith2: .ds 1
dith3: .ds 1
dith1_staging: .ds 1
dith2_staging: .ds 1
dith3_staging: .ds 1
cmp1: .ds 1
cmp2: .ds 1
cmp3: .ds 1
rem1: .ds 1
rem2: .ds 1
rem3: .ds 1
low_highnib: .ds 1
low_cur: .ds 1
;
index: .ds 1
cur_channel: .ds 1
wait_count: .ds 1
bit_count: .ds 1
reset_count: .ds 1
index_const: .ds 1
.area CODE (ABS)
.org 0x00
.ifeq DEVICE-PMS150C
set_fuse FUSE_SET_LVR_2V75
.endif
; pull mosfets low first
clock_8mhz
brownout_erratum_workaround_init
;
; ________ ________
; ________0000000011111111222222223333333344444444555555556666666677777777
; /\
; |-----------| (start_wait+1/2)*interval 9 1/2 baud
; time to first sample (avg) sample stop bit (avg)
;
;baud = 38400
;start_wait = 4
;bit_wait = 3
;check_interval = 64
;cycles = (.5+start_wait+8*bit_wait)*check_interval
;t = 9.5/baud
;freq = cycles/t
;print(freq)
FREQ=7372800
easypdk_calibrate FREQ, 3300
mov a, #PINMASK
mov pac, a
mov a, #0
mov pa, a
watchdog_enable
wdreset
find_settings settings p_lo
read_settings index_const
softpwm_init
uart_init
wdreset
softpwm
settings:
;.rept 256
;nop
;.endm
mov a, #INDEX
; update index by nopping (0x0000) out this instruction and appending a new mov, #NEW_INDEX
;