اطلاعیه

Collapse
No announcement yet.

مشکل با tm1803

Collapse
X
 
  • فیلتر
  • زمان
  • Show
Clear All
new posts

    مشکل با tm1803

    سلام از دوشتان کسی باtm1803 کار کرده راهنماییم کنه برا راه اندازیش؟من با بیسکام کار میکنم :cry:
    { خلاف قوانین - پاک شد }

    #2
    پاسخ : مشکل با tm1803

    همچین کدی رو توی نت پیدا کردم با c نمیدونم اصلا چیه کسی سر در میاره؟

    [code=cpp]

    /************************************************** *************************/
    // Hardware: RadioShack Tricolor LED Strip
    // Arduino IDE: Arduino-1.0
    // Date: April 17, 2013
    // Copyright© 2013 RadioShack Corporation
    //
    // This library is free software; you can redistribute it and/or
    // modify it under the terms of the GNU Lesser General Public
    // License as published by the Free Software Foundation; either
    // version 2.1 of the License, or (at your option) any later version.
    //
    // This library is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    // Lesser General Public License for more details.
    //
    // You should have received a copy of the GNU Lesser General Public
    // License along with this library; if not, see <http://www.gnu.org/licenses/>
    //
    /************************************************** ***************************/

    #include <avr/pgmspace.h>

    // ******** DEBUG ==== should auto config to adapt different mother board *********
    //#define DATA_1 (PORTF |= 0X01) // DATA 1 // for ATMEGA
    //#define DATA_0 (PORTF &= 0XFE) // DATA 0 // for ATMEGA
    //#define STRIP_PINOUT DDRF=0xFF // for ATMEGA
    #define DATA_1 (PORTC |= 0X01) // DATA 1 // for UNO
    #define DATA_0 (PORTC &= 0XFE) // DATA 0 // for UNO
    #define STRIP_PINOUT (DDRC=0xFF) // for UNO

    PROGMEM const unsigned long pattern_test_red[10][10]={
    {0xff0000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0xff0000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0xff0000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0xff0000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0xff0000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0xff 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0xff0000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0xff0000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0xff0000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0xff0000},
    };

    PROGMEM const unsigned long pattern_test_blue[10][10]={
    {0x00ff00,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x00ff00,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x00ff00,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x00ff00,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x00ff00,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 ff00,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x00ff00,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x00ff00,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x00ff00,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x00ff00},
    };

    PROGMEM const unsigned long pattern_test_green[10][10]={
    {0x0000ff,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x0000ff,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x0000ff,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x0000ff,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x0000ff,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 00ff,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x0000ff,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x0000ff,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x0000ff,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x0000ff},
    };

    PROGMEM const unsigned long pattern_test_white[10][10]={
    {0xffffff,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0xffffff,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0xffffff,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0xffffff,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0xffffff,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0xff ffff,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0xffffff,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0xffffff,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0xffffff,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0xffffff},
    };

    PROGMEM const unsigned long pattern_test_comet1[][10]={
    {0xffffff,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x444444,0xffffff,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x111111,0x444444,0xffffff,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x111111,0x444444,0xffffff,0x000000,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x111111,0x444444,0xffffff,0x00 0000,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x111111,0x444444,0xff ffff,0x000000,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x111111,0x44 4444,0xffffff,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x11 1111,0x444444,0xffffff,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x111111,0x444444,0xffffff,0x000000},
    {0x000000,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x111111,0x444444,0xffffff},
    };

    PROGMEM const unsigned long pattern_test_comet2[][10]={
    {0xffffff,0x000000,0x000000,0x111111,0x444444,0xff ffff,0x000000,0x000000,0x000000,0x000000},
    {0x444444,0xffffff,0x000000,0x000000,0x111111,0x44 4444,0xffffff,0x000000,0x000000,0x000000},
    {0x111111,0x444444,0xffffff,0x000000,0x000000,0x11 1111,0x444444,0xffffff,0x000000,0x000000},
    {0x000000,0x111111,0x444444,0xffffff,0x000000,0x00 0000,0x111111,0x444444,0xffffff,0x000000},
    {0x000000,0x000000,0x111111,0x444444,0xffffff,0x00 0000,0x000000,0x111111,0x444444,0xffffff},
    {0xffffff,0x000000,0x000000,0x111111,0x444444,0xff ffff,0x000000,0x000000,0x000000,0x000000},
    {0x444444,0xffffff,0x000000,0x000000,0x111111,0x44 4444,0xffffff,0x000000,0x000000,0x000000},
    {0x111111,0x444444,0xffffff,0x000000,0x000000,0x11 1111,0x444444,0xffffff,0x000000,0x000000},
    {0x000000,0x111111,0x444444,0xffffff,0x000000,0x00 0000,0x111111,0x444444,0xffffff,0x000000},
    {0x000000,0x000000,0x111111,0x444444,0xffffff,0x00 0000,0x000000,0x111111,0x444444,0xffffff},
    };

    PROGMEM const unsigned long pattern_test_comet3[][10]={
    {0xffffff,0x000000,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0x000000,0xffffff},
    {0x444444,0xffffff,0x000000,0x000000,0x000000,0x00 0000,0x000000,0x000000,0xffffff,0x444444},
    {0x111111,0x444444,0xffffff,0x000000,0x000000,0x00 0000,0x000000,0xffffff,0x444444,0x111111},
    {0x000000,0x111111,0x444444,0xffffff,0x000000,0x00 0000,0xffffff,0x444444,0x111111,0x000000},
    {0x000000,0x000000,0x111111,0x444444,0xffffff,0xff ffff,0x444444,0x111111,0x000000,0x000000},
    {0x000000,0x000000,0x111111,0x444444,0xffffff,0xff ffff,0x444444,0x111111,0x000000,0x000000},
    {0x000000,0x000000,0x000000,0xffffff,0x444444,0x44 4444,0xffffff,0x000000,0x000000,0x000000},
    {0x000000,0x000000,0xffffff,0x444444,0x111111,0x11 1111,0x444444,0xffffff,0x000000,0x000000},
    {0x000000,0xffffff,0x444444,0x111111,0x000000,0x00 0000,0x111111,0x444444,0xffffff,0x000000},
    {0xffffff,0x444444,0x111111,0x000000,0x000000,0x00 0000,0x000000,0x111111,0x444444,0xffffff},
    };

    PROGMEM const unsigned long pattern_test_rainbow[10][10]={
    {0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f 00ff,0x8f00ff,0x000000,0x000000,0x000000},
    {0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x00 00ff,0x6f00ff,0x8f00ff,0x000000,0x000000},
    {0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00 ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000},
    {0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xff ff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff},
    {0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff 7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff},
    {0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff 0000,0xff7f00,0xffff00,0x00ff00,0x0000ff},
    {0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x00 0000,0xff0000,0xff7f00,0xffff00,0x00ff00},
    {0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x00 0000,0x000000,0xff0000,0xff7f00,0xffff00},
    {0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x00 0000,0x000000,0x000000,0xff0000,0xff7f00},
    {0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f 00ff,0x000000,0x000000,0x000000,0xff0000},
    };




    // ************************************************** ************************************************** *******
    // *
    // * Power Up Init.
    // *
    // *
    // ************************************************** ************************************************** *******
    void setup() {

    STRIP_PINOUT; // set output pin - DEBUG: should auto detect which mother board for use

    reset_strip();
    //noInterrupts();

    }



    // ************************************************** ************************************************** *******
    // *
    // * Main Loop
    // *
    // *
    // ************************************************** ************************************************** *******
    void loop()
    {

    send_1M_pattern(pattern_test_red, 10, 500);
    delay(500);
    send_1M_pattern(pattern_test_blue, 10, 500);
    delay(500);
    send_1M_pattern(pattern_test_green, 10, 500);
    delay(500);
    send_1M_pattern(pattern_test_white, 10, 500);
    delay(500);
    send_1M_pattern(pattern_test_comet1, 10, 70);
    delay(500);
    send_1M_pattern(pattern_test_comet2, 10, 70);
    delay(500);
    send_1M_pattern(pattern_test_comet3, 10, 70);
    delay(500);

    while (1)
    {
    send_1M_pattern(pattern_test_rainbow, 10, 70);
    }


    /*
    frame++;
    if(frame<=10) LEDSTRIP_PATTERN_0();
    if(10<frame<=20) LEDSTRIP_PATTERN_0();
    if(20<frame<=30) LEDSTRIP_PATTERN_0();
    if(frame>30) frame=1;
    */
    //delay(1);
    }


    /************************************************** *****************************
    * Function Name : send_1M_pattern
    * Description : Transmit pattern to whole 1 meter strip
    *
    * Input : pointer to ROM pattern; pattern length; frame rate
    *
    * Output : None
    * Return : None
    ************************************************** *****************************/
    void send_1M_pattern(const unsigned long data[][10], int pattern_no, int frame_rate)
    {
    int i=0;
    int j=0;
    uint32_t temp_data;

    for (i=0;i<pattern_no;i++)
    {
    noInterrupts();
    for (j=0;j<10;j++)
    {
    temp_data=pgm_read_dword_near(&data[i][j]);
    send_strip(temp_data);
    }
    interrupts();

    delay(frame_rate);

    }
    }


    /************************************************** *****************************
    * Function Name : send_strip
    * Description : Transmit 24 pulse to LED strip
    *
    * Input : 24-bit data for the strip
    *
    * Output : None
    * Return : None
    ************************************************** *****************************/
    void send_strip(uint32_t data)
    {
    int i;
    unsigned long j=0x800000;


    for (i=0;i<24;i++)
    {
    if (data & j)
    {
    DATA_1;
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"

    /*----------------------------*/
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    /*----------------------------*/
    DATA_0;
    }
    else
    {
    DATA_1;
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    DATA_0;
    /*----------------------------*/
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    __asm__("nop\n\t"
    /*----------------------------*/
    }

    j>>=1;
    }



    }

    /************************************************** *****************************
    * Function Name : reset_strip
    * Description : Send reset pulse to reset all color of the strip
    *
    * Input : None
    *
    * Output : None
    * Return : None
    ************************************************** *****************************/
    void reset_strip()
    {
    DATA_0;
    delayMicroseconds(20);
    }
    [/code]
    { خلاف قوانین - پاک شد }

    دیدگاه


      #3
      پاسخ : مشکل با tm1803

      تا جایی که میدونم طریقه برنامه نویسیش به مانند WS2811 هست.تو نت منبع فارسی هم هست.به اسم لایت ایران سرچ کن میاد
      Aristar Group - Always And Forever

      دیدگاه


        #4
        پاسخ : مشکل با tm1803

        نوشته اصلی توسط حسین جباری
        تا جایی که میدونم طریقه برنامه نویسیش به مانند WS2811 هست.تو نت منبع فارسی هم هست.به اسم لایت ایران سرچ کن میاد
        lممنون ولی من با اونم کار نکردم شما کار کردی؟من هرچی سرچ زدم چیزی ندیدم
        { خلاف قوانین - پاک شد }

        دیدگاه


          #5
          پاسخ : مشکل با tm1803

          نوشته اصلی توسط r-el
          lممنون ولی من با اونم کار نکردم شما کار کردی؟من هرچی سرچ زدم چیزی ندیدم
          بله کار کردم و خیلی راحت و ساده هست.
          http://for um.lightiran.com

          فاصله بین r و u رو خودتون دستی پاک کنین
          Aristar Group - Always And Forever

          دیدگاه


            #6
            پاسخ : مشکل با tm1803

            ممنون از پاسختون بله خیلیم سادس ولی مشکل اینجاست که من c کار نکردم فقط بیسکام بلدم میتونین کمکم کنین؟
            { خلاف قوانین - پاک شد }

            دیدگاه


              #7
              پاسخ : مشکل با tm1803

              با بسکام نمیشه.بسکام اصلا کد دقیقی نمیده و بدرد پروژه حرفه ای نمیخوره.فقط و فقط با سی و اسمبلی میشه
              Aristar Group - Always And Forever

              دیدگاه

              لطفا صبر کنید...
              X