PIC16F18877的PWM 如何做出互補波型?
|
||||
---|---|---|---|---|
新會員
|
#include
#include #include #pragma config FEXTOSC = HS // External Oscillator mode selection bits (HS (crystal oscillator) above 4MHz; PFM set to high power) #pragma config RSTOSC = EXT1X // Power-up default value for COSC bits->EXTOSC operating per FEXTOSC bits #pragma config BOREN = ON // Brown-out reset enable bits (Brown-out Reset Enabled, SBOREN bit is ignored) #pragma config WDTE = OFF // WDT operating mode (WDT Disabled, SWDTEN is ignored) #pragma config CP = OFF // UserNVM Program memory code protection bit (Program Memory code protection disabled) #pragma config CPD = OFF // DataNVM code protection bit (Data EEPROM code protection disabled) void Initialize(void); void main(void) { Initialize(); while (1) { } return; } void Initialize(void) { OSCCON1 = 0x70; OSCFRQ = 0x04; TRISE = 0x07; ANSELE = 0x06; TRISC = 0xFB; RC2PPS = 0x09; T2CLKCON = 0x01; T2HLT = 0x00; T2RST = 0x00; T2PR = 0x72; T2TMR = 0x00; PIR4bits.TMR2IF = 0; T2CON = 0x8F; CCP1CON = 0x8F; CCPR1H = 0x00; CCPR1L = 0x90; CCPTMRS0bits.C1TSEL = 0x1; } 已經摸出如何輸出波行了 但想知道如何一次輸出兩個波型
發表於: 2021/7/21 17:33
|
|||
|