CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

High performance PWM on PIC16F1786

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
RNR107



Joined: 19 Dec 2014
Posts: 23

View user's profile Send private message

High performance PWM on PIC16F1786
PostPosted: Fri Dec 19, 2014 10:12 am     Reply with quote

Hi all,
I am looking for a way to control a servo motor via PWM.
I am currently able to do it using the simple PWM mode, but this only give me a 10bits precision which is not sufficient in this particular application.
I understand from the 16F1786 datasheet that it is possible to get 16 bits using the PSMC module.
1- Am I reading the datasheet right? Can I get 16 bits PWM ?
2- Any example code anywhere I could look at ?

(I know it would be easier to use a 16bit PIC but only have a CCS license for the 8 bits PICs)

Thank you!
RNR
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Dec 19, 2014 2:51 pm     Reply with quote

It has a 16-bit time base, but I don't see any CCS functions to support
the PSMC controller in the 16F1786.h file. I think you will have to write
your own functions, and write to the PSMC registers.

Are you sure you need that PIC ? Here is a method to get more
resolution for servo pulses, by using the CCP Compare module:
http://www.ccsinfo.com/forum/viewtopic.php?t=44328
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Fri Dec 19, 2014 3:18 pm     Reply with quote

Quote:

control a servo motor


"servo" covers Lot of territory and you are not very specific.

are we talking about a model airplane style
pulse width- proportional type
positioning servo here ?

though you are calling this "PWM" is it in reality to produce
position control pulses of high resolution and precision?

can you state the make and model of your servo?
RNR107



Joined: 19 Dec 2014
Posts: 23

View user's profile Send private message

PostPosted: Mon Dec 22, 2014 2:53 am     Reply with quote

asmboy wrote:

"servo" covers Lot of territory and you are not very specific.

are we talking about a model airplane style
pulse width- proportional type
positioning servo here ?

though you are calling this "PWM" is it in reality to produce
position control pulses of high resolution and precision?

can you state the make and model of your servo?


Hi ASMBoy,
The sevo I am using is positioning servo used on model planes I think.
It's an S3001 from Futaba.
It requieres a 20ms periode PWM signal and I am only interested in pulses between 1.2ms and 1.9ms (6 to 9.5% duty).

RNR
RNR107



Joined: 19 Dec 2014
Posts: 23

View user's profile Send private message

PostPosted: Mon Dec 22, 2014 2:56 am     Reply with quote

PCM programmer wrote:
It has a 16-bit time base, but I don't see any CCS functions to support
the PSMC controller in the 16F1786.h file. I think you will have to write
your own functions, and write to the PSMC registers.

Are you sure you need that PIC ? Here is a method to get more
resolution for servo pulses, by using the CCP Compare module:
http://www.ccsinfo.com/forum/viewtopic.php?t=44328


Hi PCM Programmer,
This could be an option as long as it let me change the duty on the fly witout losing any pulses during the change...
I'll have a look at that. Could be just what I need... :-) Thank you!

RNR
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group