-
Notifications
You must be signed in to change notification settings - Fork 0
/
nokiaTest2.spin
78 lines (56 loc) · 990 Bytes
/
nokiaTest2.spin
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
'#define DEBUG
CON
_clkmode = xtal1 + pll16x ' Feedback and PLL multiplier
_xinfreq = 5_000_000 ' External oscillator = 5 MHz
VAR
byte clock
byte din
byte dc
byte cs
byte rst
byte led
PUB start | v
clock:=12
din:=13
dc:=14
cs:=15
rst:=16
led:=18
outa[cs]~~
outa[rst]~
outa[led]~
dira[rst]~~
dira[clock]~~
dira[din]~~
dira[dc]~~
dira[cs]~~
dira[led]~~
waitcnt(cnt+clkfreq >> 10)
outa[rst]~~
outa[led]~~
send(%00100001,0)
send(%11001000,0)
send(%00000110,0)
send(%00010011,0)
send(%00100000,0)
send(%00001100,0)
v:=0
repeat 504
send(v,1)
repeat
!v
repeat 504
send(v,1)
'waitcnt(cnt+clkfreq>>8)
PUB send(dataByte,isData) | waitTime
dataByte&=$ff
dataByte<-=25
outa[clock]~
outa[dc]:=isData
outa[cs]~
repeat 8
outa[din]:=(dataByte & 1)
outa[clock]~~
dataByte<-=1
outa[clock]~
outa[cs]~~