资源简介
瑞能微计量芯片RN8302B计量芯片笔记,源代码。有FFT算法,参考电路,软件。
代码片段和文件信息
typedef unsigned char u8;
typedef signed char s8;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned long int u32;
typedef signed long int s32;
typedef unsigned short WORD;
typedef unsigned char BOOL;
#define PinWrite_ADSCLK(x) ( (x) ? (P0_bit.no6 = 1 PM0_bit.no6 = 1) : (PM0_bit.no6 = 0 P0_bit.no6 = 0) ) //
#define PinMode_ADSCLK(x) ( (x == GPIO_MODE_OUT) ? (PM0_bit.no6 = 0) : (PM0_bit.no6 = 1) )
#define PinRead_ADSDI() (P4_bit.no4)
#define PinWrite_ADSDO(x) ( (x) ? (P6_bit.no0 = 1 PM6_bit.no0 = 1) : (PM6_bit.no0 = 0 P6_bit.no0 = 0) ) //
#define PinWrite_ADCS(x) ( (x) ? (P6_bit.no1 = 1 PM6_bit.no1 = 1) : (PM6_bit.no1 = 0 P6_bit.no1 = 0 ) )
#define PinWrite_ADRST(x) ( (x) ? (P0_bit.no5 = 1 PM0_bit.no5 = 1) : (PM0_bit.no5 = 0 P0_bit.no5 = 0 ) )
typedef enum {ERROR = 0 SUCCESS = !ERROR} ErrorStatus;
typedef struct {
// u32 Dat : 23;
// u32 S : 1;
u8 Dat0;
u8 Dat1;
u8 Dat2 : 7;
u8 S : 1;
} sDF09;
typedef struct {
u32 Dat;
} sDF11;
typedef sDF11 sFsEgSh_TypeDef;
#pragma vector = INTTM01_vect
__interrupt void MD_INTTM01(void)
{
TMIF01 = 0; /* INTTM01 interrupt flag clear */
SysStamp ++ ;
}
u16 fnStamp_Through(u16 Ago)
{
extern u16 SysStamp;
if (SysStamp >= Ago)
{return (SysStamp - Ago);}
else
{return ( (0xffff - Ago) + SysStamp);}
}
u16 fnHexToBcd_u16(u16 Dat)
{
u16 Result = 0;
Dat = Dat % 10000;
Result += (Dat / 1000) * 0x1000;
Dat = Dat % 1000;
Result += (Dat / 100) * 0x100;
Dat = Dat % 100;
Result += (Dat / 10) * 0x10;
Dat = Dat % 10;
Result += Dat;
return(Result);
}
u32 fnHexToBcd_u32(u32 Dat)
{
u32 result = 0;
Dat = Dat % 100000000;
result += (Dat / 10000000) * 0x10000000;
Dat = Dat % 10000000;
result += (Dat / 1000000) * 0x1000000;
Dat = Dat % 1000000;
result += (Dat / 100000) * 0x100000;
Dat = Dat % 100000;
result += (Dat / 10000) * 0x10000;
Dat = Dat % 10000;
result += (Dat / 1000) * 0x1000;
Dat = Dat % 1000;
result += (Dat / 100) * 0x100;
Dat = Dat % 100;
result += (Dat / 10) * 0x10;
Dat = Dat % 10;
result += Dat;
return(result);
}
u16 fnDFConver_Bcd16To16(s16 Dat)
{
u16 Result;
Result = abs(Dat) % 8000;
Result = fnHexToBcd_u16(Result);
if(Dat < 0 ) Result |= 0x8000;
else Result &= 0x7fff;
return(Result);
}
u32 fnDFConver_Bcd32To32(s32 Dat)
{
u32 Result;
Result = labs(Dat) % 80000000;
Result = fnHexToBcd_u32(Result);
if(Dat < 0 ) Result |= 0x80000000;
else Result &= 0x7fffffff;
return(Result);
}
sDF09 fnDFConver_Hex32ToDF09(s32 Dat)
{
sDF09 Result;
memset(&Result 0 sizeof(sDF09) );
if(Dat < 0) Result.S = 1;
else Result.S = 0;
Dat = labs(Dat) % 800000;
Dat = fnHexToBcd_u32(Dat);
Result.Dat0 = Dat;
Result.Dat1 = Dat >> 8;
Result.Dat2 = Dat >> 16;
return(Result);
}
typedef union
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 365722 2014-05-09 09:49 RN8302B\参考电路\SN007_GX333TY000_SCH001V2.1.sch
文件 110577 2014-05-09 09:46 RN8302B\参考电路\SN007_GX333TY000_SCH002V2.1.sch
文件 726146 2015-07-31 14:21 RN8302B\应用笔记\锐能微RN8302、RN8302B应用笔记v1.1.pdf
文件 1918752 2015-01-05 16:56 RN8302B\手册\RN8302B用户手册_v3.2.pdf
文件 51830 2014-06-13 17:25 RN8302B\支持软件\C语言计量参考程序\RN8302应用程序V1.3.c
文件 7162 2014-06-13 17:25 RN8302B\支持软件\FFT\Dl645_Fft.c
文件 1289 2014-06-13 17:25 RN8302B\支持软件\FFT\Dl645_Fft.h
文件 112640 2014-06-13 17:25 RN8302B\支持软件\FFT\FFT说明.doc
目录 0 2017-04-28 18:10 RN8302B\支持软件\C语言计量参考程序
目录 0 2017-04-28 18:10 RN8302B\支持软件\FFT
目录 0 2018-05-25 13:51 RN8302B\参考电路
目录 0 2017-04-28 18:10 RN8302B\应用笔记
目录 0 2017-04-28 18:10 RN8302B\手册
目录 0 2017-04-28 18:10 RN8302B\支持软件
目录 0 2017-04-28 18:10 RN8302B
----------- --------- ---------- ----- ----
3294118 15
评论
共有 条评论