2017-11-09 02:13 AM
Hello,
Actually I am interfacing ESP8266 wifi module with STM8S003F3P6 MCU . I have programed the wifi module to get data from internet and send it to STM8S003F3P6. Data is character 1 or 0. Wifi module is working wel.But it seems that there is nothing happening from the STM8S003F3P6 Side. Kindly if anyone can guide me,if I am doing anything wrong. Thanks.
#include 'STM8S003F3P.h'
void InitialiseSystemClock(void);void UART1_Initialize(void); void UART1_Initialize(void){UART1_CR1=(0<<4);UART1_BRR1=0x08;UART1_BRR2=0X0a;UART1_CR2=(1<<5);UART1_CR2=(1<<2);}
void main(void){
InitialiseSystemClock();
UART1_Initialize(); PD_DDR |=(1<<3); PD_CR1 |=(1<<3); PD_CR2 |=(1<<3); _asm('rim'); while(1){ }} void InitialiseSystemClock(void) { CLK_ICKR = 0; // Reset the Internal Clock Register. CLK_ICKR = (1<<0);; // Enable the HSI. CLK_ECKR = 0; // Disable the external clock. while (!(CLK_ICKR & (1<<1))); // Wait for the HSI to be ready for use. CLK_CKDIVR = 0; // Ensure the clocks are running at full speed. CLK_PCKENR1 = 0xff; // Enable all peripheral clocks. CLK_PCKENR2 = 0xff; // Ditto. CLK_CCOR = 0; // Turn off CCO. CLK_HSITRIMR = 0; // Turn off any HSIU trimming. CLK_SWIMCCR = 0; // Set SWIM to run at clock / 2. CLK_SWR = 0xe1; // Use HSI as the clock source. CLK_SWCR = 0; // Reset the clock switch control register. CLK_SWCR = (1<<1); // Enable switching. while (CLK_SWCR & (1<<0)); // Pause while the clock switch is busy. }@far @interrupt void UART1_RECV_INTERRUPT (void){read=UART1_DR;if(read =='1'){
PD_ODR |=(1<<3);}
else{if(read =='0'){PD_ODR &=~(1<<3);
}}}