![]() |
Kevin's PWM 13-16 Code in easyC PRO
Has some of you may or may not know easyC is currently
unable to control PWM's 13-16 due to the fact they are tied to the user processor and cause problems when used with interrupts. MPLAB users were able to use these PWM's but sometimes had issues the the ports generating "noisey" PWM signals. Kevin Watson wrote some excellent code to fix this problem and in doing so also made the outputs extreamly accurate. He has a thread here: http://www.chiefdelphi.com/forums/sh...ad.php?t=51802 Due to some new features in easyC Pro we can also take advantage of this code just like the MPLAB users have been able to do. Instructions: 1.) Download http://kevin.org/frc/frc_pwm.zip and extract it to the directory of your choice. 2.) Click on the 'Project' tab 3.) Right click on 'Source Files'. Then click 'Add Existing Item' browse to the directory you extracted the zip file and click on pwm.c you should now see pwm.c on the tree. 4.) 3.) Right click on 'Header Files'. Then click 'Add Existing Item' browse to the directory you extracted the zip file and click on pwm.h you should now see pwm.c on the tree. 5.) In pwm.c replace #include "ifi_default.h" with #include "p18cxxx.h" 6.) In UserInclude.h add #include "pwm.h" under //add user code here 7.) In the initialize block drag in a 'USer Code' block and call 'Initialize_PWM();' 8.)Then anywhere in your program just call PWM(Unsigned Char PWM13,Unsigned Char PWM14,Unsigned Char PWM15,Unsigned Char PWM16); to run the PWMs. Also make sure you have at least a 10ms wait in your code between calls so it doesn't update too fast. If you have any questions just post. |
| All times are GMT -5. The time now is 04:15. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi