avrsanju
Junior Member level 3
- Joined
- Jul 16, 2010
- Messages
- 29
- Helped
- 7
- Reputation
- 16
- Reaction score
- 11
- Trophy points
- 1,283
- Location
- india
- Activity points
- 1,623
pls explain me the following functions...
Code:
// MPWM Functions: setup_motor_pwm(), set_motor_unit(),
// set_motor_pwm_duty(), set_motor_pwm_event(),
// get_motor_pwm_count()
// MPWM Prototypes:
_bif void setup_motor_pwm(unsigned int8 pwm, unsigned int32 mode, unsigned int32 timebase);
_bif void setup_motor_pwm(unsigned int8 pwm, unsigned int32 mode, unsigned int8 prescale, unsigned int8 postscale, unsigned int16 period);
_bif void set_motor_unit(unsigned int8 pwm, unsigned int8 pin_pair, unsigned int16 mode, unsigned int8 active_deadtime, unsigned int8 inactive_deadtime);
_bif void set_motor_pwm_duty(unsigned int8 pwm, unsigned int8 pin_pair, unsigned int16 duty);
_bif void set_motor_pmw_event(unsigned int8, signed int16 time);
_bif unsigned int16 get_motor_pwm_count(unsigned int8 pwm);
// Constants used in setup_motor_pwm() second param are (first param is unit number 1,2...):
#define MPWM_DISABLED 0
#define MPWM_FREE_RUN 0x8000
#define MPWM_SINGLE_PULSE 0x8001
#define MPWM_UP_DOWN 0x8002
#define MPWM_UP_DOWN_WITH_INTS 0x8003
// OR in any of the following:
#define MPWM_HALT_WHEN_IDLE 0x2000
#define MPWM_DUTY_UPDATES_IMMEADIATE 0x40000
#define MPWM_SYNC_OVERRIDES 0x20000
#define MPWM_DISABLE_UPDATES 0x10000
#define MPWM_LATCH_FAULTS 0x100000
// Constants used in set_motor_unit() third param are: (first param is unit number 1,2... and second param is pwm pin pair 1,2,3 or 4)
#define MPWM_INDEPENDENT 0x0001
#define MPWM_ENABLE 0x0006 // both H and L
#define MPWM_ENABLE_H 0x0004
#define MPWM_ENABLE_L 0x0002
#define MPWM_FORCE_L_0 0x0010
#define MPWM_FORCE_L_1 0x0050
#define MPWM_FORCE_H_0 0x0020
#define MPWM_FORCE_H_1 0x00A0
#define MPWM_FAULTA_LA_HA 0x0700
#define MPWM_FAULTA_LA_HI 0x0500
#define MPWM_FAULTA_LI_HA 0x0600
#define MPWM_FAULTA_LI_HI 0x0400
#define MPWM_FAULTB_LA_HA 0x7000
#define MPWM_FAULTB_LA_HI 0x5000
#define MPWM_FAULTB_LI_HA 0x6000
#define MPWM_FAULTB_LI_HI 0x4000
#define MPWM_FAULT_NO_CHANGE 0x0000
Last edited by a moderator: