收藏 分销(赏)

光伏并网发电模拟装置设计文档附件(核心源程序).doc

上传人:pc****0 文档编号:8417655 上传时间:2025-02-13 格式:DOC 页数:2 大小:27KB 下载积分:10 金币
下载 相关 举报
光伏并网发电模拟装置设计文档附件(核心源程序).doc_第1页
第1页 / 共2页
光伏并网发电模拟装置设计文档附件(核心源程序).doc_第2页
第2页 / 共2页
本文档共2页,全文阅读请下载到手机保存,查看更方便
资源描述
核心源程序如下: #include "hw_types.h" #include "hw_memmap.h" #include "hw_ints.h" #include "hw_gpio.h" #include "hw_pwm.h" #include "sysctl.h" #include "systick.h" #include "debug.h" #include "gpio.h" #include "pwm.h" #include "systeminit.h" unsigned char tosin[]={ 2, 5, 9, 12, 16, 19, 22, 25, 28, 32, 35, 38, 41, 44, 47, 51, 54, 57, 60, 63, 66, 69, 72, 76, 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, 108, 111, 114, 117, 120, 123, 126, 128, 131, 134, 137, 139, 142, 145, 147, 150, 153, 155, 158, 160, 163, 165, 168, 170, 172, 175, 177, 179, 182, 184, 186, 188, 190, 193, 195, 197, 199, 201, 203, 205, 207, 208, 210, 212, 214, 216, 217, 219, 221, 222, 224, 225, 227, 228, 230, 231, 232, 234, 235, 236, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 247, 248, 249, 250, 250, 251, 252, 252, 253, 253, 253, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 254, 253, 253, 253, 252, 252, 251, 250, 250, 249, 248, 247, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 236, 235, 234, 232, 231, 230, 228, 227, 225, 224, 222, 221, 219, 217, 216, 214, 212, 210, 208, 207, 205, 203, 201, 199, 197, 195, 193, 190, 188, 186, 184, 182, 179, 177, 175, 172, 170, 168, 165, 163, 160, 158, 155, 153, 150, 147, 145, 142, 139, 137, 134, 131, 128, 126, 123, 120, 117, 114, 111, 108, 106, 103, 100, 97, 94, 91, 88, 85, 82, 79, 76, 72, 69, 66, 63, 60, 57, 54, 51, 47, 44, 41, 38, 35, 32, 28, 25, 22, 19, 16, 12, 9, 7, 4, 2, //250 }; int main(void) { unsigned char n; jtagWait(); // 防止JTAG失效 clockInit(); SysCtlPWMClockSet(SYSCTL_PWMDIV_1); // PWM时钟源1分频 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); // 使能PD口外设 SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM); // 使能PWM外设 GPIOPinTypePWM(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1); // 设置PD0,PD1为PWM0和PWM1 PWMGenPeriodSet(PWM_BASE, PWM_GEN_0,600/2); // 设置两路PWM的共同周期 PWMGenConfigure(PWM_BASE, PWM_GEN_0, // 设置PWM发生器0为上下计数方式,两路PWM不同步 PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC); PWMOutputState(PWM_BASE, PWM_OUT_0_BIT | PWM_OUT_1_BIT, true); // 使能PWM0和PWM1 PWMGenEnable(PWM_BASE, PWM_GEN_0); // 使能PWM发生器0 while(1) { for(n=0;n<250;n++) { PWMPulseWidthSet(PWM_BASE, PWM_OUT_0,tosin[n]*2/2); // 分别设置两路PWM的匹配值 PWMPulseWidthSet(PWM_BASE, PWM_OUT_1,tosin[n]*2/2); // 修改50000和10000可以设置占空比 } } }
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 百科休闲 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4009-655-100  投诉/维权电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服