1 / 12

3D 加速器與 RTC

3D 加速器與 RTC. 範例程式. 由網站下載 LCM-RTC-mma.rar 編譯執行. 實驗. 轉動發展板 觀查 X,Y,Z 值與位置的關係. 水平靜止狀態. Z. X. G. 斜置靜止狀態. Z=G * cos. 傾斜角度. X=G * sin. G. lcm_disp_int_10(2, Coordinates[1]); lcm_disp_int_10(3, Coordinates[2]); lcm_disp_int_10(4, Coordinates[0]);.

Download Presentation

3D 加速器與 RTC

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. 3D加速器與RTC

  2. 範例程式 • 由網站下載LCM-RTC-mma.rar • 編譯執行

  3. 實驗 • 轉動發展板 • 觀查X,Y,Z值與位置的關係

  4. 水平靜止狀態 Z X G

  5. 斜置靜止狀態 Z=G * cos 傾斜角度 X=G * sin G

  6. lcm_disp_int_10(2, Coordinates[1]); • lcm_disp_int_10(3, Coordinates[2]); • lcm_disp_int_10(4, Coordinates[0]);

  7. x = x + (Coordinates[1] - x_base)/KFACTOR; //x • y = y + (Coordinates[2] - y_base)/KFACTOR; //y • z = z + (Coordinates[0] - z_base)/KFACTOR; //z

  8. // calibrate • for(g=0; g<64; g++) { • GetCoordinates(); • } • x_base = Coordinates[1]; • z_base = Coordinates[0]; • y_base = Coordinates[2];

  9. while(1) { • // unsigned int i; • // mma and ball ------------------------------------------------------------ • GetCoordinates(); • // with calibrate when start • x = x + (Coordinates[1] - x_base)/KFACTOR; //x • y = y + (Coordinates[2] - y_base)/KFACTOR; //y • z = z + (Coordinates[0] - z_base)/KFACTOR; //z • // unsigned int i; • char min=0, hour=0; • if (sec >= 60 ) • {sec=0; • min=min+1;

  10. void main( void ) • { • char min=0, hour=0; • // variables • // r - row variable, c - column variable • char x=128, y=128, z=128; • // g - temp variable • char g;

More Related