资源简介
德国MK开源项目电调源码V0.42
代码片段和文件信息
/*############################################################################
############################################################################*/
#include “main.h“
//############################################################################
//Init ADC
void ADC_Init(void)
//############################################################################
{
ADCSRA = 0xA6; // Free Run & 1MHZ
ADMUX = 7 | IntRef; // Kanal 7
ADCSRA |= 0x40; // Start
}
//############################################################################
//Strom Analogwerte lesen
void AdConvert(void)
//############################################################################
{
unsigned int i=0;
unsigned char sense;
sense = ADMUX; // Sense-Kanal merken
ADMUX = 0x06 | IntRef; // Kanal 6
SFIOR = 0x00; // Analog Comperator aus
ADCSRA = 0xD3; // Converter ein single
ADCSRA |= 0x10; // Ready l鰏chen
ADMUX = 0x06 | IntRef; // Kanal 6
ADCSRA |= 0x40; // Start
while (((ADCSRA & 0x10) == 0));
ADMUX = sense; // zur點k auf den Sense-Kanal
i = ADCW * 4;
// if(i > 300) i = 300;
Strom = (i + Strom * 7) / 8;
if (Strom_max < Strom) Strom_max = Strom;
ADCSRA = 0x00;
SFIOR = 0x08; // Analog Comperator ein
}
//############################################################################
//Strom Analogwerte lesen
unsigned int MessAD(unsigned char channel)
//############################################################################
{
unsigned char sense;
sense = ADMUX; // Sense-Kanal merken
channel |= IntRef;
ADMUX = channel; // Kanal 6
SFIOR = 0x00; // Analog Comperator aus
ADCSRA = 0xD3; // Converter ein single
ADCSRA |= 0x10; // Ready l鰏chen
ADMUX = channel; // Kanal 6
ADCSRA |= 0x40; // Start
while (((ADCSRA & 0x10) == 0));
ADMUX = sense; // zur點k auf den Sense-Kanal
ADCSRA = 0x00;
SFIOR = 0x08; // Analog Comperator ein
return(ADCW);
}
//############################################################################
//Strom Analogwerte lesen
void FastADConvert(void)
//############################################################################
{
unsigned int i=0;
i = MessAD(6) * 4;
// i = ADCW * 4;
if(i > 200) i = 200;
Strom = i;//(i + Strom * 1) / 2;
if (Strom_max < Strom) Strom_max = Strom;
ADCSRA = 0x00;
SFIOR = 0x08; // Analog Comperator ein
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2468 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\analog.c
文件 109 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\analog.d
文件 132 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\analog.h
文件 7406 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\analog.lst
文件 4664 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\analog.o
文件 4593 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\avr.mak
文件 76 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\avr.opm
文件 385 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\avr_ctrl.psp
文件 9032 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\BLMC.c
文件 103 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\BLMC.d
文件 3978 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\BLMC.h
文件 18689 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\BLMC.lst
文件 6852 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\BLMC.o
文件 470 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\BL_Ctrl.pnproj
文件 61 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\BL_Ctrl.pnps
文件 13 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\BrushLess-Ctrlr_MEGA8_V0_42_10A_ADR_4_for_BL-Ctrl_V1_0.eep
文件 31470 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\BrushLess-Ctrlr_MEGA8_V0_42_10A_ADR_4_for_BL-Ctrl_V1_0.elf
文件 19830 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\BrushLess-Ctrlr_MEGA8_V0_42_10A_ADR_4_for_BL-Ctrl_V1_0.hex
文件 178217 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\BrushLess-Ctrlr_MEGA8_V0_42_10A_ADR_4_for_BL-Ctrl_V1_0.lss
文件 41759 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\BrushLess-Ctrlr_MEGA8_V0_42_10A_ADR_4_for_BL-Ctrl_V1_0.map
文件 5270 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\BrushLess-Ctrlr_MEGA8_V0_42_10A_ADR_4_for_BL-Ctrl_V1_0.sym
文件 25579 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\main.c
文件 103 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\main.d
文件 34726 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\main.elf
文件 3923 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\main.h
文件 172243 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\main.lss
文件 74706 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\main.lst
文件 37895 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\main.map
文件 23972 2013-11-10 00:18 V0.42_addr9-12_fix_ligi\main.o
文件 5952 2012-06-30 10:32 V0.42_addr9-12_fix_ligi\main.sym
............此处省略26个文件信息
评论
共有 条评论