资源描述:
《模块化编程实例》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、三个部分:1111111111111111111111111111111111111111111main.c#include"smg.h"unsignedchartable[]={1,2,3,4,5,6,7,8};voidmain(){while(1){display_table(table);}}222222222222222222222222222222222222222222smg.c#include"smg.h"#include"delay.h"#includeucharcodesmg_du[]={0x3f,
2、0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0x00};ucharcodesmg_we[]={0x04,0x08,0x0c,0x10,0x14,0x18,0x1c,0x1c};voiddisplay_table(uchar*p){uchari;for(i=0;i<8;i++){P1=smg_du[*p];p++;P2=smg_we[i];delay_50us(20);}}smg.h#ifndef__SMG_H__#define__
3、SMG_H__#include"delay.h"voiddisplay_table(uchar*p);//数组显示voiddisplay(ucharnum0,ucharnum1,ucharnum2,ucharnum3,ucharnum4,ucharnum5,ucharnum6,ucharnum7);#endif333333333333333333333333333333333333333333333333333delay.c#include"delay.h"voiddelay_50us(uintt){unsignedinti;whil
4、e(t--){for(i=19;i>0;i--);}}voiddelay_50ms(uintt){uinti;for(;t>0;t--)for(i=6245;i>0;i--);}delay.h#ifndef__DELAY_H__#define__DELAY_H__#defineucharunsignedchar#defineuintunsignedintvoiddelay_50us(uintt);voiddelay_50ms(uintt);#endif