Brandy
Newbie level 2
- Joined
- Jan 25, 2013
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,301
Hello everyone.
I've started getting into microcontrollers and such as there is a project that I am very interested in doing (you might have seen it on youtube) it involves a dice box that when turned in a certain order pops the lid open via a solenoid.
I found a code for it from the maker but he had to get it off the chip so it's missing any labels and comments. I understand what all (well I should say most) of the assembler functions do but I have a hard time following all of the connections, basically with any new language; I know the vocabulary but have a hard time reading and writing full sentences.
I should note this project involves a PIC16F84 connected to homemade position sensor (6 copper tubes shaped like a cube with metal ball inside) and a solenoid holding a long pin attached to the lid.
If someone could explain sort of the big picture of what the code is doing that would really be helpful, also if you need more info please don't tell me how absurdly stupid I'm being like so many often do on these sites, just explain what else you need and I'll try and explain it.
[/url
I've started getting into microcontrollers and such as there is a project that I am very interested in doing (you might have seen it on youtube) it involves a dice box that when turned in a certain order pops the lid open via a solenoid.
I found a code for it from the maker but he had to get it off the chip so it's missing any labels and comments. I understand what all (well I should say most) of the assembler functions do but I have a hard time following all of the connections, basically with any new language; I know the vocabulary but have a hard time reading and writing full sentences.
I should note this project involves a PIC16F84 connected to homemade position sensor (6 copper tubes shaped like a cube with metal ball inside) and a solenoid holding a long pin attached to the lid.
If someone could explain sort of the big picture of what the code is doing that would really be helpful, also if you need more info please don't tell me how absurdly stupid I'm being like so many often do on these sites, just explain what else you need and I'll try and explain it.
Code:
LIST P=16F84A
ORG 00H
DCF 03,5
MOVLW 07
MOVWF 19
BSF 03,5
CLRF 1F
START_
1 GOTO 0X8
2 NOP
3 NOP
4 NOP
5 MOVF 0X6,F
6 BCF 0Xb,0
7 BCF 0Xb,0X3
8 RETFIE
9 MOVLW 0x10
10 MOVWF 0x4
11 MOVLW 0x16
12 SUBWF 0x4,W
13 BTFSC 0x3,0X2
14 GOTO 0x70
15 INCF 0x3,F
16 CALL 0x23
17 SUBWF 0x31,F
18 BTFSS 0x3,0x2
19 GOTO 0x18
20 DECFSZ 0x32,F
21 GOTO 0x19
22 DECFSZ 0xe,F
23 GOTO 0x19
24 GOTO 0x51
25 CLRF 0xe
26 MOVWF 0x31
27 SUBWF 0,F
28 BTFSC 0x3,0x2
29 GOTO 0xa
30 DECF 0x4,F
31 SUBWF 0,F
32 BTFSS 0x3,0x2
33 GOTO 0x8
34 INCF 0x4,F
35 GOTO 0xf
36 MOVLW 0x1
37 MOVWF 0x10
38 MOVLW 0x1
39 MOVWF 0x11
40 MOVLW 0x3
41 MOVWF 0x12
42 MOVLW 0x5
43 MOVWF 0x13
44 MOVLW 0x2
45 MOVWF 0x14
46 MOVLW 0x4
47 MOVWF 0x15
48 MOVLW 0x6
49 MOVEWF 0x16
50 BSF 0x3,0x5
51 BCF 0x1,0x7
52 CLRF 0x5
53 MOVLW 0xe0
54 MOVWF 0x5
55 BCF 0x3,0x5
56 MOVLW 0x1f
57 MOVWF 0x5
58 BCF 0x6,0x4
59 BTFSS 0x6,0x5
60 RETLW 0x1
61 BTFSS 0x6,0x6
62 RETLW 0x2
63 BTFSS 0x6,0x7
64 RETLW 0x3
65 BSF 0x3,0x5
66 MOVLW 0xd0
67 MOVWF 0x6
68 BCF 0x3,0x5
69 BCF 0x6,0x5
70 BTFSS 0x6,0x6
71 RETLW 0x4
72 BTFSS 0x6,0x7
73 RETLW 0x6
74 BSF 0x3,0x5
75 MOVLW 0xb0
76 MOVWF 0x6
77 BCF 0x3,0x5
78 BCF 0x6,0x6
79 BTFSS 0x6,0x7
80 RETLW 0x5
81 GOTO 0x23
82 CALL 0x23
83 MOVWF 0xc
84 BSF 0x3,0x5
85 BSF 0x1,0x7
86 CALL 0x60
87 MOVWF 0x6
88 BCF 0x3,0x5
89 MOVF 0xc,W
90 CALL 0x68
91 ANDWF 0x6,F
92 BCF 0xb,0
93 BSF 0xb,0x7
94 BSF 0xb,0x3
95 SLEEP
96 GOTO 0x8
97 ADDWF 0x2,F
98 NOP
99 RETLW 0xe0
100 RETLW 0xe0
101 RETLW 0xe0
102 RETLW 0xd0
103 RETLW 0xb0
104 RETLW 0xd0
105 ADDWF 0x2,F
106 NOP
107 RETLW 0xef
108 RETLW 0xef
109 RETLW 0xef
110 RETLW 0xdf
111 RETLW 0xbf
112 RETLW 0xdf
113 CLRF 0xc
114 CLRF 0xd
115 MOVLW 0x40
116 MOVWF 0xe
117 DECFSZ 0xc,F
118 GOTO 0x74
119 DECFSZ 0xd,F
120 GOTO 0x74
121 BCF 0x5,0
122 DECFSZ 0xc,F
123 GOTO 0x79
124 DECFSZ 0xe,F
125 GOTO 0x79
126 BSF 0x5,0
127 GOTO 0x8
128 ADDLW 0xff
129 ADDLW 0xff
130 ADDLW 0xff
131 ADDLW 0xff
132 ADDLW 0xff
133 ADDLW 0xff
134 ADDLW 0xff
135 ADDLW 0xff
136 ADDLW 0xff
137 ADDLW 0xff
138 ADDLW 0xff
139 ADDLW 0xff
140 ADDLW 0xff
141 ADDLW 0xff
142 ADDLW 0xff
143 ADDLW 0xff
144 ADDLW 0xff
145 ADDLW 0xff
146 ADDLW 0xff
147 ADDLW 0xff
148 ADDLW 0xff
149 ADDLW 0xff
150 ADDLW 0xff
151 ADDLW 0xff
152 ADDLW 0xff
153 ADDLW 0xff
154 ADDLW 0xff
155 ADDLW 0xff
156 ADDLW 0xff
157 ADDLW 0xff
158 ADDLW 0xff
159 ADDLW 0xff
160 ADDLW 0xff
161 ADDLW 0xff
162 ADDLW 0xff
163 ADDLW 0xff
164 ADDLW 0xff
165 ADDLW 0xff
166 ADDLW 0xff
167 ADDLW 0xff
168 ADDLW 0xff
169 ADDLW 0xff
170 ADDLW 0xff
171 ADDLW 0xff
172 ADDLW 0xff
173 ADDLW 0xff
174 ADDLW 0xff
175 ADDLW 0xff
176 ADDLW 0xff
177 ADDLW 0xff
178 ADDLW 0xff
179 ADDLW 0xff
180 ADDLW 0xff
181 ADDLW 0xff
182 ADDLW 0xff
183 ADDLW 0xff
[/url
Last edited: