|
Tài trợ cho PIC Vietnam |
Cơ bản về vi điều khiển và PIC Những bài hướng dẫn cơ bản nhất để làm quen với vi điều khiển PIC |
|
Ðiều Chỉnh | Xếp Bài |
23-06-2010, 07:45 PM | #1 |
Đệ tử 4 túi
Tham gia ngày: Jun 2010
Bài gửi: 79
: |
van de khai bao ham fuses
đây là tài liệu mình tìm được để khai bao #fuses cho pic 4331.bác nào biết vào chỉ giúp ý nghĩa của nó với.
#include <18F4431.h> #device adc=8 #FUSES NOWDT //No Watch Dog Timer #FUSES WDT128 //Watch Dog Timer uses 1:128 Postsc #FUSES HS //High speed osc with HW enabled 4X PL #FUSES NOPROTECT //Code not protected from reading #FUSES IESO //Internal External Switch Over mode en #FUSES BROWNOUT //Reset when brownout detected #FUSES BORV27 //Brownout reset at 2.7V #FUSES NOPUT //No Power Up Timer #FUSES NOCPD //No EE protection #FUSES NOSTVREN //Stack full/underflow will not cause reset #FUSES NODEBUG //No Debug mode for ICD #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O #FUSES NOWRT //Program memory not write protected #FUSES NOWRTD //Data EEPROM not write protected #FUSES NOFCMEN //Fail‐safe clock monitor disabled #FUSES NOWINEN //WDT Timer Window Disabled #FUSES T1LOWPOWER //Timer1 low power operation when in sleep #FUSES HPOL_HIGH //High‐Side Transistors Polarity is Active‐High (PWM 1,3,5 and 7) //PWM module high side output pins have active high output polarity #FUSES NOWRTC //configuration not registers write protected #FUSES NOWRTB //Boot block not write protected #FUSES NOEBTR //Memory not protected from table reads #FUSES NOEBTRB //Boot block not protected from table reads #FUSES NOCPB //No Boot Block code protection #FUSES LPOL_HIGH //Low‐Side Transistors Polarity is Active‐Low (PWM 0,2,4 and 6) #FUSES PWMPIN //PWM outputs disabled upon Reset #FUSES MCLR //Master Clear pin enabled #FUSES FLTAC1 //FLTA input is multiplexed with RC1 #FUSES SSP_RD //SCK/SCL=RD3, SDA/SDI=RD2, SDO=RD1 #FUSES PWM4B5 //PWM4 output is multiplexed on RB5 #FUSES EXCLKC3 //TMR0/T5CKI external clock input is muliplexed with RC3 #use delay(clock=10000000) #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bi ts=8) #FUSES HPOL_low //High‐Side Transistors Polarity is Active‐High (PWM 1,3,5 and 7) #FUSES LPOL_low //Low‐Side Transistors Polarity is Active‐Low (PWM 0,2,4 and 6) #locate PTCON0 = 0xF7F #bit PTMOD0 = PTCON0.0 #bit PTMOD1 = PTCON0.1 #bit PTCKPS0 = PTCON0.2 #bit PTCKPS1 = PTCON0.3 #bit PTOPS0 = PTCON0.4 #bit PTOPS1 = PTCON0.5 #bit PTOPS2 = PTCON0.6 #bit PTOPS3 = PTCON0.7 //=========================== #locate PTCON1 = 0xF7E #bit PTEN = PTCON1.7 #locate DTCON = 0xF6D #bit DT0 = DTCON.0 #bit DT1 = DTCON.1 #bit DT2 = DTCON.2 #bit DT3 = DTCON.3 #bit DT4 = DTCON.4 #bit DT5 = DTCON.5 #bit DTPS0 = DTCON.6 #bit CTPS1 = DTCON.7 #locate PTMRL = 0xF7D #locate PTMRH = 0xF7C #locate PTPERL = 0xF7B #locate PTPERH = 0xF7A #locate PDC0L = 0xF79 #locate PDC0H = 0xF78 #locate PDC1L = 0xF77 #locate PDC1H = 0xF76 #locate PDC2L = 0xF75 #locate PDC2H = 0xF74 #locate PDC3L = 0xF73 #locate PDC3H = 0xF72 //=========================== #locate SEVTCMPL = 0xF71#locate SEVTCMPH = 0xF70 #locate PWMCON0 = 0xF6F #bit PMOD0 = PWMCON0.0 #bit PMOD1 = PWMCON0.1 #bit PMOD2 = PWMCON0.2 #bit PMOD3 = PWMCON0.3 #bit PWMEN0 = PWMCON0.4 #bit PWMEN1 = PWMCON0.5 #bit PWMEN2 = PWMCON0.6 //======================================= #locate PWMCON1 = 0xF6E #locate OVDCOND = 0xF6B #bit POVD0 = OVDCOND.0 #bit POVD1 = OVDCOND.1 #bit POVD2 = OVDCOND.2 #bit POVD3 = OVDCOND.3 #bit POVD4 = OVDCOND.4 #bit POVD5 = OVDCOND.5 #bit POVD6 = OVDCOND.6 #bit POVD7 = OVDCOND.7 #locate OVDCONS = 0xF6A #bit POUT0 = OVDCONS.0 #bit POUT1 = OVDCONS.1 #bit POUT2 = OVDCONS.2 #bit POUT3 = OVDCONS.3 #bit POUT4 = OVDCONS.4 #bit POUT5 = OVDCONS.5 #bit POUT6 = OVDCONS.6 #bit POUT7 = OVDCONS.7 void main() { setup_adc_ports(sAN0|VSS_VDD); setup_adc(ADC_CLOCK_INTERNAL|ADC_TAD_MUL_2|ADC_WHE N_INT0|ADC_INT_EVERY_OTHER); setup_spi(SPI_SS_DISABLED); setup_wdt(WDT_OFF); setup_timer_0(RTCC_INTERNAL); setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); PTCON0=0X1f; PTCON1=0X80; //*********************************** PWMCON0=0X47; PWMCON1=0X30; //PWMCON0=0X40; PWMCON1=0X30; PTPERL=0X1F; PTPERH=0X01; //*************************************** //‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ ‐‐‐‐‐‐‐‐pwm0 PDC0L=0X4F; PDC0H=0X01; //--------------------------------duty cycle pwm1 PDC1L=0X4F; PDC1H=0X01; //--------------------------------duty cycle pwm2 PDC2L=0X4F; PDC2H=0X01; |
Ðiều Chỉnh | |
Xếp Bài | |
|
|