# SurvivalBracelet **Repository Path**: popupspace/survival-bracelet ## Basic Information - **Project Name**: SurvivalBracelet - **Description**: 救生手环电路设计 - **Primary Language**: Unknown - **License**: Artistic-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2022-06-01 - **Last Updated**: 2024-04-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 一、电路设计 原理图设计 电路版设计 电路板模型 # 二、代码编写 主要代码 ```c #include #include #define GPIO_LCD P0 sbit GPIO_RS = P1^0; sbit GPIO_RW = P1^1; sbit GPIO_E = P1^2; sbit GPIO_BTN_LAST = P1^3; sbit GPIO_BTN_NEXT = P1^4; sbit GPIO_BTN_OK = P1^5; sbit GPIO_LED_RED = P1^6; sbit GPIO_LED_GREEN = P1^7; ... void KeyEvent() { if(GPIO_BTN_LAST == 0) { Delay_ns(1000); if(GPIO_BTN_LAST == 0) { index--; if(index < 1) index = 5; Show_Page(); } while(!GPIO_BTN_LAST); } if(GPIO_BTN_NEXT == 0) { Delay_ns(1000); if(GPIO_BTN_NEXT == 0) { index++; if(index > 5) index = 1; Show_Page(); } while(!GPIO_BTN_NEXT); } if(GPIO_BTN_OK == 0) { Delay_ns(1000); if(GPIO_BTN_OK == 0) { if(isboot == 0) { Show_Boot(); isboot = 1; } } while(!GPIO_BTN_OK); } } ... void main() { TMOD &= 0xF0; TMOD |= 0x01; EA = 1; TH0 = 0xFC; TL0 = 0x67; ET0 = 1; TR0 = 1; GPIO_LED_RED = 0; GPIO_LED_GREEN = 0; while(1) { KeyEvent(); } } ``` # 三、模型设计 ![](IMGS/image4.jpg) ![](IMGS/image5.jpg)