• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users






Re: encoder
#5
新會員
新會員


查看用戶資訊
Thanks very much.....

發表於: 2005/5/19 10:47
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: encoder
#4
高級會員
高級會員


查看用戶資訊
// fot pic18f452
//
// INTERRUPT 1(JOG1)
if ( INTCON3bits.INT1IF == 1 )
{
INT1_CHATTER=100; // INT0_CHAT = 100 = 抑制雜訊出現的次數
if ( INTCON2bits.INTEDG1==1 )
{
/* rising edge */
while ( (P_JOG1==0)&&(INT1_CHATTER!=0) )
{
INT1_CHATTER--; // 對策雜訊的千擾
Delay10TCYx(10); // Delay 10us
}
while ( (P_JOG1==1)&&(INT1_CHATTER!=0) )
{
F_JOG2 = 1;
if ( P_JOG2 == 0 ) // Save the JOG2 status
F_JOG2 = 0;
INTCON2bits.INTEDG1=0; // Set next trrige is Falling Edge
break;
}
}
else
{
/* falling edge */
while ( (P_JOG1==1)&&(INT1_CHATTER!=0) )
{
INT1_CHATTER--; // 對策雜訊的千擾
Delay10TCYx(10); // Delay 10us
}
while ( (P_JOG1==0)&&(INT1_CHATTER!=0) )
{

/* Level_Low */
if ( ((P_JOG2==0)&&(F_JOG2==0))||((P_JOG2==1)&&(F_JOG2==1)) )
{
//--- 50 齒用
if ( ((P_JOG1==0)&&(F_JOG2==0))||((P_JOG1==1)&&(F_JOG2==1)) )
JOG_CW();
else if ( ((P_JOG1==0)&&(F_JOG2==1))||((P_JOG1==1)&&(F_JOG2==0)) )
JOG_CCW();
}
else if ( ((P_JOG2==0)&&(F_JOG2==1))||((P_JOG2==1)&&(F_JOG2==0)) )
{
if ( F_JOG2 == 1 )
JOG_CW();
else
JOG_CCW();
}
break;
}
}
INTCON3bits.INT1IF=0; // Clear INT0 interrupt flag ;<<JOG>>
}

void JOG_CW()
{
// debug_p3(1);
JOG_BUF++; // BUFF + 1
if ( JOG_SPD.bit7 == 1 )
JOG_SPD.all = 0x01; // 反轉 -> 正轉 -> (ENCSPD)=01H ;<<JOG>>
else
JOG_SPD.all++; // speed counter + 1 ;<<JOG>>
INTCON2bits.INTEDG1=1; // Set next trrige is Rising Edge ;<<JOG>>
}

void JOG_CCW()
{
// debug_p3(1);
JOG_BUF--; // BUFF - 1
if ( JOG_SPD.bit7 == 0 )
JOG_SPD.all = 0x81; // 正轉 -> 反轉 -> (ENCSPD)=81H ;<<JOG>>
else
JOG_SPD.all++; // speed counter + 1 ;<<JOG>>
INTCON2bits.INTEDG1=1; // Set next trrige is Rising Edge ;<<JOG>>
}

發表於: 2005/5/17 19:08
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: encoder
#3
新會員
新會員


查看用戶資訊
encoder--->馬達的ab相位的解碼.....可以判別正反轉...

發表於: 2005/5/17 17:29
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: encoder
#2
版主
版主


查看用戶資訊
何種 Encoder ?? 請說明。

發表於: 2005/5/16 9:46
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


encoder
#1
新會員
新會員


查看用戶資訊
請問能不能提供c18的ender的範例程式...

發表於: 2005/5/14 13:29
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------