久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费
標題:
絕對值多圈編碼器,其中齒輪以格雷碼的方式編碼,但是現(xiàn)在齒輪安裝精度跟不上
[打印本頁]
作者:
yanglonghai
時間:
2019-7-22 10:18
標題:
絕對值多圈編碼器,其中齒輪以格雷碼的方式編碼,但是現(xiàn)在齒輪安裝精度跟不上
這種齒輪很常見,齒輪比4比1,齒輪通過光學漫反射檢測位置信號,是現(xiàn)在市面上最常見的方案
參考資料:
資料.7z
(236 Bytes, 下載次數(shù): 30)
2019-7-23 02:45 上傳
點擊文件名下載附件
希望能得到有效的建議,現(xiàn)在問題是齒輪安裝的時候沒有對照機械零點(市場上應(yīng)該都是這樣,都是通過軟件來彌補),導致其變化不是線性的,計算出來的圈數(shù)會跳變,本人的實現(xiàn)代碼如下,或許描述的不是太準確,希望懂的大佬能夠幫助我一下,已經(jīng)研究幾個月了各種方法都試過了,如果有算法更好,感激不盡
/*******************************************************************************
* 文件名 : light_coding.c
* 作者 : ylh
* 庫版本 : V3.5.0
* 文件版本 : V1.0.0
* 日期 : 2019年04月16日
* 摘要 : 齒輪
********************************************************************************/
#include "light_coding.h"
uint8_t light_cod[6] = {0};
uint8_t result_turn[6] = {0};
void LightCoding_GPIO_Init()
{
GPIO_InitTypeDef GPIO_InitStructure;
// EXTI_InitTypeDef EXTI_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO,ENABLE); //使能端口和復(fù)用IO時鐘
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);//
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO,ENABLE);//
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable,ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;//推挽輸出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);//
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;//推挽輸出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);//
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;//推挽輸出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);//
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;//浮空輸入
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);//
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;//浮空輸入
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);//
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;//浮空輸入
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);//
}
void NVIC_Configuration_LightCoding(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 8; //從優(yōu)先級為0
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
Light_Coding(0x01);
}
//讀光編0x01~0x06;
uint8_t Light_Coding(uint8_t type)
{
uint8_t result = 0;
LED0(type&0x01);
delay_ms(30);
LED1((type&0x02)>>1);
delay_ms(30);
LED2((type&0x04)>>2);
delay_ms(30);
result = (result)|KEY3;
delay_ms(30);
result = (result<<1)|KEY4;
delay_ms(30);
result = (result<<1)|KEY5;
delay_ms(30);
return result;
}
//圈數(shù)轉(zhuǎn)換
void computation(void)
{
int i = 0;
for(i=0;i<6;i++){
switch(light_cod[i])
{
// case 0x00:
// result_turn[i] = 0.5;
// break;
case 0x04:
result_turn[i] = 3;
break;
// case 0x06:
// result_turn[i] = 1.5;
// break;
case 0x07:
result_turn[i] = 0;
break;
// case 0x05:
// result_turn[i] = 2.5;
// break;
case 0x01:
result_turn[i] = 1;
break;
// case 0x03:
// result_turn[i] = 3.5;
// break;
case 0x02:
result_turn[i] = 2;
break;
}
delay_ms(10);
}
}
//計算齒輪總?cè)?shù)
int32_t computation_NUMOFTURN(void)
{
int count = 0;
int32_t NUM_TURN_WG = 0;
while(count<6){
light_cod[count] = Light_Coding(count+0x01);
count++;
}
computation();
NUM_TURN_WG =
result_turn[5]*1024+
result_turn[4]*256+
result_turn[3]*64+
result_turn[2]*16+
result_turn[1]*4+
result_turn[0];
Light_Coding(0x01);
return NUM_TURN_WG;
}
```
復(fù)制代碼
作者:
panjin88
時間:
2019-7-23 15:01
頂起來
作者:
qq1091310989
時間:
2019-7-23 17:29
很好,謝謝樓主
作者:
鵬博士PBs
時間:
2019-7-24 09:16
rolan是簡單的光學測量軟件
作者:
tangsj7678
時間:
2019-7-24 13:07
沒有人來解答嗎,想跟著學習一下
作者:
witheMe
時間:
2019-8-8 10:34
碼住學習
作者:
Tadashi
時間:
2019-8-10 13:51
誰來解答一下,我也想知道
歡迎光臨 (http://www.zg4o1577.cn/bbs/)
Powered by Discuz! X3.1
主站蜘蛛池模板:
久久与欧美
|
精品一二区
|
亚洲小视频在线观看
|
欧州一区
|
99小视频
|
日韩精品一区二区三区在线播放
|
www久久国产
|
欧美性久久久
|
精品欧美激情在线观看
|
欧洲一级毛片
|
国产精品夜色一区二区三区
|
国产一区二区在线免费观看
|
午夜视频在线观看一区二区
|
欧洲一级黄
|
91精品国产综合久久久久久蜜臀
|
另类视频在线
|
在线免费中文字幕
|
久久99精品久久久
|
欧美日韩成人影院
|
国产高清91
|
奇米影视77
|
日韩综合在线
|
美女黄色在线观看
|
日韩亚洲欧美一区
|
天天天天操
|
成人黄色电影在线观看
|
国产视频中文字幕在线观看
|
av资源在线看
|
国产精品呻吟久久av凹凸
|
午夜免费
|
四虎影音
|
国产精品欧美一区二区三区不卡
|
久久精品天堂
|
成人激情视频免费在线观看
|
成人免费一区二区
|
久久精品久久久久久
|
国产精品国产精品
|
99国内精品久久久久久久
|
99精品欧美一区二区三区综合在线
|
亚洲国产免费
|
国产精品久久久久久久久污网站
|