Presentation is loading. Please wait.

Presentation is loading. Please wait.

通訊三甲 B09622022 湯智瑋 通訊實驗 - 遙控車程式 ( 三 ). Outline Main ( ) : 主程式 System_Initial ( ) : 系統初始化 A2D( ) : ADC PPM( ) : 輸出 PPM 訊號 Output_high ( ) : 輸出 PPM 訊號的.

Similar presentations


Presentation on theme: "通訊三甲 B09622022 湯智瑋 通訊實驗 - 遙控車程式 ( 三 ). Outline Main ( ) : 主程式 System_Initial ( ) : 系統初始化 A2D( ) : ADC PPM( ) : 輸出 PPM 訊號 Output_high ( ) : 輸出 PPM 訊號的."— Presentation transcript:

1 通訊三甲 B09622022 湯智瑋 通訊實驗 - 遙控車程式 ( 三 )

2 Outline Main ( ) : 主程式 System_Initial ( ) : 系統初始化 A2D( ) : ADC PPM( ) : 輸出 PPM 訊號 Output_high ( ) : 輸出 PPM 訊號的 high Output_low ( ) : 輸出 PPM 訊號的 low

3 Outline Main ( ) : 主程式 System_Initial ( ) : 系統初始化 A2D( ) : ADC PPM( ) : 輸出 PPM 訊號 Output_high ( ) : 輸出 PPM 訊號的 high Output_low ( ) : 輸出 PPM 訊號的 low

4 4 System_Initial ( ) void System_Initial(void) { /* Oscillator Initial */ OSCICN=0x83; // Internal Oscillator Enabled and SYSCLK derived by 1 (P.117) CLKSEL=0x00; // Selected Clock from Internal Oscillator (P.123) /* PCA0 Initial*/ PCA0MD&=~0x40; // WDTE = 0 (clear watchdog timer enable IN ORDER TO CHANGE PCA0MD) (P.241) /* Timer Initial */ IE = 0x82; // Enable All Interrupts and interrupt requests generated by the TF0 flag (P.90) TMOD = 0x11; // Use Timer1 Mode1 and Timer0 Mode1 (P.214) /* ADC0 Initial */ AMX0P = 0x02; // Select positive channel : P1.2 (P.45) AMX0N = 0x1F; // Select negative channel : GND (ADC in Single-Ended Mode) (P.46) ADC0CF = 0xF8; // SAR clock = 31 and Data in ADC0H:ADC0L registers are right-justified (P.47) ADC0CN = 0x80; // ADC0 Enabled and ADC0 conversion initiated on every write of '1' to AD0BUSY... (P.48) REF0CN = 0x08; // VDD use as Voltage reference (P.55) /* I/O Port Initial */ P1MDIN = 0xE3;// Corresponding P1.2 、 P1.3 and P1.4 pin are configured as an analog input (P.133) P2MDOUT = 0x01;// Corresponding P2.0 Output is push-pull (P.135) P1SKIP = 0x1C;// Corresponding P1.2 、 P1.3 and P1.4 pin are skipped by the Crossbar (P.134) XBR1 = 0x40;// Crossbar enabled (P.131) }

5 參考資料 實驗講義 PPT 助教指導 指導老師 : 田慶誠老師


Download ppt "通訊三甲 B09622022 湯智瑋 通訊實驗 - 遙控車程式 ( 三 ). Outline Main ( ) : 主程式 System_Initial ( ) : 系統初始化 A2D( ) : ADC PPM( ) : 輸出 PPM 訊號 Output_high ( ) : 輸出 PPM 訊號的."

Similar presentations


Ads by Google