This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3200多线程多任务

Other Parts Discussed in Thread: CC3200

各位老师们好,请教一个问题:

CC3200上连接着电机,想用手机WIFI连接CC3200来控制电机的运转,但是电机运转的同时需要监听手机是否发送TCP包(TCP包里面是控制电机运转的指令)。求问有什么方法能够实现电机边运转边监听TCP端口?谢谢啦!~

  • Hi,Tian

    我推荐你创建多任务,按照你所说应该是TCP的优先级更高一些。

    API:

    /*!
        \brief     This function creates a Task.

        Creates a new Task and add it to the last of tasks that are ready to run

        \param    pEntry    -    pointer to the Task Function
        \param    pcName    -    Task Name String
        \param    usStackDepth    -    Stack Size in bytes
        \param    pvParameters    -    pointer to structure to be passed to the Task Function
        \param    uxPriority    -    Task Priority

        \return upon successful creation the function should return 1
                Otherwise, 0 or a negative value indicating the error code shall be returned
        \note
        \warning
    */

    OsiReturnVal_e osi_TaskCreate(P_OSI_TASK_ENTRY pEntry, const signed char * const pcName, unsigned short usStackDepth,
                       void *pvParameters, unsigned long uxPriority, OsiTaskHandle *pTaskHandle)

  • 老师好,这样子如果要监听的时候电机的任务就被自动挂起了吗?这样子的话电机不就不转了...求解释,谢谢啦

  • 任务里面加延时函数,如果一个任务优先级是最高的,又没有延时函数,就会出现这样的情况,看看是不是这样的情况,如果不是,就是其他问题了。

  • 老师,不好意思又打扰了。我把细节讲一下吧。我要控制的是步进电机,需要持续提供PWM方波,利用定时器来停止PWM输出使电机停下来。如果使用任务时间片的话会不会影响到PWM输出还有定时器的定时。就是出现电机转动的时间还没到的时候被挂起,PWM不输出的情况。谢谢老师~麻烦您了