欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 2527|回復: 1
打印 上一主題 下一主題
收起左側

圓坐標的計算stm32程序

[復制鏈接]
跳轉到指定樓層
樓主
ID:391283 發表于 2018-8-29 17:01 | 只看該作者 回帖獎勵 |正序瀏覽 |閱讀模式
圓坐標的計算

單片機源程序如下:
  1. #include "sys.h"
  2. #include "delay.h"
  3. #include "math.h"
  4. #include "USART.h"



  5. long  XPoint[90];
  6. long  YPoint[90];
  7. unsigned int Index;
  8. unsigned int j;
  9. unsigned int R;
  10. unsigned char Layer;


  11. int main(void)
  12. {
  13.         Stm32_Clock_Init(9);
  14.         uart_init(72,115200);
  15.         Delay_Init(72);       
  16.        
  17.        
  18. //        for(Index=0;Index<180;Index+=2)
  19. //        {
  20. //                UART_Send_Str("G1 ");
  21. //                XPoint[j] = (uint16 )(25000+4000*cos(Index*3.14/180));                //圓心坐標(25000,8500)        R=2500
  22. //                UART_Send_Str("X");
  23. //                UART_Put_Num(XPoint[j]);
  24. //                UART_Send_Str(" ");
  25. //               
  26. //                YPoint[j] = (uint16 )( 8500+4000*sin(Index*3.14/180));                //R=4000Pulse
  27. //                UART_Send_Str("Y");
  28. //                UART_Put_Num(YPoint[j]);
  29. //                UART_Send_Str(" ");
  30. //                UART_Send_Enter();
  31. //               
  32. //                j++;
  33. //        }
  34.        
  35.         UART_Send_Str(" ");
  36.         while(1)
  37.         {
  38.                
  39.                 for(R=4000;R>0;R-=40)
  40.                 {
  41.                         Layer++;
  42.                         UART_Send_Str(";LAYER:");
  43.                         UART_Put_Num(Layer);
  44.                         UART_Send_Enter();
  45.                        
  46.                         for(Index=0;Index<180;Index+=2)
  47.                         {
  48.                                 UART_Send_Str("G1 ");
  49.                                 XPoint[j] = (uint16 )(25000+R*cos(Index*3.14/180));                //圓心坐標(25000,8500)        R=2500
  50.                                 UART_Send_Str("X");
  51.                                 UART_Put_Num(XPoint[j]);
  52.                                 UART_Send_Str(" ");
  53.                                
  54.                                 YPoint[j] = (uint16 )( 8500+R*sin(Index*3.14/180));                //R=4000Pulse
  55.                                 UART_Send_Str("Y");
  56.                                 UART_Put_Num(YPoint[j]);
  57.                                 UART_Send_Str(" ");
  58.                                 UART_Send_Enter();
  59.                                
  60.                                 j++;
  61.                         }
  62.                         j=0;
  63.                        
  64.                        
  65.                         Layer++;
  66.                         UART_Send_Str(";LAYER:");
  67.                         UART_Put_Num(Layer);
  68.                         UART_Send_Enter();
  69.                        
  70.                         for(Index=180;Index>0;Index-=2)
  71.                         {
  72.                                 UART_Send_Str("G1 ");
  73.                                 XPoint[j] = (uint16 )(25000+R*cos(Index*3.14/180));                //圓心坐標(25000,8500)        R=2500
  74.                                 UART_Send_Str("X");
  75.                                 UART_Put_Num(XPoint[j]);
  76.                                 UART_Send_Str(" ");
  77.                                
  78.                                 YPoint[j] = (uint16 )( 8500+R*sin(Index*3.14/180));                //R=4000Pulse
  79.                                 UART_Send_Str("Y");
  80.                                 UART_Put_Num(YPoint[j]);
  81.                                 UART_Send_Str(" ");
  82.                                 UART_Send_Enter();
  83.                                
  84.                                 j++;
  85.                         }
  86.                         j=0;
  87.                        
  88.                        
  89.                 }
  90.                
  91.         }
  92. }


復制代碼

所有資料51hei提供下載:
CirclePoint.rar (21.36 KB, 下載次數: 8)


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

沙發
ID:1 發表于 2018-8-29 18:44 | 只看該作者
補全原理圖或者詳細說明一下電路連接即可獲得100+黑幣
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表