• 大小: 469KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-05-14
  • 语言: 其他
  • 标签: stm8  

资源简介

STM8S103F3编写的无线充电程序 带AD和PWM功能

资源截图

代码片段和文件信息

#include “stm8s.h“
#include “PWM.h“
#include “AD.h“
#include “Remote.h“
#include “Urat.h“
#include “BT&REMOTE_CONTROL.h“
#include “A2DP_HFP_CODE.h“
#include “BT_Control.h“
#define A_Board 1
//#define B_Board 1
//#define C_Board 1
//#define TEST_Board 1
u8 Charge_CH1_Buffer[20];
u8 Charge_CH3_Buffer[20];
u8 Charge_CH2_Buffer[20];
void delayxms(uchar x);
void Delay_1ms(uint x);
void Init_Tim4(void);

void charge_test_A_Board(void);
void charge_test_B_Board(void);
void charge_test_C_Board(void);
void charge_test_D_Board(void);

void CH1_Charge_current_test(void);
void CH2_Charge_current_test(void);
void CH3_Charge_current_test(void);
u16 charge_scan_count=0;
u8 charge_scan_able_flag=0;
u8 charge_start_flag=0;

u16 ch2_charge_scan_count;
u8  ch2_charge_scan_able_flag;
u8  ch2_charge_start_flag;

u16 ch3_charge_scan_count;
u8  ch3_charge_scan_able_flag;
u8  ch3_charge_start_flag;
u16 Sum=0;
u16 Sum1=0;
u16 Sum2=0;
u8 Charging_flag;
u8 CH2_Charging_flag;
u8 CH3_Charging_flag;
u8 Freg_Max=0;
u8 Take_out_flag=0x0;
u8 A_CHANLE_B_FLAG;
u8 B_CHANLE_A_FLAG;
void Pick_up_vol(void);
main()
{

  clk_init();
GPIO_SET();
Init_Adc();
Init_Urat();
PWM_Set();
//IRInit();
//EXTI_DeInit();
Init_Tim4();

AMP_SDN_HIGH();
//BT_POWER_ON();
//Delay_1ms(100);
//BT_PLAY_HIGH();
//Delay_1ms(8000);
//BT_PLAY_LOW();
//Delay_1ms(1000);
//BT_PLAY_HIGH();
//Delay_1ms(6000);
//BT_PLAY_LOW();
//UART1->DR =0xac;

while (1)
{
    u8 i;
    Delay_1ms(300);

/*if(Urat_RX_data[0]==0XAA)
{
for(i=0;i<6;i++)
  {
UART1->DR=Urat_RX_data[0];
Delay_1ms(5);
Urat_RX_data[0]=0;
}
Recieve_Usart_flag=0X0;
}*/
//Remote_control_BT(IR_RECIVE_DATA);
Pick_up_vol();

 BT_Music_Set();
 BT_POWER_Match_Set();
 Call_On();
//BT_operation();
//BT_POWER_Control();

#ifdef A_Board 
     charge_test_A_Board();
#endif

#ifdef B_Board 
     charge_test_B_Board();
#endif

#ifdef C_Board 
     charge_test_C_Board(); 
#endif

#ifdef TEST_Board  
     charge_test_D_Board();
#endif

/*UART1->DR =0x88;
Delay_1ms(5);
UART1->DR =Urat_RX_data[0];
    Delay_1ms(5);*/
}
}

void Pick_up_vol(void)
{
if(Light_pin!=0)
     {
            if(Take_out_flag==0XFF)return;
        AMP_SDN_LOW();
BT_vol_decrease_HIGH();
Delay_1ms(3000);
BT_vol_decrease_LOW();
Take_out_flag=0XFF;
    
      }
if(Light_pin==0)
{
if((Power_on_flag==0xff)&&(Take_out_flag==0XFF))
{
AMP_SDN_HIGH();
BT_vol_increase_HIGH();
Delay_1ms(2000);
BT_vol_increase_LOW();
Take_out_flag=0X0;
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void charge_test_A_Board(void)
{
u8 temp=0;
u8 itemp2;

////////////

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-04-02 12:55  C_Wireless_Charge\
     文件        1626  2013-01-21 11:46  C_Wireless_Charge\A2DP_HFP_CODE.h
     文件         942  2012-11-19 17:13  C_Wireless_Charge\AD.h
     文件        7313  2013-01-21 15:29  C_Wireless_Charge\BT&REMOTE_CONTROL.h
     文件        5844  2013-02-04 17:55  C_Wireless_Charge\BT_Control.h
     文件        4663  2013-03-22 11:44  C_Wireless_Charge\charge.dep
     文件         897  2013-03-22 11:25  C_Wireless_Charge\charge.pdb
     文件       15801  2013-01-21 17:54  C_Wireless_Charge\charge.stp
     目录           0  2013-04-02 12:55  C_Wireless_Charge\charge_Programmer\
     文件         488  2012-12-20 18:11  C_Wireless_Charge\charge_Programmer\charge_STVP.stp
     文件         103  2012-12-20 18:11  C_Wireless_Charge\charge_Programmer\charge_STVP_OPTION BYTE.hex
     文件         292  2013-01-14 15:06  C_Wireless_Charge\checkres.spy
     文件         201  2013-03-22 11:44  C_Wireless_Charge\C_Wireless_Charge.stw
     文件       47913  2013-03-22 11:27  C_Wireless_Charge\C_Wireless_Charge.wdb
     文件       53302  2013-03-22 11:44  C_Wireless_Charge\C_Wireless_Charge.wed
     目录           0  2013-04-02 12:55  C_Wireless_Charge\Debug\
     文件       25098  2013-03-22 11:25  C_Wireless_Charge\Debug\charge.elf
     文件        2407  2012-10-16 16:57  C_Wireless_Charge\Debug\charge.lkf
     文件       41212  2012-12-20 18:24  C_Wireless_Charge\Debug\charge.map
     文件       15980  2013-03-22 11:25  C_Wireless_Charge\Debug\charge.s19
     文件      113161  2013-03-22 11:25  C_Wireless_Charge\Debug\charge.sm8
     文件      189034  2013-03-22 11:25  C_Wireless_Charge\Debug\main.ls
     文件       69639  2013-03-22 11:25  C_Wireless_Charge\Debug\main.o
     文件       38742  2013-03-22 10:55  C_Wireless_Charge\Debug\stm8s_clk.ls
     文件       19447  2013-03-22 10:55  C_Wireless_Charge\Debug\stm8s_clk.o
     文件       10053  2013-03-22 10:55  C_Wireless_Charge\Debug\stm8s_exti.ls
     文件        4461  2013-03-22 10:55  C_Wireless_Charge\Debug\stm8s_exti.o
     文件       10155  2013-03-22 10:55  C_Wireless_Charge\Debug\stm8s_gpio.ls
     文件        6835  2013-03-22 10:55  C_Wireless_Charge\Debug\stm8s_gpio.o
     文件        6181  2013-03-22 10:55  C_Wireless_Charge\Debug\stm8s_it.ls
     文件        6948  2013-03-22 10:55  C_Wireless_Charge\Debug\stm8s_it.o
............此处省略87个文件信息

评论

共有 条评论