1 / 5

通訊實驗 - 遙控車程式 ( 三 )

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

mdickman
Download Presentation

通訊實驗 - 遙控車程式 ( 三 )

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. 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 助教指導 指導老師: 田慶誠老師

More Related