資源簡介
HT-001 RN8209電表套件(STM32不帶電能),帶全部的電路原理圖,軟件源代碼和相關設計文檔。
代碼片段和文件信息
#include?“include.h“
#include“Config.h“
#include“delay.h“??
//#include“control.h“?
//#include“suanfa.h“?
#include?“RN8209.h“
//#include?“OLED.h“
#include?“LCD1353.h“
//#include?“key.h“??????? ?????//按鍵
//#include?“commucation.h“???//通訊子程序 ??
//UART1?SETTINS ???串口1
static?struct?buf_st?rbuf?=?{?0?0?};
#define?SIO_RBUFLEN?((unsigned?short)(rbuf.in?-?rbuf.out))
static?struct?buf_st?tbuf?=?{?0?0?};
#define?SIO_TBUFLEN?((unsigned?short)(tbuf.in?-?tbuf.out))
static?unsigned?int?tx_restart?=?1;
//UART3?SETTINS ??串口3
static?struct?buf_st?rbuf3?=?{?0?0?};
#define?SIO_RBUFLEN3?((unsigned?short)(rbuf3.in?-?rbuf3.out))
static?struct?buf_st?tbuf3?=?{?0?0?};
#define?SIO_TBUFLEN3?((unsigned?short)(tbuf3.in?-?tbuf3.out))
static?unsigned?int?tx_restart3?=?1;
extern?unsigned?int??HDP;
extern?unsigned?int??VDP; ???
void?Delay(vu32?nCount);
void?Delay2(vu32?nCount);
void?RCC_Configuration(void);
void?GPIO_Configuration(void);
void?NVIC_Configuration(void);
void?USART_Configuration(void);
//void?USART2_Configuration(void);
void?stm32fsmc_init(void);
void?SysTick_Configuration(void);
void?Adc_Init(void);
void?saveini(void)?
{
char?i;
// u32?tmp;
/*?Unlock?the?Flash?Program?Erase?controller?*/
FLASH_Unlock();
/*?Clear?All?pending?flags?*/
FLASH_ClearFlag(FLASH_FLAG_BSY?|?FLASH_FLAG_EOP?|?FLASH_FLAG_PGERR?|?FLASH_FLAG_WRPRTERR);
FLASH_ErasePage(FLASH_ADDR);
FLASH_ProgramWord(FLASH_ADDR??((addr<<16)|mywwwport));
FLASH_ProgramWord(FLASH_ADDR+4??((mytcpport<<16)|myudpport));
FLASH_ProgramWord(FLASH_ADDR+8?((myip[0]<<24)|(myip[1]<<16)|(myip[2]<<8)|myip[3]));
FLASH_ProgramWord(FLASH_ADDR+12??((bps<<16)));
}
void?loadini(void)?{
// char?i;
u32?j;
j=*(pp);
addr=j>>16;
mywwwport=j&0xffff;
j=*(pp+1);
mytcpport=j>>16;
myudpport=j&0xffff;
j=*(pp+2);
myip[0]=j>>24;
myip[1]=(j>>16)&0xff;
myip[2]=(j>>8)&0xff;
myip[3]=j&0xff; ?
}
//默認設置
void?defaultset(void)
{
myip[0]=192;
myip[1]=168;
myip[2]=1;
myip[3]=200;
myudpport=1200;
mytcpport=1300;
mywwwport=80;
addr=1;
bps=192;
vset[0]=10;
vset[1]=10;
vset[2]=10;
vset[3]=10;
vset[4]=10;
vset[5]=10;
vset[6]=10;
vset[7]=10;
vset[8]=10; ???//2013-3-12
vset[9]=10; ???//2013-3-12
ad_fx[0]=10;
ad_fx[1]=10;
ad_fx[2]=10;
ad_fx[3]=10;
ad_fx[4]=10;
ad_fx[5]=10;
ad_fx[6]=10;
ad_fx[7]=10;
}
//spi初始化
void?SPI1_Init(void)
{
???SPI_InitTypeDef?SPI_InitStructure;
???/*?SPI1?configuration?*/?
???SPI_InitStructure.SPI_Direction?=?SPI_Direction_2Lines_FullDuplex;
???SPI_InitStructure.SPI_Mode?=?SPI_Mode_Master;
???SPI_InitStructure.SPI_DataSize?=?SPI_DataSize_8b;
???SPI_InitStructure.SPI_CPOL?=?SPI_CPOL_Low;
???SPI_InitStructure.SPI_CPHA?=?SPI_CPHA_1Edge;
???SPI_InitStructure.SPI_NSS?=?SPI_NSS_Soft;
???SPI_InitStructure.SPI_BaudRatePrescaler?=?SPI_BaudRatePrescaler_4;
???SPI_InitStructure.SPI_FirstBit?=?SPI_FirstBit_MSB;
???SPI_InitStructure.SPI_CRCPolynom
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????3057807??2009-03-19?14:16??PL2303\PL2303_Prolific_GPS_1013_20090319.exe
?????文件????2262196??2011-08-18?15:33??PL2303\pl2303_prolific_gps_1013_20090319.zip
?????文件???????1081??2009-08-18?15:37??PL2303\releasenote.txt
?????目錄??????????0??2016-02-11?07:48??PL2303
-----------?---------??----------?-----??----
??????????????5321084????????????????????4
- 上一篇:zemax培訓教程教材
- 下一篇:舊手機充分利用——制作電腦性能監視器
評論
共有 條評論