Blinker for 16F18446 - OSC settings and PORT addressing
Hi there,
Did anyone already make a "blinker" for 16F18446? Mine won't work at all :confused:
This device supports PPS (Peripheral Pin Select Module) and I this is new to me. Is there any captcha here?
I also don't get the oscillator configuration. This device appearently uses PLL as oscillator. But how do I configure it to have kind of 4 or 8 MHz internal oscillator?
The DS is (again) hard to understand....
Code:
'====== FUSES =====================================================================================
' PIC 16F18446
#CONFIG
__config _CONFIG1, _FEXTOSC_HS & _RSTOSC_EXT1X & _CLKOUTEN_OFF & _CSWEN_OFF & _FCMEN_OFF
__config _CONFIG2, _MCLRE_OFF & _PWRTS_PWRT_64 & _LPBOREN_OFF & _BOREN_SBOREN & _BORV_LO & _ZCDDIS_OFF & _PPS1WAY_OFF & _STVREN_OFF
__config _CONFIG3, _WDTCPS_WDTCPS_31 & _WDTE_SWDTEN & _WDTCWS_WDTCWS_7 & _WDTCCS_LFINTOSC
__config _CONFIG4, _BBSIZE_BB512 & _BBEN_OFF & _SAFEN_OFF & _WRTAPP_OFF & _WRTB_OFF & _WRTC_OFF & _WRTD_OFF & _WRTSAF_OFF & _LVP_OFF
__config _CONFIG5, _CP_OFF
#ENDCONFIG
' ====== DEFINES ===================================================================================
DEFINE OSC 4
' ====== TEST PROGRAM ==============================================================================
TEST:
LATB.6 = 1
pause 500
LATB.6 = 0
pause 500
GOTO TEST
END
Re: Blinker for 16F18446 - OSC settings and PORT addressing
you won't get far blinking pin latb.6 when its defined as an analog input
i assume you are not using a xtal osc
this will do it ,i think [ untested]
Code:
'====== FUSES =====================================================================================
' PIC 16F18446
#CONFIG
__config _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT1 & _CLKOUTEN_OFF & _CSWEN_ON & _FCMEN_ON
__config _CONFIG2, _MCLRE_ON & _PWRTS_PWRT_64 & _LPBOREN_OFF & _BOREN_SBOREN & _BORV_LO & _ZCDDIS_OFF & _PPS1WAY_OFF & _STVREN_ON
__config _CONFIG3, _WDTCPS_WDTCPS_31 & _WDTE_SWDTEN & _WDTCWS_WDTCWS_7 & _WDTCCS_LFINTOSC
__config _CONFIG4, _BBSIZE_BB512 & _BBEN_OFF & _SAFEN_OFF & _WRTAPP_OFF & _WRTB_OFF & _WRTC_OFF & _WRTD_OFF & _WRTSAF_OFF & _LVP_OFF
__config _CONFIG5, _CP_OFF
#ENDCONFIG
' ====== DEFINES ===================================================================================
DEFINE OSC 4
ANSELB = $B0;
TRISB = $B0;
OSCCON1 = $60;
// CSWHOLD may proceed; SOSCPWR Low power;
OSCCON3 = 0
// MFOEN disabled; LFOEN disabled; ADOEN disabled; SOSCEN disabled; EXTOEN disabled; HFOEN disabled;
OSCEN = 0
// HFFRQ 4_MHz;
OSCFRQ = 2;
// HFTUN 0;
OSCTUNE = 0
' ====== TEST PROGRAM ==============================================================================
TEST:
LATB.6 = 1
pause 500
LATB.6 = 0
pause 500
GOTO TEST
END
for osc=8mhz
// HFFRQ 8_MHz; OSCFRQ = 3;
Re: Blinker for 16F18446 - OSC settings and PORT addressing
Replace // with ' or ;
Ioannis
Blinker for 16F18446 - OSC settings and PORT addressing
Guess what: it's blinking now!
Thanks a lot (again).
Yes, I had to replace // by '
Re: Blinker for 16F18446 - OSC settings and PORT addressing
These chips (with PPS registers) need more care to setup correctly. But are very versatile...
Ioannis