• 大小: 1KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-14
  • 语言: 其他
  • 标签: stm32.mp4  

资源简介

播放器主要用处为根据地点定位播放不同的播放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


评论

共有 条评论

相关资源