单片机源程序如下:
- /*****************************************************************************************
- * STM8 platform public function module
- *
- * (c) Copyright 2008-2030, Shenzhen Auge Wireless Technology Co.,Ltd.
- * All Rights Reserved
- *
- * Filename: main.c
- * Device: LT8900&STM8S003F3P6
- * Compiler: IAR
- * Embed OS:
- *
- * Author: rf_smart
- * Created on: 14-04-20
- *
- *****************************************************************************************/
- #include "bitmap.h"
- void Delay(uint16_t z)
- {
- uint16_t x, y;
- for(x = 0; x < z; x ++ )
- for(y = 0; y < 1120; y ++);
- }
- void SysClkInit(void)
- {
- CLK_ICKR_HSIEN = 1;
- while(!CLK_ICKR_HSIRDY);
- CLK_CKDIVR = 0X00;
- }
- void main()
- {
- SysClkInit();
- asm("sim");
- SpiInit();
- RfInit();
- UartInit(0x03, 0x00);
- Timer4Init();
- PktExterInit();
- asm("rim");
- gtChnlData.u16RxEnChnl = 0x0080 | 0x10;
- gtChnlData.u16TxEnChnl = 0x0100 | 0x10;
- RfEnterIdle();
- RfClrFifo();
- RfEnterRx();
- gtSysFlag.b2TRFlag = 0;
- gtSysFlag.b1NormalMode = 1;
- UartSendChs("AUG393 2.4G Wireless Serial Module!\r\n");
- while(1)//TX
- {
- if(gtSysFlag.b2TRFlag != 1)
- {
- RfSendTest();
- }
- Delay(1000);
- }
- while(1)//RX
- {
- if(gtRfFifo.u16ReadPoint != gtRfFifo.u16WritePoint)
- {
- UART1_CR2_TIEN = 1;
- }
- }
- }
复制代码
所有资料51hei提供下载:
stm8_lt8900_IAR.rar
(487.72 KB, 下载次数: 45)
|