四轴DIY小结

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

DIY   cnmusic@163.net  62  ☺  feng_matrix   MOS  22121000KV30A  GWS1091010109  I2C I2C2  PIDPID0.2  2I2CF22  PII2CIII2C     450450      KeepOutLayer  +     450      450  1.2  2    228  900450150  3    Mega8M8IO88ARM7AT91SAM7S25655Mhz64KB256KBFlash2I2CCRC16    AD  MicroSDAT91SAM7S256SPIEFSLEFSLSDSD  SDM8I2CI2C BootLoaderSDBIN  PPM/SDSDPPM/3/3GPSZigBee21.27       PPM/M816ICPPPM1.5ms8200Hz  I2CICP81.5ms * 8 = 12ms(1.5+2)ms * 8 = 28ms63HzM8PPMI2CM8  PI2  AD10300Hz1033ms  AD2  PI  90900  0ENC‐03        =94 = ‐696100Hz63.3V225           ‐111100%12ADP  P    PI  PI  PIDPPI=080%P  IIP=0IP  IIII  2IPP50505050 P    40I  10  50  1510100Hz300HzExcel     1PPM =219838&page=26#pid3319190    M    //‐‐‐// // PP// Ve// cn// // //‐‐‐#inc#inc#inc#inc  32msM88MN0mai‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐PM /ersion 1.0 nmusic@163AVR Meg‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐lude avr/io.lude avr/intlude util/delude stdlib.hM8 1Mn0‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ .net ga8,‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐h terrupt.h elay.h h AVR M 8M9ISP20 ‐‐‐‐‐‐‐ 8M‐‐‐‐‐‐‐ ega8M8....main1PRES   PPM512MISPSETM8TIME0    #define FEED_DOG                        asm(wdr); #define NOP                                        asm(nop); #define INT_ON                                sei(); #define INT_OFF                                cli();  typedef unsigned char                BOOL; typedef unsigned char                BYTE; typedef unsigned char                CHAR;  #define TRUE                                1 #define FALSE                                0  #define CHANNELCOUNT                1  #define TICK_COUNT_LEAD                        70                        // 0.5ms0640.5ms                                                                                         //    typedef struct tagChannelData {         BYTE                nChannelOutValue;        //          BYTE                nChannelOutStep;        //  }CHANNELDATA;  volatile CHANNELDATA                g_ChannelData[CHANNELCOUNT] = {{0}}; volatile BOOL                                g_bOutAllComplete = TRUE; volatile BYTE                                g_nOutIndex = 0;  // TIME0 // 3 // 0.5ms2ms // TIME0 ISR(TIMER0_OVF_vect)  {         if (g_ChannelData[g_nOutIndex].nChannelOutStep == 0)         {                 PORTD |= (1PD7);                 TCNT0 = 0xFF ‐ TICK_COUNT_LEAD;                 g_ChannelData[g_nOutIndex].nChannelOutStep = 1;         }         else if (g_ChannelData[g_nOutIndex].nChannelOutStep == 1)         {                 TCNT0 = 0xFF ‐ g_ChannelData[g_nOutIndex].nChannelOutValue;                 g_ChannelData[g_nOutIndex].nChannelOutStep = 2;         }         else         {                 PORTD &= ~(1PD7);                 g_nOutIndex++;                  if (g_nOutIndex = CHANNELCOUNT)                 {                         g_bOutAllComplete = TRUE;                         TCCR0 = 0;                 }                 else                 {                         TCNT0 = 0xFF ‐ 1;                 }         } }   int main() {         BYTE                nChannelValueFinal = 0;          DDRD = (1DDD2) | (1DDD3) | (1DDD7);                // PD2PD3PD7          PORTD &= ~((1PD6) | (1PD7));         PORTD |= (1PD3);                        //           INT_ON;                                                //           // 0         TIMSK |= (1TOIE0);                //            while (1)         {                 //                  // PD6                  asm(nop);                                  // TIME2                 TCCR2 = (1CS22);                        // 64                  //                  while (!(PIND & (1PIND6)))                 {                         //asm(nop);                                                // while                 }                                  //                  TCNT2 = 0;                  // 0.5ms                 while (PIND & (1PIND6))                 {                         if (TCNT2 == TICK_COUNT_LEAD)                // 0.5ms                         {                                 TCNT2 = 0;                                 break;                         }                 }                                  //                  while (PIND & (1PIND6))                 {                         //asm(nop);                 }                          //                  TCCR2 = 0;                 nChannelValueFinal = TCNT2 ‐ 2;                        // 16uS                  if ((abs((int)g_ChannelData[0].nChannelOutValue ‐ (int)nChannelValueFinal))  1)                                 {                         g_ChannelData[0].nChannelOutValue = nChannelValueFinal;                //                  }                  g_ChannelData[0].nChannelOutStep = 0;                        //                                                    // 0                 g_nOutIndex = 0;                                                                // 0                 TCNT0 = 0xFF ‐ 1;                                                    

1 / 46
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功