Home     Company     Products     Services     Community     Download     Store
    [Home arrow Community arrow Forum ]
Community
Community
Login Form





Lost Password?
No account yet? Register
Evidence Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Demo-board PWM APIs (1 viewing) (1) Guests
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Demo-board PWM APIs
#225
della (User)
Fresh Boarder
Posts: 3
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Pavia Birthdate: 1984-09-27
Demo-board PWM APIs 2 Months, 3 Weeks ago Karma: 0  
Hello everybody,
I don't understand how to use the PWM with the demoboard. I've seen that there are 3 functions: EE_pwm_init, EE_pwm_set_duty and EE_pwm_close. When these functions must be called? And the Period is in millisecond or microsecond?
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#228
chris (Moderator)
Moderator
Posts: 14
graphgraph
User Offline Click here to see the profile of this user
Re:Demo-board PWM APIs 2 Months, 3 Weeks ago Karma: 0  
Hi!

First of all you have to know that the PWM used in the demo-board works via the output compare interface. This is good if you want to drive a servomotor, otherwise you should use the PWM interface of the dsPIC on your own.

The code with the API for the PWM with the demo-board should be in ERIKA_INSTALLATION_DIR/ee/pkg/board/ee_flex/inc/ee_board.h file, but unfortunately it seems that something is missing.
Anyhow the period should refer to the period of the timer2 bound to the OC interface, but the is commented.

If you want to drive a servomotor you can try to adapt the code I am attaching, I already used and tested, to the demo-board (just choose the right Output Compare - OC - interfaces).
File Attachment:
File Name: servomotors_on_pwmOC.zip
File Size: 5895

The code as two file to manage the PWM on the OC interface, in order to obtain an abstraction of it, and two file to implement the abstraction of the servomotor (the latter is just a wrapper for the first one, allowing to drive the servomotor in degree).

The init functions should be called before using the start and set functions.

I hope this will help.
Fill free to do any further question.

Regards.
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/10/14 14:48 By chris.
  The administrator has disabled public write access.
#231
della (User)
Fresh Boarder
Posts: 3
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Pavia Birthdate: 1984-09-27
Re:Demo-board PWM APIs 2 Months, 3 Weeks ago Karma: 0  
Thanks for help.
I have to drive DC motor, not servomotor, but your code is very useful for me for the pwm stuff.

In pwmOC.h file is included a microTime.h, may you post also this file?

Regards
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#232
chris (Moderator)
Moderator
Posts: 14
graphgraph
User Offline Click here to see the profile of this user
Re:Demo-board PWM APIs 2 Months, 3 Weeks ago Karma: 0  
Sorry, that was because I extracted that code from an old project of mine.
The lines that are required for the pwmOC.h are just the following:
Code: :

typedef enum {     FCY_2_MHz=2,     FCY_40_MHz=40 } fcy_MHz;



Anyhow I suggest you to have a look at the pwm interfaces that are well-suited for DC motors driving.
Here's the _link_ to the microchip specific refman

http://ww1.microchip.com/downloads/en/DeviceDoc/70187C.pdf

Bye!
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop
Evidence S.r.l. - PIVA: 01638690501
Via Carducci 64/A - Ghezzano - Pisa - Italy
Privacy Policy