完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
您好,我使用PIC18F45 25,XC8,MPLAB和编码在CI AM尝试,这是一个LED和电阻器连接在引脚16和引脚20。(a)在TCY和MS产生的方波的周期和周期是什么?(b)在这个配置中LED的周期和周期是什么?(c)当程序运行时,LED实际上总是在开。发生了什么事?你怎么解决的?我是这样尝试的…A.在Test:(107+1)****4=432 tCyTyn在秒=5×10 ^ -6秒内秒:0.000216个占空比在{=185*〉**=185=185 tCyBoobe秒(秒)=0.0000925 SI不认为我在正确的路径上,我试着读数据表,但我不知道。理解。如果有人能指引我正确的方向,我会很感激的。
以上来自于百度翻译 以下为原文 hello I am using a PIC18F4525 , xc8, mplab and coding in C #include #include “osc.h" // library for set_osc_NMHz() #include "configuration_bits.h" int main(void) // project can only have one main() { set_osc_8MHz(); TRISDbits.RD1 = 0; PORTDbits.RD1 = 1; OpenTimer2(TIMER_INT_OFF & T2_POST_1_1 & T2_PS_1_4); OpenPWM1(107); SetDCPWM1(185); while(1); } I am trying to dothis , An LED and resistor connected between pin 16 and pin 20. (a) What is the period and dutycycle of the generated square wave in TCY and ms? (b) What should be the period and dutycycle of the LED in this configuration? (c) When the program is run, the LED is actually always on. What is going on? How do you fix it? i was attempting it as such.. a. Period in Tcy : (107+1) * Tcy * 4 = 432 Tcy Tcy in second = 5 x 10 ^ -6 s Period in seconds : 0.000216 s Duty cycle in Tcy = 185 * ¼ Tcy * 4 = 185 Tcy Duty Cycle in seconds = 0.0000925 s i don't think i am on the right path, i have tried to read the data sheet but i don't understand. if someone could guide me in the right direction i would appreciate it . |
|
相关推荐
5个回答
|
|
|
PIC数据表没有提到像OpenTime2~()、OpenPWME()和StdCPWM1这样的库函数,所以它不能是唯一的引用,如果您采用该路径。我的首选是直接访问外围设备,那么数据表是您唯一需要的参考。如果SETPWME()正在设置计时器的PR寄存器。R,那么StDC函数不应该设置比它大的值。(只是猜测,我从来没有使用过这些函数。)
以上来自于百度翻译 以下为原文 The PIC datasheet doesn't mention library functions like OpenTimer2(), OpenPWM() and SetDCPWM1, so it can't be the only reference if you take that path. My preference is to access the peripheral directly, then the datasheet is the only reference you need. If SetPWM() is setting the timer's PR register, then the SetDC function should never set a value larger than that. (Just a guess, I've never used those functions.) |
|
|
|
|
|
这是我的奋斗,我只限于在课堂上向我展示的功能,但没有提供任何细节,所以它与我的数据表不同。
以上来自于百度翻译 以下为原文 that is my struggle, i am restricted to function shown to me in class but no detail was provided so it is all different than my datasheet. |
|
|
|
|
|
你使用的是XC8版本?这些函数是旧的外围库的一部分,它没有提供编译器的最新版本。
以上来自于百度翻译 以下为原文 Which version of XC8 are you using? Those functions are part of the old peripheral library, which is not supplied with the latest versions of the compiler. |
|
|
|
|
|
MPLAB®XC8编译器V1.45和SePICIC18F遗留外围库V2.0Windows
以上来自于百度翻译 以下为原文 MPLAB® XC8 Compiler v1.45 and these PIC18F Legacy Peripheral Libraries v2.0 - Windows |
|
|
|
|
|
因此,PIN 17是CCP1,PIN 16是CCP2,17是PWM1,16是PMW2。我想知道这个电话是否影响了占空比。CCP1和CCP2的默认占空比是多少?
以上来自于百度翻译 以下为原文 so pin 17 is ccp1 and pin 16 is ccp2, 17 is pwm1 and 16 is pmw2. I am wondering about whether that call is affecting the duty cycle. what is default duty cycle for CCP1 and CCP2? |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
503 浏览 0 评论
5812 浏览 9 评论
2350 浏览 8 评论
2237 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3544 浏览 3 评论
1160浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1122浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
889浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
503浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-14 07:22 , Processed in 1.117217 second(s), Total 82, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1680