1.00 PLL1 No PLL PreScaler Divide By 1 1.00 PLL2 Divide By 2(8MHz oscillator input) 1.00 PLL3 Divide By 3(12MHz oscillator input) 1.00 PLL4 Divide By 4(16MHz oscillator input) 1.00 PLL5 Divide By 5(20MHz oscillator input) 1.00 PLL6 Divide By 6(24MHz oscillator input) 1.00 PLL10 Divide By 10(40MHz oscillator input) 1.00 PLL12 Divide By 12(48MHz oscillator input)
1.03 CPUDIV1 No System Clock Postscaler 1.03 CPUDIV2 System Clock by 2 1.03 CPUDIV3 System Clock by 3 1.03 CPUDIV4 System Clock by 4
1.05 NOUSBDIV USB clock source comes from primary oscillator 1.05 USBDIV USB clock source comes from PLL divide by 2
1.08 XT Crystal osc <= 4MHz for PCM/PCH , 3mhz to 10 MHz for PCD 1.08 XTPLL Crystal/Resonator with PLL enabled 1.08 EC_IO External clock 1.08 EC External clock with CLKOUT 1.08 ECPLL_IO External Clock with PLL enabled, I/O on RA6 1.08 ECPLL External Clock with PLL enabled and Fosc/4 on RA6 1.08 INTRC_IO Internal RC Osc, no CLKOUT 1.08 INTRC Internal RC Osc 1.08 INTXT Internal Oscillator, XT used by USB 1.08 INTHS Internal Oscillator, HS used by USB 1.08 HS High speed Osc (> 4MHz for PCM/PCH) (>10MHz for PCD) 1.08 HSPLL High Speed Crystal/Resonator with PLL enabled
4 MHz
48 MHz
4 MHz
2
USDIV: USDIV=1. La seal de reloj pasa por el PLL Prescaler PLL1: PLLDIV=000 (%1). Entrada PLL Prescaler (4 MHz). Salida PLL Prescaler (4MHz) CPUDIV1: CPUDIV=00 (%1). Se mantienen los 4 MHz para temporizar el sistema (CPU)
1.15 NOIESO Internal External Switch Over mode disabled 1.15 IESO Internal External Switch Over mode enabled
2.00 PUT Power Up Timer 2.00 NOPUT No Power Up Timer
2.01 NOBROWNOUT No brownout reset 2.01 BROWNOUT_SW Brownout controlled by configuration bit in special file register 2.01 BROWNOUT_NOSL Brownout enabled during operation, disabled during SLEEP 2.01 BROWNOUT Reset when brownout detected
2.03 BORV45 Brownout reset at 4.5V 2.03 BORV43 Brownout reset at 4.3V 2.03 BORV27 Brownout reset at 2.7V 2.03 BORV20 Brownout reset at 2.0V
2.05 NOVREGEN USB voltage regulator disabled 2.05 VREGEN USB voltage regulator enabled
2.08 NOWDT No Watch Dog Timer 2.08 WDT Watch Dog Timer
2.09 WDT1 Watch Dog Timer uses 1:1 Postscale 2.09 WDT2 Watch Dog Timer uses 1:2 Postscale 2.09 WDT4 Watch Dog Timer uses 1:4 Postscale 2.09 WDT8 Watch Dog Timer uses 1:8 Postscale 2.09 WDT16 Watch Dog Timer uses 1:16 Postscale 2.09 WDT32 Watch Dog Timer uses 1:32 Postscale 2.09 WDT64 Watch Dog Timer uses 1:64 Postscale 2.09 WDT128 Watch Dog Timer uses 1:128 Postscale 2.09 WDT256 Watch Dog Timer uses 1:256 Postscale 2.09 WDT512 Watch Dog Timer uses 1:512 Postscale 2.09 WDT1024 Watch Dog Timer uses 1:1024 Postscale 2.09 WDT2048 Watch Dog Timer uses 1:2048 Postscale 2.09 WDT4096 Watch Dog Timer uses 1:4096 Postscale 2.09 WDT8192 Watch Dog Timer uses 1:8192 Postscale 2.09 WDT16384 Watch Dog Timer uses 1:16384 Postscale 2.09 WDT32768 Watch Dog Timer uses 1:32768 Postscale 3
3.08 CCP2B3 CCP2 input/output multiplexed with RB3 3.08 CCP2C1 CCP2 input/output multiplexed with RC1
3.09 NOPBADEN PORTB pins are configured as digital I/O on RESET 3.09 PBADEN PORTB pins are configured as analog input channels on RESET
3.10 NOLPT1OSC Timer1 configured for higher power operation 3.10 LPT1OSC Timer1 configured for low-power operation
3.15 NOMCLR Master Clear pin used for I/O 3.15 MCLR Master Clear pin enabled
4.00 NOSTVREN Stack full/underflow will not cause reset 4.00 STVREN Stack full/underflow will cause reset
4.02 NOLVP No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O 4.02 LVP Low Voltage Programming on B3(PIC16) or B5(PIC18)
7.00 EBTR Memory protected from table reads 7.00 NOEBTR Memory not protected from table reads
7.14 EBTRB Boot block protected from table reads 7.14 NOEBTRB Boot block not protected from table reads
PRCTICA Nro. 1: Encendido y apagado de un LED en RBO
/*---------------------------------------------------------------------------------------------*/ /* Ciclo de encendido (1s) y apagado (1s)de un LED conectado en RB0 */ /*---------------------------------------------------------------------------------------------*/ #include <18F4550.h> #fuses PLL1,CPUDIV1,USBDIV,XT,NOFCMEN,NOIESO,PUT,NOBROWNOUT,NOWDT,CCP2C1 #fuses NOPBADEN,NOLPT1OSC,MCLR,STVREN,NOLVP,NOXINST,NODEBUG,NOPROTECT #fuses NOCPB,NOCPD,NOWRT,NOWRTC,NOWRTB,NOWRTD,NOEBTR,NOEBTRB #use delay (clock=4M)
void main() { 5
while(TRUE) { output_bit(PIN_B0,1); // Enciende LED en RB0. Tb output_high(PIN_B0) delay_ms(1000); // Retardo de 1000 ms output_bit(PIN_B0,0); // Apaga LED en RB0 delay_ms(1000); // Retardo de 1000 ms } }
PRCTICA Nro. 2: Encendido y apagado de un LED en RBO
/*----------------------------------------------------------------------*/ /* Encendido y apagado de un led en RB2 con */ /* pulsadores en RB0 y RB1. */ /*----------------------------------------------------------------------*/ #include <18F4550.h> #fuses PLL1,CPUDIV1,USBDIV,XT,NOFCMEN,NOIESO,PUT,NOBROWNOUT,NOWDT,CCP2C1 #fuses NOPBADEN,NOLPT1OSC,MCLR,STVREN,NOLVP,NOXINST,NODEBUG,NOPROTECT #fuses NOCPB,NOCPD,NOWRT,NOWRTC,NOWRTB,NOWRTD,NOEBTR,NOEBTRB #use delay (clock=4M)
/*--------------------------------------------------------------------------*/ /* EL RESULTADO DE LA CONVERSIN A/D DEL CANAL0 */ /* SE MUESTRA EN EL PUERTO B Y PUERTO C */ /*--------------------------------------------------------------------------*/ #include <18F4550.h> #fuses PLL1,CPUDIV1,USBDIV,XT,NOFCMEN,NOIESO,PUT,NOBROWNOUT,NOWDT,CCP2C1 #fuses NOPBADEN,NOLPT1OSC,MCLR,STVREN,NOLVP,NOXINST,NODEBUG,NOPROTECT #fuses NOCPB,NOCPD,NOWRT,NOWRTC,NOWRTB,NOWRTD,NOEBTR,NOEBTRB #device ADC=10 #use delay (clock=4M) /*----------------------------------------------------------------------*/ void main() { int16 adcValue; int8 i; setup_adc_ports(AN0); setup_adc(ADC_CLOCK_INTERNAL); do { set_adc_channel(0); delay_us(20); // Retardo para carga del condensador de muestreo
adcValue=read_adc(); // Lee el resultado de la conversin output_b(adcValue); // Parte baja de la conversin a PORTB for (i=0;i<8;i++) rotate_right(&adcValue,2); // shift_right(&adcValue,2,1); output_c(adcValue); // Parte alta de la conversin a PORTC 8
/*----------------------------------------------------------------------*/ /* Temperatura actual por canal 0 y LM35 */ /* Temperatura a mantener se cambia con RA4 */ /*----------------------------------------------------------------------*/ #include <18F4550.h> #fuses PLL1,CPUDIV1,USBDIV,XT,NOFCMEN,NOIESO,PUT,NOBROWNOUT,NOWDT,CCP2C1 #fuses NOPBADEN,NOLPT1OSC,MCLR,STVREN,NOLVP,NOXINST,NODEBUG,NOPROTECT #fuses NOCPB,NOCPD,NOWRT,NOWRTC,NOWRTB,NOWRTD,NOEBTR,NOEBTRB #device ADC=10 #use delay (clock=4M) #include <LCD.C> // Libreria LCD.C sin modificar. LCD en PORTD
#byte TRISA=0xF92 // se define el registro TRISA como byte #byte TRISB=0xF93 #bit RA4=0xF80.4 #bit RB0=0xF81.0
PRCTICA Nro. 5: Conmutador, usando funcin rebote(). Librera LCD.C, sin cambiar. Pines de LCD cambiados en el programa, mediante directivas y antes de la llamada a la librera.
/*----------------------------------------------------------------------*/ /* Temperatura actual por canal 0 y LM35 */ /* Temperatura a mantener se cambia con RA4 */ /*----------------------------------------------------------------------*/ #include <18F4550.h> #fuses PLL1,CPUDIV1,USBDIV,XT,NOWDT,NOPBADEN,MCLR,NOLVP,NODEBUG,NOPROTECT #fuses NOFCMEN,PUT,NOBROWNOUT,CCP2C1,NOLPT1OSC,STVREN,NOXINST,NOCPB,NOCPD,NOWRT,NOWRTC,NOWRT B,NOWRTD,NOEBTR,NOEBTRB #device ADC=10 #use delay (clock=4M)