本帖最后由 紫气东升 于 2016-8-3 19:57 编辑
#include <stm8l052c6.h>
#include <stdio.h>
#define UNIQUE_ID_START_ADDR 0x48CD
unsigned char i;
int temp;
char t;
unsigned char * pUniqueId;
void USART1_Init(void);
void GPIO_Init(void);
void USART1_Init(void)
{
USART1_CR1=0x00;
USART1_CR2=0x0c;
USART1_CR3=0x20;
USART1_BRR2=0x03;
USART1_BRR1=0x68;
}
void GPIO_Init(void)
{
PD_ODR|=0x02;
PD_DDR|=0x02;
PD_CR1|=0x02;
PD_CR2|=0x02;
}
void main(void)
{
GPIO_Init();
Usart1_Init();
while (!(USART1_SR & 0x20));
USART1_DR=RxBuffer;
while (!(USART1_SR & 0x80));
USART1_DR=TxBuffer;
while (!(USART1_SR & 0x80));
} |