小编前几天查资料,怎么使用12864屏幕的用法,突然发觉微博是个好东西,随着自己的成长,学习了很多的知识,没有做笔记的习惯,只是习惯把用到的硬件,传感器,资料写到程序的备注内,但感觉,用到时不是那么方便,同时也算是,记录自己的学习,分享学习经验和过程,一起和大家共勉。
前段时间,一直在研究51单片机PWM的用法,但由于51单片机内部资源限制,只能输出两路PWM(P1.3和P1.4),而我想用单片机控制RGB三色灯混出不同的颜色,所以,只靠51的两路输出PWM不能达到要求,由于,只是调光,所以对于PWM的精度要求并不高,随即,想到用软件程序来模拟三路PWM的输出,经过一段时间的研究借鉴和编写网上大佬的程序,可以实现三原色的互相混合,程序中又加入了自动调色和手动调色,通电后,默认是自动变色,从绿色起步开始渐变,直至下一个绿色为一个渐变循环;手动调色功能我是用水银开关来实现,当想要手动调色固定一个颜色时,只需把三色灯倾斜,此时即进入手动调色功能,当颜色渐变到想要的颜色时,摆正三色灯即可,把颜色固定下来,不会再变化,如若,又想让它自动变色,只需晃动下三色灯即可,进入自动渐变颜色的模式。可能是自己刚入门把,可能程序有些晦涩和繁杂,但后面都有我很多的备注。
2017-10-25
by: L H
先附上几张图片,外表亚克力图案用的是学校激光雕刻机雕刻的,嘻嘻
1 /*
2
3 程序完结于:2017.10.22
4 by:LH
5 QQ:1336294189,可技术交流
6
7 功能:三色(R,G,B)可自动渐变,也可手动调至喜欢颜色,保持颜色.
8
9 此程序仅供娱乐制作,不可投入商用!!,初入51,大神看后勿喷,谢谢
10
11
12
13
14 /*
15 _ooOoo_
16 o8888888o
17 88" . "88
18 (| -_- |)
19 O\ = /O
20 ____/`---'\____
21 .' \\| |// `.
22 / \\||| : |||// \
23 / _||||| -:- |||||- \
24 | | \\\ - /// | |
25 | \_| ''\---/'' | |
26 \ .-\__ `-` ___/-. /
27 ___`. .' /--.--\ `. . __
28 ."" '< `.___\_<|>_/___.' >'"".
29 | | : `- \`.;`\ _ /`;.`/ - ` : | |
30 \ \ `-. \_ __\ /__ _/ .-` / /
31 ======`-.____`-.___\_____/___.-`____.-'======
32 `=---='
33 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
34 佛祖保佑 永无BUG
35 */
36
37
38 /*
39
40
41
42 STC15F104W重点介绍:
43
44 (1) 定时器模块:T0(中断标号 interrupt 1)和T2(中断标号 interrupt 12 ),T0工作在方式0时是16位可自动重装初始值的定时计数器,方式2时是8位自动重装的计数器,方式3时是可分解的;T2的工作模式固定在16位自动重装初始值模式,故特别适应到LED行业,该芯片的定时器模块可产生更高精度的定时时间。
45 (2) 内核:采用Y5超高速CPU内核,比普通1T还快20%,详情见指令集。共111条指令。
46 (3) 管脚图:
47 |--------|
48 MCLKO/!INT2/T0/RST/P3.4--|1 8|--P3.3/INT1/RSTOUT_LOW
49 VCC--|2 7|--P3.2/INT0
50 !INT3/T0CLKO/P3.5--|3 6|--P3.1/T2
51 GND--|4 5|--P3.0/!INT4/T2CLKO
52 |---------
53
54 (4) P3.3是RSTOUT_LOW,上电和复位后输出低电平,也可由软件设置低或高电平,该管脚可以作为16位或32位单片机的复位电路使用;P3.4可以输出系统时钟,故可以作为16位或32位单片机的的时钟电路;该芯片还有很强的加密功能,可取代加密芯片,单价只有一块多,故可以推荐给客户。
55 STC15F104W无串口,具有中继广播方式,可以软件模拟I2C、串口、SPI、利用IO口充放电测量外部电压实现AD功能。
56 可在下载软件中设置P3.1直通输出P3.0的输入电平,类似15系列串口1的中继广播方式。
57 STC15W104SW——DIP/SOP16,在性能和价格上都优于STC11F04E,故,可以替代STC11系列和89C4051等芯片,重点推荐给LED行业
58
59 (5) STC15F104W的外部中断可以用,而且多一个掉电唤醒专用定时器。
60 */
61
62
63
64 #include <STC15F2K60S2.H>//STC15F104W DIP-8型单片机,比STC12C5A60S2 1T 单片机快 20%
65 #define uchar unsigned char
66 #define uint unsigned int
67 unsigned char pwm_data_R,pwm_data_G,pwm_data_B,pwm_r,pwm_g,pwm_b;
68 sbit PWM_R=P3^4;
69 sbit PWM_G=P3^2;
70 sbit PWM_B=P3^3;
71
72 sbit k1=P3^5;
73
74 unsigned int count4=0; //自动变色快慢控制
75 unsigned int count5=0; //自动颜色循环值
76 unsigned int count6=0; //手动颜色循环值
77 unsigned int count7=0; //手动变色快慢控制
78 unsigned int count8=0; //手动调节变色色表快慢控制位
79 unsigned int count9=0; //手动调节变色色表种类值
80 unsigned int add=0; //自动OR手动调节控制位 add=0 自动调色; add=1 受冻调色控制位
81 unsigned char flag=0; //按键防抖控制位
82 unsigned char flag1=0; //手动调节变色至自动变色的色值时,flag1=1;继续手动调色,则进入 色表 CO[] 颜色设定
83
84 unsigned char CO[][3]= { //三基色混色数据表
85 {220,250,0},//黄色 0
86 // {222,202,85},//香蕉色 1
87 {250,149,17},//铬黄 2
88 // {230,139,83},//dougello 3
89 // {250,222,129},//froum gold 4
90 {250,210,0},//金黄色 5
91 // {213,161,102},//黄花色 6
92 // {222,164,99},//瓜色 7
93 {232,142,32},//胡萝卜色 8
94 {125,41,41},//棕色 9
95 // {250,122,62},//肉色 10
96 {235,225,137}, //黄褐色 11
97 // {184,140,140}, //玫瑰红 12
98
99 {59,87,167}, //钴色 13
100 // {2,164,154}, //锰蓝色 14
101 {49,157,196}, //孔雀蓝 15
102 // {0,195,137}, //土耳其玉色 16
103 // {63,102,250}, //品蓝 17
104 // {103,88,200}, //石板蓝 18
105 {0,250,250}, //青色 19
106
107 // {132,201,230}, //天蓝色 20
108 {7,45,82}, //靛青 21
109 // {62,219,203}, //青绿色 22
110 {124,250,0}, //黄绿色 23
111 {0,196,85}, //翠绿色 24
112 // {185,246,196}, //薄荷绿 25
113 {156,31,235}, //紫色 26
114 // {149,46,245}, //湖紫色 27
115 // {213,109,209}, //淡紫色 28
116 // {216,156,216} //梅红色 29
117
118 };
119
120
121
122 void Init (void) //中断初始化 //内部时钟 12M晶振
123 {
124 TMOD = 0x00; //(不可位寻址)设定定时器 T0 工作方式 0(16位自动重装定时器)
125 TH0=(65536-5000)/256; //装T0高位初值 /定时器周期为500US(频率2K) (做PWM频率)
126 TL0=(65536-5000)%256; //装T0低位初值
127 ET0=1; //(可位寻址)T0的溢出中断允许控制位,ET0=1允许T0中断; ET0=0禁止T0中断;
128 TR0=1; //(可位寻址)允许定时器T0运行
129 EA=1; //(可位寻址)开启总中断
130
131 T2H=(65536-20)/256; //装T2高位初值
132 T2L=(65536-20)%256; //装T2低位初值 定时器周期为2US(频率500K) (做PWM宽度调)
133 AUXR=0X94; //辅助寄存器开启定时器T2,启动定时器T2,配置T0,T2时钟为 1T模式 (比STC15C5A 1T 模式快 20%)
134 IE2=0X04; //IE2(不可位寻址):定时器T2\T3\T4中断控制寄存器(控制定时器T2中断允许) ET2=0:禁止定时器T2产生中断 ET2=1:允许定时器T2产生中断
135
136
137 }
138 void timer0(void) interrupt 1 //***********定时器T0中断子函数************** (做PWM频率)
139 {
140 PWM_R=1;
141 PWM_G=1;
142 PWM_B=1;
143 pwm_r=0;
144 pwm_g=0;
145 pwm_b=0;
146
147
148 if(k1==0)
149 {
150 if((k1==0)&&(flag==0)) //短按键识别切换;add=0切换自动变色,add=1长按手动调色,调制理想色时,松手即可
151 {
152 add++;
153 flag=1;
154 if(add==2) add=0;
155 }
156 } else flag=0;
157
158 if(add==0)
159 {
160 count4++; //自动变色快慢
161 if(count4==80)
162 {
163 count4=0;
164 count5++;
165 if(count5==3500) //自动颜色循环值
166 count5=0;
167 }
168 }
169
170 if(add==1)
171 {
172 if((k1==0)&&(flag==1))
173 {
174 count7++;
175 if(count7==60) //手动调节变色快慢
176 {
177 count7=0;
178 count6++;
179 }
180 if(count6>=3500)
181 {
182 count6=3500; //手动颜色循环值
183 flag1=1; //flag1=1,时变换颜色为上面色表中的颜色
184 }
185 else flag1=0; //flag1=0,时自动变换颜色
186
187 if(flag1==1)
188 {
189 count8++;
190 if(count8==3000) //手动调节变色色表快慢控制位
191 {
192 count9++;
193 count8=0;
194 if(count9==13) //手动调节变色色表种类值
195 {
196 count9=0;
197 count6=0;
198 }
199 }
200 }
201 }
202 }
203 }
204
205 void timer1(void) interrupt 12 //***********定时器T2中断子函数************** (做PWM宽度调)
206 {
207
208 if(pwm_r<pwm_data_R) pwm_r++;
209 else PWM_R=0;
210
211
212 if(pwm_g<pwm_data_G) pwm_g++;
213 else PWM_G=0;
214
215
216 if(pwm_b<pwm_data_B) pwm_b++;
217 else PWM_B=0;
218
219 }
220
221 void jianbianRGB(unsigned int count3) //颜色渐变
222 {
223
224
225 if(count3>=0&&count3<250) //绿变亮 G++
226 {
227 pwm_data_G=count3;
228 pwm_data_R=0;
229 pwm_data_B=0;
230 }
231 else if(count3>=250&&count3<500) /// R++
232 {
233 pwm_data_R=count3-250;
234 pwm_data_G=250;
235 pwm_data_B=0;
236
237 }
238
239 else if(count3>=500&&count3<750) //B++
240 {
241 pwm_data_R=250; //max 250
242 pwm_data_G=250;
243 pwm_data_B=count3-500;
244 }
245
246 else if(count3>=750&&count3<1000) // G--
247 {
248 pwm_data_R=250; //max 250
249 pwm_data_G=750-count3;
250 pwm_data_B=250;
251 }
252 else if(count3>=1000&&count3<1250) //B--
253 {
254 pwm_data_R=250;
255 pwm_data_G=0;
256 pwm_data_B=1250-count3;
257 }
258
259
260 else if(count3>=1250&&count3<1500) /// R--
261 {
262 pwm_data_R=1500-count3;
263 pwm_data_G=0;
264 pwm_data_B=0;
265 }
266
267
268 else if(count3>=1500&&count3<1750)
269 {
270 pwm_data_R=0;
271 pwm_data_G=0;
272 pwm_data_B=count3-1500; //B++
273 }
274
275 else if(count3>=1750&&count3<2000)
276 {
277 pwm_data_R=0;
278 pwm_data_G=count3-1750; //绿变亮 G++
279 pwm_data_B=250;
280 }
281
282 else if(count3>=2000&&count3<2250) /// R++
283 {
284 pwm_data_R=count3-2000;
285 pwm_data_G=250;
286 pwm_data_B=250;
287
288 }
289
290 else if(count3>=2250&&count3<2500)
291 {
292 pwm_data_R=2500-count3; /// R--
293 pwm_data_G=2500-count3; // G--
294 pwm_data_B=2500-count3; //B--
295 }
296
297 else if(count3>=2500&&count3<2750)
298 { /// R++
299 pwm_data_R=count3-2500; //max 250
300 pwm_data_G=0;
301 pwm_data_B=0;
302 }
303
304 else if(count3>=2750&&count3<3000) //B++
305 {
306 pwm_data_R=250;
307 pwm_data_G=0;
308 pwm_data_B=count3-2750;
309 }
310
311
312 else if(count3>=3000&&count3<3250) //G++
313 {
314 pwm_data_R=250;
315 pwm_data_G=count3-3000;
316 pwm_data_B=250;
317 }
318
319 else if(count3>=3250&&count3<3500)
320 {
321 pwm_data_R=3500-count3; /// R--
322 pwm_data_G=3500-count3; // G--
323 pwm_data_B=3500-count3; //B--
324 }
325 }
326
327
328 void scankey()
329 {
330 switch(add)
331 {
332 case 0: jianbianRGB(count5);
333 count6=0;
334 break;
335 case 1: if(flag1==0) //自动渐变颜色
336 {
337 jianbianRGB(count6);
338 }
339 else //自定义颜色色表
340 {
341 pwm_data_R=CO[count9][0];
342 pwm_data_G=CO[count9][1];
343 pwm_data_B=CO[count9][2];
344 }
345 count5=0;
346 break;
347 default : jianbianRGB(count5); break;
348 }
349
350 }
351
352
353
354 //●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●//
355 void main()
356 {
357 // P3M1=0X00; //P3口设置为推挽模式,提高灯的亮度
358 // P1M0=0X38;
359 PWM_R=0; //max 250
360 PWM_G=0;
361 PWM_B=0;
362 Init();
363 while(1) //主循环
364 {
365 scankey();
366 // PWM_R=1;
367 // PWM_G=0;
368 // PWM_B=0;
369
370 }
371 }
372
373 /*
374 MMMMM
375 MMMMMM
376 MMMMMMM
377 MMMMMMMM .
378 MMMMMMMMM
379 HMMMMMMMMMM
380 MMMMMMMMMMMM M
381 MMMMMMMMMMMMM M
382 MMMMMMMMMMMMM M
383 MMMMMMMMMMMMM:
384 oMMMMMMMMMMMMMM
385 .MMMMMMMMMMMMMMo MMMMMMMMMMMMMMM M
386 MMMMMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMM
387 MMMMMMMMMMMMMMMMMMMMMMMMMMMM. oMMMMMMMMMMMMMMM.M
388 MMMMMMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMM
389 MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
390 oMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
391 MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
392 MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM: H
393 MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM . MMM
394 MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM M MMMMMM
395 .MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM M MMMMMMMMMM
396 MM. MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM M MMMMMMMMMMMM
397 MM MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM .MMMMMMMMMMMMMM
398 MM MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
399 MM MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
400 .MMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMM.MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
401 HMMMMMMMMMMMMMMMMMMMMM.MMMMMMMMM.MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
402 MMMMMMMMMMMMMMM MMM.oMMMMMMM..MMMMMMMMM:MMMMMMMMMMMMMMMMMMMMMMM
403 MMMMMMMMMMMMMM MM..MMMMMMM...MMMMMMM. MMMMMMMMMMMMMMMMMMMMM
404 MMMMMMMMMMMMMMM ..MMMMMM...MMMMMM ..MMMMMMMMMMMMMMMMMMM
405 MMMMMMM:M.MMM.M.. MMMMM M..MMMMM...MMMMMMMMMMMMMMMMMM MMM
406 MMMM. .M..MM.M...MMMMMM..MMMMM.. MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM .
407 MMMM..M....M.....:MMM .MMMMMM..MMMMMMM...MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
408 MMM.M.. ...M......MM.MMMMM.......MHM.M .MMMMMMMMMMMMMMMMMMMMMMMMM
409 MMMMMMMM..MM. . MMM.....MMMMMM.M.....M ..MM..M MMMMMMMMMMMMMMMMMMM
410 .MMMMMHMM. ..MMMM. MMM............o..... . .MMMMMMMMMMMMMMM
411 MMM. M... .........................M..:.MMMMMMMMMMMM
412 oMMM............ .................M.M.MMMMMMMMM
413 .....MM........................ . MMMMMM
414 M.....M.....................o.MM.MMMMMMMM.
415 M........................M.. ...MMMMMMMMMMMMMo
416 :....MMM..............MMM..oMMMMMMM
417 M...MMM.............MMMMMMM
418 .............:MMMMMMMM
419 M..... MMM.....M
420 M M.............
421 ................M
422 ooM.................MM MoMMMMMoooM
423 MMoooM......................MoooooooH..oMM
424 MHooooMoM.....................MMooooooM........M
425 oooooooMoooM......... o........MoooooooM............
426 Mooooooooooo.......M.........Moooooooo:..............M
427 MooMoooooooooM...M........:Mooooooooooo:..............M
428 M..oooooooooooo .........Mooooooooooooooo..............M
429 M...Mooo:oooooooo.M....ooooooooooooooooooo..M...........M
430 ...oooooMoooooooM..Mooooooooooooo:oooooooM.M...........M.
431 M...ooooooMoo:ooooMoooooooooooooHoooooooooH:M. ...........:
432 M..MoooooooMoooooooooooooooooo:ooooooMooooMoM..............M
433 M..ooooooooooMooooooooooooooHoooooooMooHooooM...............M
434 ...ooooooooooooooooooo:MooooooooooooooMoMoooM................
435 M...oooooooooooooooooooooooooooooooooooooMooMM................M
436 ...MooooooooooooooooooooooooooooooooooooooooMo ................
437 ...MooooooooooooooooooooooooooooooooooooooooM M................M
438 M...ooooooooooooooooooooooooooooooooooooooooM ................M
439 ...MoooooooooooooooooooooooooooooooooooooooMM .:...............
440 .....MooooooooooooooooooooooooooooooooooooMoo .............M
441 M...... ooooooooooooooooooooooooooooooooooooM M..............M
442 M........MooooMMM MM MM MMMMMMMMMooooooooM M...............M
443 .........HM M: MM :MMMMMM M M...............
444 M..........M M MoM M M................M
445 M.........:M MoH M M M MooooHoooMM. M M...............M
446 M..........Moooo MMooM oooooMooooooooM M..............H
447 M.........MooooM Mooo : ooooooMooooMoooM M........ . .o.M
448 H.. .....ooooo oooo M MooooooooooooooM M... MMMMMMMMMMM
449 MMMMMMMMMMooooM M oooo . ooooooMooooooooM .MMMMMMMMMMMMMMM
450 MMMMMMMMMMooooH : ooooH oooooooooooooooo MMMMMMMMMMMMMMM
451 MMMMMMMMMMoooo ooooM Moooooooooooooooo .MMMMMMMMMMMMMMM
452 MMMMMMMMMMoooo ooooM MooooooooooooooooM MMMMMMMMMMMMMMM
453 MMMMMMMMMMoooM ooooM ooooooooooooooooo MMMMMMMMMMM:M
454 MMMMMMMMMMoooM MooooM oooooooooooMoooooo MH...........
455 . ......Mooo. MooooM oooooooooooooooooo M............M
456 M.M......oooo MooooM Moooooooooooooooooo: .........M.....
457 M.M.....Moooo MooooM ooooooooooooooooooM .M............
458 .......MooooH MooooM oooooooooMoooooooooo M..o...M..o....M
459 .o....HMooooM MooooH MooooooooMooooooooooM .:M...M.......M
460 M..M.....MoooM :oooo: .MooooooooHooMoooooooooM M M... ..oM.M
461 M...M.:.Mooo. MMMMooooo oooooooooooMoooooooooooooM ....M. M
462 M:M..o.Moooooooooooooo MooooooooooooooMooooooooooooM .Mo
463 MooooooooooooooMooooooooooooMoMoooooooooooooo
464 Mooooooooooooooo:ooooooooooooooooooooooooooooo
465 ooooooooooooooooMooooooooooMoooooooooooooooooo
466 ooooooooooooooooMoooooooooooMooooooooooooooooHo
467 ooMooooooooooooooMoooooooooooooooooooooooooooMoM
468 MooMoooooooooooooo.ooooooooooooooooooooooooooo:oM
469 MoooooooooooooooooooooooooooooooooooooooooooooooM
470 MoooMooooooooooooooMooooooooooooooooooooooooooooo.
471 MoooMooooooooooooooMoooooooooooooooooooooooooMooooM
472 MooooooooooooooooooMoooooooooooooooooooooooooMoooooM
473 MooooMoooooooooooooMoooooooooooooooooooooooooMoHooooM
474 ooooooMooooooooooooooooooooooooooooooooooooooooMoMoooM
475 MooooooooooooooooooooMooooooooooooooooooooooooooMoooooH:
476 MoooooooMooooooooooooMoooooooooooooooooooooooooooooHoooM
477 MooooooooMoooooooooooMoooooooooooooooooooooooooMoooMooooM
478 Moooooooooooooooooooooooooooooooooooooooooooooo.oooMooooo
479 MoooooooooooooooooooooooooooooooooooooooooooooMoooooooooM
480 MooooooooooooooooooooMoooooooooooooooooooooooooooooooooM
481 MooooooooooooooooooooMHooooooooooooooooooooMoooo:ooooo
482 MMooooooooooooooooooMoMHoooooooooooooooooooooooMooooo
483 MMoooooooooooooooMMooo MMooooooooooooooooooooooooooM
484 MMMoooooooooooooMooooo oooooooooooooooooooooMooooo
485 MooMMoooooooooMoooMMoM ooooHooooooooooooooooMooooM
486 MooooMooooooMooooMoooM MoooooMoooooooooooooMooooo
487 ooooooMMooooooooMooooM MoooooooooMooooooooooooooM
488 HooooooMoooooooMooooM HoooooooHooMooooooooooooo
489 oooMoooooooooHoooM MoooooooooMoooooooooM
490 HooooooooooooHM MooooooooMMoooooooM
491 MMMMMMMMMMMMMM Moooooo:MooooHMM
492 MMMMMMM: ... MMMMMMMMMMMMMM
493 M............M MMMMMMMMM ....
494 M.MM.......... M.............M
495 M ..............MM M..............
496 MMMMM............MMMM ..MMMMMMMM ....M
497 MMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMM...M
498 .MMMMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMM
499 MMMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMM
500 :MMMMMMMMMMMMMMMMMMH MMMMMMMMMMMMMMMMMMM
501 By EBEN Jér?me MMMMMMMMMMMMMMMMMM
502 MMMMMMMMMMMMMMM
503 HMMMMMM
504
505 */