Amigos, na família de PIC's 16F88x existe um recurso de PWM avançado (PWM ENHANCE MODE) capaz de gerar dois ou quatro sinais retangulares para aplicações de pwm simples, half-bridge e full-brigde.
Estive tentanto fazer alguns testes usando o compilador CCS para o PIC 16F886 e, no include device deste pic existem os seguintes comandos para o periférico gerador de sinal PWM:
(continua abaixo)...
////////////////////////////////////////////////////////////////// CCP
// CCP Functions: SETUP_CCPx, SET_PWMx_DUTY
// CCP Variables: CCP_x, CCP_x_LOW, CCP_x_HIGH
// Constants used for SETUP_CCPx() are:
#define CCP_OFF 0
#define CCP_CAPTURE_FE 4
#define CCP_CAPTURE_RE 5
#define CCP_CAPTURE_DIV_4 6
#define CCP_CAPTURE_DIV_16 7
#define CCP_COMPARE_SET_ON_MATCH 8
#define CCP_COMPARE_CLR_ON_MATCH 9
#define CCP_COMPARE_INT 0xA
#define CCP_COMPARE_RESET_TIMER 0xB
#define CCP_PWM 0xC
#define CCP_PWM_PLUS_1 0x1c
#define CCP_PWM_PLUS_2 0x2c
#define CCP_PWM_PLUS_3 0x3c
#word CCP_1 = getenv("SFR:CCPR1L")
#byte CCP_1_LOW= getenv("SFR:CCPR1L")
#byte CCP_1_HIGH= getenv("SFR:CCPR1H")
// The following should be used with the ECCP unit only (or these in)
#define CCP_PWM_H_H 0x0c
#define CCP_PWM_H_L 0x0d
#define CCP_PWM_L_H 0x0e
#define CCP_PWM_L_L 0x0f
#define CCP_PWM_FULL_BRIDGE 0x40
#define CCP_PWM_FULL_BRIDGE_REV 0xC0
#define CCP_PWM_HALF_BRIDGE 0x80
#define CCP_SHUTDOWN_ON_COMP1 0x100000
#define CCP_SHUTDOWN_ON_COMP2 0x200000
#define CCP_SHUTDOWN_ON_COMP 0x300000
#define CCP_SHUTDOWN_ON_INT0 0x400000
#define CCP_SHUTDOWN_ON_COMP1_INT0 0x500000
#define CCP_SHUTDOWN_ON_COMP2_INT0 0x600000
#define CCP_SHUTDOWN_ON_COMP_INT0 0x700000
#define CCP_SHUTDOWN_AC_L 0x000000
#define CCP_SHUTDOWN_AC_H 0x040000
#define CCP_SHUTDOWN_AC_F 0x080000
#define CCP_SHUTDOWN_BD_L 0x000000
#define CCP_SHUTDOWN_BD_H 0x010000
#define CCP_SHUTDOWN_BD_F 0x020000
#define CCP_SHUTDOWN_RESTART 0x80000000
#define CCP_PULSE_STEERING_A 0x01000000
#define CCP_PULSE_STEERING_B 0x02000000
#define CCP_PULSE_STEERING_C 0x04000000
#define CCP_PULSE_STEERING_D 0x08000000
#define CCP_PULSE_STEERING_SYNC 0x10000000
#word CCP_2 = getenv("SFR:CCPR2L")
#byte CCP_2_LOW= getenv("SFR:CCPR2L")
#byte CCP_2_HIGH= getenv("SFR:CCPR2H")
No entanto, após experimentar alguns desses comandos no meu programa, o comportamento do PIC não foi o esperado de acordo com seu datasheet para o modo enhanced.
Alguém já teve alguma experiência de uso com este modelo de PIC ou de alguns modelos de PIC desta família no uso do recurso PWM avançado?
Se já teve, gostaria de saber como configurar corretamente o programa para o PIC trabalhar no modo half bridge.
Obrigado.