標題: 簡單的STM32出租車計價器仿真程序 [打印本頁]

作者: longpai    時間: 2021-6-23 16:37
標題: 簡單的STM32出租車計價器仿真程序
簡單的出租車計價器
出租車金額隨著里程數(shù)加五
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)


STM32單片機源程序如下:
  1. #include "stm32f10x.h"
  2. #include <stdio.h>
  3. #include "lcd.h"
  4. #include "delay.h"
  5. #include "motor.h"
  6. #include "bsp_led.h"
  7. #include "bsp_exti.h"
  8. unsigned int i,j;
  9. unsigned char temp_table[16];
  10. unsigned char temp_set_table[16];

  11. unsigned int total = 0;
  12. unsigned int MotorFlag = 0;
  13. int main(void)
  14. {

  15.         LED_Init();
  16.         LED(OFF);
  17.         
  18.         L298_GPIO();
  19.         STOP();
  20.         
  21.         Key_Init();
  22.         
  23.         GPIO_InitStructReadtempCmd();   
  24.         lcd_system_reset();                                                                                                         

  25.          
  26.         while(1)
  27.         {
  28.                
  29.                
  30.                 if(MotorFlag)
  31.                 {
  32.                         total = total + 5;
  33.                         sprintf(temp_table,"price:  %d ",5);
  34.                         sprintf(temp_set_table,"total:  %d ",total);
  35.                                                                                                                         
  36.                         for(i=0;i<16;i++)
  37.                         lcd_char_write(i,0,temp_table[i]);  
  38.                         for(j=0;j<16;j++)
  39.                         lcd_char_write(j,1,temp_set_table[j]);
  40.                 }
  41.                 else
  42.                 {
  43.                         total = 0;
  44.                         lcd_system_reset();
  45.                         
  46.                 }
  47.                 delay_ms(500);
  48.         }
  49. }
復制代碼

所有資料51hei提供下載:
MyProject.7z (346.66 KB, 下載次數(shù): 69)







歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1