Go to Post It is better to err on the side of caution than to put yourself in a position to have a referee or judge make a call against you. Build smart! - Sean Schuff [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Spotlight this post!  
Unread 10-06-2009, 21:57
Daniel Jones Daniel Jones is offline
Registered User
AKA: Hanes
FRC #0190 (Gompei and the HERD)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Shrewsbury MA
Posts: 13
Daniel Jones is on a distinguished road
Re: Program digital IO to PWM?

The PIC18F8520 actually has several hardware counter-compare modules which are connected to the first four motor ports. These can be used to generate a high resolution PWM signal from 0% duty to 100% duty at high frequencies (I think I used 40kilohertz). Since hardware is taking care of this, after you set a value your code can continue to do anything else and the signal will continue to be generated until it is told otherwise.

I attached some code that I used to drive an h-bridge motor controller via this method.
Attached Files
File Type: c CustomPWM.c (4.0 KB, 52 views)
File Type: h CustomPWM.h (317 Bytes, 36 views)
__________________
"there are 10 types of people in this world, those who understand binary and those who don't"
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble with Digital breakout IO PWM eatbuckshot C/C++ 1 26-01-2009 23:19
Vic 884 PWM program change?? Team 1708 Dave Programming 3 21-12-2008 17:00
HM55B Digital Compass - How do I program the controller to read it? RyanN Programming 12 13-03-2008 00:14
Digital out signal speed on off, almost like PWM but at max 60Hz Generalx5 Electrical 2 27-03-2007 12:26
Digital Caliper as a Digital Readout on Small Mill sanddrag Technical Discussion 9 13-10-2005 22:51


All times are GMT -5. The time now is 20:32.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi