你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

查看: 3065|回复: 29

STM32L073 Nucleo 晒单

[复制链接]

10

主题

124

回帖

0

蝴蝶豆

金牌会员

最后登录
2020-3-5
发表于 2016-3-28 11:31:40 | 显示全部楼层 |阅读模式
本帖最后由 我的颈 于 2016-3-28 12:58 编辑

板子到手了,正在使用中,给我的方案加了一块12864(嘿嘿嘿)做为调试输出

直接用热熔胶粘,建行的网银盾的LCD12864,嘿嘿嘿.
没钱买屏幕只能自己搞了.一块12864也不便宜

IMG_20160328_111705.jpg
IMG_20160328_111715.jpg
IMG_20160328_111739.jpg
IMG_20160328_112730.jpg
IMG_20160328_112719.jpg 上几张分析引脚的图

2016-03-27 (11).jpeg
2016-03-27 (13).jpeg
2016-03-27 (14).jpeg
2016-03-27 (16).jpeg
2016-03-27 (15).jpeg
分析仪抓包喽

CLK.png
CS.png
D-C.png
reset.png

代码在附件 哈哈
main
  1. int main(void)
  2. {
  3.    uint8_t Count=0;
  4.    HAL_Init();
  5.    SystemClock_Config();

  6.   // BSP_LED_Init(LED2);


  7.    SPI_Conf();
  8.    GPIO_Conf();   
  9.    LCD_Conf();
  10.    LCD_Str(LINE1,10,"www.stmcu.org.cn");
  11.    LCD_Str(LINE2,10,"827230081");
  12.    LCD_Str(LINE3,0,"Please press ");
  13.    LCD_Str(LINE4,0,"the button!");
  14.    HAL_Delay(1000);
  15.    Sensor_Conf();
  16.    BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO);
  17.    Sensor_Conf();
  18.    while (BSP_PB_GetState(BUTTON_KEY) != GPIO_PIN_RESET);
  19.    LCD_Clear(0);
  20.    LCD_Str(LINE1,10,"Start!");
  21. //   {
  22. //      BSP_LED_Toggle(LED2);
  23. //      Sensor_Conf
  24. //      
  25. //      
  26. //   }
  27.    //BSP_LED_Off(LED2);

  28.    while (1)
  29.    {
  30.      if(SENSOR==SET)
  31.      {
  32.          HAL_Delay(100);
  33.          if(SENSOR==SET)
  34.          {
  35.             LCD_Str(LINE2,10,"Trigger!");
  36.             Count++;         
  37.             //HAL_GPIO_WritePin(GPIOA,GPIO_PIN_4,GPIO_PIN_SET );
  38.          }  
  39.      }
  40.    else
  41.    {
  42.       LCD_Str(LINE2,10,"           ");
  43.       //HAL_GPIO_WritePin(GPIOA,GPIO_PIN_4,GPIO_PIN_RESET );
  44.    }
  45.      HAL_Delay(1000);
  46.    if(Count>10)
  47.    {
  48.       HAL_GPIO_WritePin(GPIOA,GPIO_PIN_4,GPIO_PIN_SET );
  49.       LCD_Str(LINE3,10,"BEE!");
  50.       HAL_Delay(1000);
  51.       Count=0;
  52.    }
  53.    else
  54.    {
  55.       HAL_GPIO_WritePin(GPIOA,GPIO_PIN_4,GPIO_PIN_RESET );
  56.       LCD_Str(LINE3,10,"    ");
  57.    }

  58.    
  59.       
  60.    }//end while
  61.    
  62. }//end main
