資源簡介
播放器主要用處為根據地點定位播放不同的播放sd卡中不同類型的音樂,基于UC/OSII,有gps定位、界面顯示、音樂播放、串口任務。

代碼片段和文件信息
??????//4*4鍵盤?單片機:MSP430f149
??????//P5.0-P5.3?行線
??????//P5.4-P5.7?列線
???????
??????//?0123?4567?89AB?CDEF
??????//數據顯示P2.0-P2.3
??????//位選?P2.4-P2.7
#include??
#define?uchar?unsigned?char
#define?uint??unsigned?int
void?InitUART(void);
void?PutString(uchar?*ptr);
uchar?GetKey();
void?Delay1ms(uint);
void?main(void)
{
????????WDTCTL?=?WDTPW?+?WDTHOLD;?????????????????//?Stop?WDT
?????????InitUART();
????????uchar?keydisp;
????????while?(1)
????????{
?????????//?key=‘2‘;
??????????P5DIR=0x00;
??????????key=GetKey();???
???????????if(key>=0x30?&&?key<=0x39)
??????????{?disp=key-0x30;?
????????????Delay1ms(3);
??????????}
??????????if?(key==‘F‘)
??????????{
??????????disp=0xf0;//清零
???????????//break;
??????????continue;
??????????}
????????????Delay1ms(30);????
????????}
???????}
??????uchar?GetKey()
??????{
????????P5DIR=0x0f;//0000?1111
????????P5OUT=0x0e;//掃描第一行?0000?0111
????????_NOP();_NOP();
????????P5DIR?&=0x0f;//讀列
????????if((P5IN?&?0xf0)==?0xe0){?
??????????Delay1ms(3);
??????????if((P5IN?&?0xf0)==?0xe0){
????????????PutString(“0“);return‘0‘;}}
????????if((P5IN?&?0xf0)==?0xd0){?
??????????Delay1ms(3);
??????????if((P5IN?&?0xf0)==?0xd0){?
??????????PutString(“1“);return‘1‘;}}//???
????????if((P5IN?&?0xf0)==?0xb0){
??????????Delay1ms(3);
??????????if((P5IN?&?0xf0)==?0xb0){
??????????PutString(“2“);return‘2‘;}}
????????if((P5IN?&?0xf0)==?0x70){?
??????????Delay1ms(3);
???????????if((P5IN?&?0xf0)==?0x70){?
??????????PutString(“3“);return‘3‘;}}//???
????????_NOP();_NOP();
????????P5DIR=0x0f;//0000?1111
????????P5OUT=0x0d;//掃描第二行?0000?1101
????????_NOP();_NOP();
???????P5DIR?&=0x0f;//讀列
????????if((P5IN?&?0xf0)==?0xe0){?
??????????Delay1ms(3);
???????????if((P5IN?&?0xf0)==?0xe0){?
??????????PutString(“4“);return‘4‘;}}
????????if((P5IN?&?0xf0)==?0xd0){?
??????????Delay1ms(3);
???????????if((P5IN?&?0xf0)==?0xd0){?
??????????PutString(“5“);return‘5‘;}}
????????if((P5IN?&?0xf0)==?0xb0){?
??????????Delay1ms(3);
??????????if((P5IN?&?0xf0)==?0xb0){?
??????????PutString(“6“);return‘6‘;}}
????????if((P5IN?&?0xf0)==?0x70){?
??????????Delay1ms(3);
??????????if((P5IN?&?0xf0)==?0x70){?
??????????PutString(“7“);return‘7‘;}}
????????_NOP();_NOP();
????????P5DIR=0x0f;???
????????P5OUT=0x0b;//掃描第三行??0000?1011
????????_NOP();_NOP();
????????P5DIR?&=0x0f;//讀列
????????if((P5IN?&?0xf0)==?0xe0){
??????????Delay1ms(3);
???????????if((P5IN?&?0xf0)==?0xe0){
??????????PutString(“8“);return‘8‘;}}
????????if((P5IN?&?0xf0)==?0xd0){
??????????Delay1ms(3);
???????????if((P5IN?&?0xf0)==?0xd0){
??????????PutString(“9“);return‘9‘;}}
????????if((P5IN?&?0xf0)==?0xb0){?
??????????Delay1ms(3);
???????????if((P5IN?&?0xf0)==?0xb0){?
??????????PutString(“10“);return‘A‘;}}
????????if((P5IN?&?0xf0)==?0x70){?
??????????Delay1ms(3);
???????????if((P5IN?&?0xf0)==?0x70){?
??????????PutString(“11“);return‘B‘;}}
????????_NOP();_NOP();
????????P5DIR=0x0f;
????????P5OUT=0x07;
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4759??2016-03-04?10:29??main.c
-----------?---------??----------?-----??----
?????????????????4759????????????????????1
- 上一篇:用GDI實現畫直線時的橡皮筋效果
- 下一篇:RevolutionSlider漢化包
評論
共有 條評論