Page 831 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 831

2)  usart.c

              USART통신  관련  함수들이  작성되어  있는  프로그램이다.  사용자는  이  프로그램에  있는  함수
            를  main.c에  불러와  사용함으로써  간단하게  데이터를  송신하고  수신할  수  있다.
             #include "stm32f10x.h"
             #include "USART.h"

             #include "GLCD.h"

             u8 rfid_tag[8]={0,};    //실제  rfid 태그 값 저장하는 배열


             u8 tag1[]={'F','3','D','2','4','1','7','B'};            //101-1004 주민  태그
             u8 tag2[]={'6','B','C','C','4','1','7','B'};            //101-1702 주민  태그

             u8 tag3[]={'4','C','A','E','4','2','7','B'};            //102-706 주민  태그

             u16 i=0;        //태그  값  저장을  위한  변수

             u16 k=0;        //태그  값이  일치하는지  확인하기  위한  변수

             void USART1_SendByte(u16 Data)

             {
                     while (!(USART1->SR & USART_FLAG_TXE));
                     USART1->DR = (Data & (uint16_t)0x01FF);

             }

             void USART1Write(u8* data,u16 len)

             {
                     u16 i;
             //      DIR485_H ;

                     for (i=0; i<len; i++){
                             USART1_SendByte(data[i]);
                     }

             //      Delay10us(1000);
             //      DIR485_L;
             }

             void USART1_Configuration(void)
             {
                     USART_InitTypeDef USART_InitStructure;

                     USART_InitStructure.USART_BaudRate            = 9600;
                     USART_InitStructure.USART_WordLength          = USART_WordLength_8b;
                     USART_InitStructure.USART_StopBits            = USART_StopBits_1;

                     USART_InitStructure.USART_Parity              = USART_Parity_No ;
                     USART_InitStructure.USART_HardwareFlowControl                                        =





                                                         -  824  -
   826   827   828   829   830   831   832   833   834   835   836