- 4
- 0
- 约7.85千字
- 约 8页
- 2019-08-10 发布于江西
- 举报
PIC BLDC三相电机研读总结(james14888@gmailcom)
ADC中断处理
void __attribute__((__interrupt__,auto_psv)) _ADC1Interrupt(void)
{
uint16 u16MotorNeutralVoltage; uint16 u16MotorPhaseA;
uint16 u16MotorPhaseB; uint16 u16MotorPhaseC;
DesiredSpeed = ADC1BUF0; //POT
u16MotorPhaseA = ADC1BUF3; //--V1
u16MotorPhaseB = ADC1BUF2; //--V2
u16MotorPhaseC = ADC1BUF1; //--V3
u16MotorNeutralVoltage = (u16MotorPhaseA + u16MotorPhaseB + u16MotorPhaseC)/3;
AD1CON1bits.DONE = 0;
IFS0bits.AD1IF = 0;
/************** ADC SAMPLING BMEF signals comparison ****************/
if(u16MotorPhaseA u16MotorNeutralVoltage) {
Comparator.PhaseAOutput = 1;
} else {
Comparator.PhaseAOutput = 0;
}
if(u16MotorPhaseB u16MotorNeutralVoltage) {
Comparator.PhaseBOutput = 1;
} else {
Comparator.PhaseBOutput = 0;
}
if(u16MotorPhaseC u16MotorNeutralVoltage) {
Comparator.PhaseCOutput = 1;
} else {
Comparator.PhaseCOutput = 0;
}
u16ComparatorOutputs = (Comparator.PhaseCOutput2) 0x0007;
u16ComparatorOutputs |= (Comparator.PhaseBOutput1);
u16ComparatorOutputs |= Comparator.PhaseAOutput;
}
输出两个参量:
DesiredSpeed电位器定位的目标速度
u16ComparatorOutputs 与平均电压比较的结果指示
主函数
int main(void)
{
PLLFBD=38; // M=40 80MHz ;40MIPS
CLKDIVbits.PLLPOST=0; // N2=2
CLKDIVbits.PLLPRE=0; // N1=2
RCONbits.SWDTEN=0;
while(OSCCONbits.LOCK != 1) {}; // Wait for PLL to lock
………………………
Kps = 3000;
Kis = 2;
PILoopControllerOutput = 0;
timer3value = 0;
timer3avg = 0;
……………………..
for(;;)
{
while (!S1); // wait for S1 button to be hit
while (S1) // wait till button is released
DelayNmSec(20);
u16CurrentPWMDutyCycle = 1;
u16DesiredPWMDutyCycle = 0;
DesiredSpeed = 0;
ActualSpeed = 0;
SpeedError = 0;
SpeedIntegral = 0;
PILoopControllerOutput = 0;
timer3value = 0;
timer3avg = 0;
PWM1CON1 = 0x0777; // enable PWM outputs
DelayNmSec(1);
Flags.RampUpBEMF =1;
Flags.RunMotor = 1; // indicationg the run motor condition
…………………….
您可能关注的文档
- GABA产品介绍及应用.ppt
- GIS超声局部放电检测技术.doc
- Google:以创新赢得用户.ppt
- GPS系统时间及其与其他时间的关系.doc
- GSM直放站应用中的指标调测及优化.ppt
- GSP药品储存管理操作规程.doc
- GSP药品收货管理操作规程.doc
- HART现场总线技术及产品开发.ppt
- Hewitt-农发行领导力模型.ppt
- Highheels高跟鞋英文介绍(经典版).ppt
- 2026年学历类自考法理学-学前儿童音乐教育参考题库含答案解析(5套试题).docx
- 2026年学历类自考成本会计-学前教育原理参考题库含答案解析(5套试题).docx
- 2026年建筑工程类招标师招标采购合同管理-招标采购专业知识与法律法规参考题库含答案解析(5卷答案).docx
- 乙烯基树脂项目可行性研究报告.docx
- 电梯应急救援系统研究.docx
- 2026年学历类高职单招生物-医学类参考题库含答案解析(5套试题).docx
- 2026年学历类自考专业(公共关系)公关心理学-公关心理学参考题库含答案解析(5卷试题版).docx
- 艾纳香药材项目可行性研究报告.docx
- 2026年学历类自考操作系统概论-管理学原理参考题库含答案解析(5套试题).docx
- 50兆瓦潮汐能发电项目可行性研究报告.docx
最近下载
- (人教版2026新教材)数学二年级下册新教材解读课件.pptx
- 松下sj-mr220中文使用说明书.pdf VIP
- 融优学堂明式家具赏析(中国美术学院)章节测验答案.docx
- 2025年铁道统计公报 .pdf VIP
- 北汽新能源EU5维修手册OBC.pptx VIP
- ISO10292-1994建筑玻璃.多层玻璃稳态U值(热透过率)的计算.PDF VIP
- 北汽新能源EU5维修手册-电路图.pdf VIP
- TCNEA-核电工程班组建设评价指南及编制说明.pdf VIP
- 基层行低利率环境对金融增加值的影响分析.pdf VIP
- 2025-2026学年小学音乐鲁教版五四学制2024一年级下册-鲁教版(五四学制)(2024)教学设计合集.docx
原创力文档

文档评论(0)