midali
- 27th March 2021, 21:01
Hi,
HPWM work right on PORTA.1 . Also , the PORTA.5 work well like a digitall port.
I want to move the PWM1 from PORTA.1 to PORTA.5 . Theoretically is very simple, must set APFCON.0 =1 .
Now I have a problem because on pin A5 I have nothing, also, the HPWM is missing on pin A.1 .
I changed the PIC from another lot , but the same !
If I set APFCON.1 = 1 , the PWM2 is moved from A.0 to A.4, so the APFCON have an effect.
Something is missing or chip have some trouble ?
#CONFIG
__config _CONFIG1, _FOSC_INTOSC & _WDTE_ON & _PWRTE_ON & _MCLRE_OFF & _CP_ON & _BOREN_OFF & _CLKOUTEN_OFF
__config _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_LO & _LPBOREN_OFF & _LVP_OFF
#ENDCONFIG
DEFINE OSC 4 ' system clock at 4MHz
OSCCON = %01101010
DEFINE HPWM_OSC 16000000 ' PWM clock at 16MHz
APFCON.0 = 1
ANSELA = %00000000
PORTA = %00000000
main:
hpwm 1 , 100, 16000 'PORTA.5
goto main
HPWM work right on PORTA.1 . Also , the PORTA.5 work well like a digitall port.
I want to move the PWM1 from PORTA.1 to PORTA.5 . Theoretically is very simple, must set APFCON.0 =1 .
Now I have a problem because on pin A5 I have nothing, also, the HPWM is missing on pin A.1 .
I changed the PIC from another lot , but the same !
If I set APFCON.1 = 1 , the PWM2 is moved from A.0 to A.4, so the APFCON have an effect.
Something is missing or chip have some trouble ?
#CONFIG
__config _CONFIG1, _FOSC_INTOSC & _WDTE_ON & _PWRTE_ON & _MCLRE_OFF & _CP_ON & _BOREN_OFF & _CLKOUTEN_OFF
__config _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_LO & _LPBOREN_OFF & _LVP_OFF
#ENDCONFIG
DEFINE OSC 4 ' system clock at 4MHz
OSCCON = %01101010
DEFINE HPWM_OSC 16000000 ' PWM clock at 16MHz
APFCON.0 = 1
ANSELA = %00000000
PORTA = %00000000
main:
hpwm 1 , 100, 16000 'PORTA.5
goto main