复制代码
12864.c
  1. #include "12864.h"
  2. #include "main.h"

  3. int delay=0;

  4. #define DELAY {delay=0x5f;while(delay--);}                                                                                                                //ÑÓʱ

  5.                                    //81 //
  6. const char CMD[13]={0xAE,0x2F,0x22,0x81,0x3F,0xA2,0xA1,0xC0,0x10,0x00,0xB0,0xA6,0xAF};//²âÊÔÃüÁî•ÖÎöÒÇ×¥µÄ,²»¹ÜËûÖ±½ÓÓÃ

  7. /*×Ö¿â   È¡Ä£•½Ê½ ÒõÂë ÁÐÐÐʽ*/
  8. const char String[95][16]={
  9. {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
  10. {0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00},/*"!",1*/
  11. {0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*""",2*/
  12. {0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00},/*"#",3*/
  13. {0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00},/*"$",4*/
  14. {0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00},/*"%",5*/
  15. {0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10},/*"&",6*/
  16. {0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"'",7*/
  17. {0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00},/*"(",8*/
  18. {0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00},/*")",9*/
  19. {0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00},/*"*",10*/
  20. {0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00},/*"+",11*/
  21. {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00},/*",",12*/
  22. {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01},/*"-",13*/
  23. {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00},/*".",14*/
  24. {0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00},/*"/",15*/
  25. {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00},/*"0",16*/
  26. {0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},/*"1",17*/
  27. {0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00},/*"2",18*/
  28. {0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00},/*"3",19*/
  29. {0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00},/*"4",20*/
  30. {0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00},/*"5",21*/
  31. {0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00},/*"6",22*/
  32. {0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00},/*"7",23*/
  33. {0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00},/*"8",24*/
  34. {0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00},/*"9",25*/
  35. {0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00},/*":",26*/
  36. {0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00},/*";",27*/
  37. {0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00},/*"<",28*/
  38. {0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00},/*"=",29*/
  39. {0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00},/*">",30*/
  40. {0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00},/*"?",31*/
  41. {0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00},/*"@",32*/
  42. {0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20},/*"A",33*/
  43. {0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00},/*"B",34*/
  44. {0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00},/*"C",35*/
  45. {0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00},/*"D",36*/
  46. {0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00},/*"E",37*/
  47. {0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00},/*"F",38*/
  48. {0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00},/*"G",39*/
  49. {0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20},/*"H",40*/
  50. {0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},/*"I",41*/
  51. {0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00},/*"J",42*/
  52. {0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00},/*"K",43*/
  53. {0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00},/*"L",44*/
  54. {0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00},/*"M",45*/
  55. {0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00},/*"N",46*/
  56. {0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00},/*"O",47*/
  57. {0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00},/*"P",48*/
  58. {0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00},/*"Q",49*/
  59. {0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20},/*"R",50*/
  60. {0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00},/*"S",51*/
  61. {0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00},/*"T",52*/
  62. {0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00},/*"U",53*/
  63. {0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00},/*"V",54*/
  64. {0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00},/*"W",55*/
  65. {0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20},/*"X",56*/
  66. {0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00},/*"Y",57*/
  67. {0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00},/*"Z",58*/
  68. {0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00},/*"[",59*/
  69. {0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00},/*"",60*/
  70. {0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00},/*"]",61*/
  71. {0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"^",62*/
  72. {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80},/*"_",63*/
  73. {0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"`",64*/
  74. {0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20},/*"a",65*/
  75. {0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00},/*"b",66*/
  76. {0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00},/*"c",67*/
  77. {0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20},/*"d",68*/
  78. {0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00},/*"e",69*/
  79. {0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},/*"f",70*/
  80. {0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00},/*"g",71*/
  81. {0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20},/*"h",72*/
  82. {0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},/*"i",73*/
  83. {0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00},/*"j",74*/
  84. {0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00},/*"k",75*/
  85. {0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},/*"l",76*/
  86. {0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F},/*"m",77*/
  87. {0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20},/*"n",78*/
  88. {0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00},/*"o",79*/
  89. {0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00},/*"p",80*/
  90. {0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80},/*"q",81*/
  91. {0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00},/*"r",82*/
  92. {0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00},/*"s",83*/
  93. {0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00},/*"t",84*/
  94. {0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20},/*"u",85*/
  95. {0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00},/*"v",86*/
  96. {0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00},/*"w",87*/
  97. {0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00},/*"x",88*/
  98. {0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00},/*"y",89*/
  99. {0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00},/*"z",90*/
  100. {0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40},/*"{",91*/
  101. {0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00},/*"|",92*/
  102. {0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00},/*"}",93*/
  103. {0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"~",94*/

  104. };
  105. void SPI_Conf(void)                        //SPIÅäÖò»¶à˵  
  106. {
  107.    SPI_HandleTypeDef SpiHandle;
  108.    
  109.    SpiHandle.Instance               = SPI1;
  110.    SpiHandle.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
  111.    SpiHandle.Init.Direction         = SPI_DIRECTION_2LINES;
  112.    SpiHandle.Init.CLKPhase          = SPI_PHASE_1EDGE;
  113.    SpiHandle.Init.CLKPolarity       = SPI_POLARITY_LOW;
  114.    SpiHandle.Init.DataSize          = SPI_DATASIZE_8BIT;
  115.    SpiHandle.Init.FirstBit          = SPI_FIRSTBIT_MSB;
  116.    SpiHandle.Init.TIMode            = SPI_TIMODE_DISABLE;
  117.    SpiHandle.Init.CRCCalculation    = SPI_CRCCALCULATION_DISABLE;
  118.    SpiHandle.Init.CRCPolynomial     = 7;
  119.    SpiHandle.Init.NSS               = SPI_NSS_SOFT;
  120.    SpiHandle.Init.Mode              = SPI_MODE_MASTER;
  121.    
  122.    HAL_SPI_Init(&SpiHandle);
  123.    SPI1->CR1   |=1<<6;                                //ʹÄÜ

  124. }
  125. void SPI_SendByte(char  temp)//²»¶à˵
  126. {
  127.    while(!((SPI1->SR>>1)&0x01));
  128.    SPI1->DR=temp;
  129. }



  130. void GPIO_Conf(void)
  131. {
  132.    
  133.    GPIO_InitTypeDef GPIO_InitStruct;


  134.    RCC->IOPENR    |=1<<1;   
  135.    
  136.    GPIO_InitStruct.Mode             =GPIO_MODE_OUTPUT_PP;
  137.    GPIO_InitStruct.Pull             =GPIO_PULLUP;
  138.    GPIO_InitStruct.Speed            =GPIO_SPEED_FREQ_HIGH;
  139.    GPIO_InitStruct.Pin              =GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_6;  //GPIO   RST D/C CS
  140.    HAL_GPIO_Init(GPIOB,&GPIO_InitStruct);


  141. }


  142. void LCD_Conf(void)
  143. {
  144.    RST_H;
  145.    CS_H;
  146.    DC_H;
  147.    HAL_Delay(50);
  148.    RST_L;
  149.    HAL_Delay(5);
  150.    RST_H;
  151.    HAL_Delay(5);
  152.    CS_L;
  153.    LCD_CMD(CMD);
  154.    HAL_Delay(2);
  155.    LCD_Clear(0xFF);
  156.    HAL_Delay(2);
  157.    LCD_Clear(0);
  158.    //LCD_SetPoint(LINE1 ,0);
  159.    //LCD_Display(LINE1,10,'1');
  160.    
  161.    
  162. }

  163. /*

  164. */
  165. void LCD_SetPoint(unsigned char line,unsigned char row)
  166. {
  167.    unsigned char tmp=0;
  168.    DC_L;  
  169.    DELAY
  170.    SPI_SendByte(line);                //ÐÐ0xB0
  171.    tmp=0x10+ ((row&0xF0)>>4);//
  172.    SPI_SendByte(tmp);
  173.    tmp=0x04+ (row&0x0F);
  174.    SPI_SendByte(tmp);
  175.    DELAY
  176.    DC_H;   
  177. }
  178. void LCD_DAT(char list,char num)
  179. {
  180.   unsigned char i=0;
  181.    DC_H;   
  182.    for(i=num;i<(num+8);i++)
  183.    {
  184.       SPI_SendByte((char )String[list][i]);
  185.    }
  186. }

  187. void LCD_Clear(char dat)
  188. {
  189.    unsigned char i=0,dummy=0;
  190.    //   LCD_SetPoint(LINE1,0);
  191.    DC_H;
  192.    DELAY
  193.    for(dummy=0;dummy<8;dummy++)
  194.    {
  195.       DC_L;
  196.       DELAY      
  197.       SPI_SendByte(dummy+0xB0);
  198.       SPI_SendByte(0x10);
  199.       SPI_SendByte(0x04);
  200.       HAL_Delay(1);
  201.       DC_H;   
  202.       for(i=0;i<128;i++)
  203.       {
  204.          SPI_SendByte(dat);
  205. //         HAL_Delay(10);
  206.       }
  207.    }
  208. }
  209. void LCD_CMD(const  char * temp)
  210. {
  211.    unsigned char i=0;
  212.    int dummy=0;
  213.    DC_L;  

  214.    for(i=0;i<13;i++)
  215.    {
  216.       SPI_SendByte(temp[i]);
  217.       dummy=0x3FF;
  218.       while(dummy--);
  219.    }
  220.    
  221.    DC_H;   
  222. }








  223. /**********--------------------------***********************/

  224. void LCD_Str(unsigned char line,unsigned char row,const char* p)
  225. {
  226.    char i=0;
  227.    i=row;
  228.    while(*p!='\0')
  229.    {
  230.       i+=8;
  231.       LCD_Display(line,i,*p);
  232.       p++;
  233.    }
  234. }
  235. void LCD_Display(unsigned char line,unsigned char row,char temp)
  236. {
  237.    
  238.    unsigned char i=0;
  239.    if((temp-0x20)<0)
  240.       return ;
  241.    LCD_SetPoint(line,row);
  242.    DC_H;   
  243.    for(i=0;i<8;i++)
  244.    {
  245.       SPI_SendByte(String[temp-0x20][i]);
  246.    }
  247.    LCD_SetPoint(line+1,row);
  248.    DC_H;   
  249.    for(i=8;i<16;i++)
  250.    {
  251.       SPI_SendByte(String[temp-0x20][i]);
  252.    }
  253.    

  254. }
复制代码

Src.rar (4.52 KB, 下载次数: 11)
回复

使用道具 举报

31

主题

1951

回帖

0

蝴蝶豆

论坛元老

最后登录
2020-12-4
发表于 2016-3-28 12:02:46 | 显示全部楼层
楼主晒晒代码呗
回复 支持 反对

使用道具 举报

18

主题

668

回帖

0

蝴蝶豆

金牌会员

最后登录
2017-4-9
发表于 2016-3-28 12:17:00 | 显示全部楼层
好像很不错啊
回复 支持 反对

使用道具 举报

1

主题

629

回帖

0

蝴蝶豆

金牌会员

最后登录
2020-3-7
发表于 2016-3-28 12:24:43 | 显示全部楼层
nice!!! 谢谢分享
回复 支持 反对

使用道具 举报

10

主题

124

回帖

0

蝴蝶豆

金牌会员

最后登录
2020-3-5
 楼主| 发表于 2016-3-28 12:59:33 | 显示全部楼层

嘿嘿,已上.
回复 支持 反对

使用道具 举报

10

主题

124

回帖

0

蝴蝶豆

金牌会员

最后登录
2020-3-5
 楼主| 发表于 2016-3-28 13:00:09 | 显示全部楼层

还可以,就占用SPI粘的也结实
回复 支持 反对

使用道具 举报

10

主题

124

回帖

0

蝴蝶豆

金牌会员

最后登录
2020-3-5
 楼主| 发表于 2016-3-28 13:00:32 | 显示全部楼层
disheng4688 发表于 2016-3-28 12:24
nice!!! 谢谢分享

回复 支持 反对

使用道具 举报

7

主题

64

回帖

0

蝴蝶豆

中级会员

最后登录
1970-1-1
发表于 2016-3-28 13:52:54 | 显示全部楼层
不错。U盾屏幕可以利用起来了。
回复 支持 反对

使用道具 举报

7

主题

190

回帖

0

蝴蝶豆

金牌会员

最后登录
2018-9-30
发表于 2016-3-28 13:58:34 | 显示全部楼层
厉害,谢谢分享!
回复 支持 反对

使用道具 举报

26

主题

1984

回帖

6

蝴蝶豆

论坛元老

最后登录
2020-12-9
发表于 2016-3-28 14:13:12 | 显示全部楼层
很好的方享。
回复 支持 反对

使用道具 举报

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32Cube扩展软件包
意法半导体边缘AI套件
ST - 理想汽车豪华SUV案例
ST意法半导体智能家居案例
STM32 ARM Cortex 32位微控制器
关注我们
st-img 微信公众号
st-img 手机版