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.

在CC1310上想用 Sensor Controller读取DS18B20的温度数据是否能实现?

Other Parts Discussed in Thread: CC1310

在CC1310上想用 Sensor Controller读取DS18B20的温度数据是否能实现?如何实现?有例程吗?

关联到同一个IO脚输入和输出状态的频繁切换。

  • 理論上沒有問題、沒有相關例程、你得自己寫程序
  • scs没有完全开放。

  • 使用普通io就可以了,使用寄存器操作效果比较好,多看英文手册。
  • 没有具体例程,不过你可以看下TI-RTOS里的驱动部分,以了解UART和PIN是否满足1-Wire协议的需要。
  • 这是完全可以做到的,你可以参考SCS里面的toggle gpio那个程序,你就会了啊。
    //***************************************************************************** // SENSOR CONTROLLER STUDIO EXAMPLE: BUTTON DEBOUNCER FOR LAUNCHPAD // Operating system: TI-RTOS // // Demonstrates use of Sensor Controller GPIO and timer event triggers and // event handler code to implement a low-power button debouncer on the // LaunchPad. // // The application is woken once each time the user presses BTN-1. The // application then toggles the red LED on the LaunchPad and returns to // standby. // // // Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/ // // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //****************************************************************************/ #include "ex_include_tirtos.h" #include "scif.h" #define BV(n) (1 << (n)) // Display error message if the SCIF driver has been generated with incorrect operating system setting #ifndef SCIF_OSAL_TIRTOS_H #error "SCIF driver has incorrect operating system configuration for this example. Please change to 'TI-RTOS' in the Sensor Controller Studio project panel and re-generate the driver." #endif // Display error message if the SCIF driver has been generated with incorrect target chip package #ifndef SCIF_TARGET_CHIP_PACKAGE_QFN48_7X7_RGZ #error "SCIF driver has incorrect target chip package configuration for this example. Please change to 'QFN48 7x7 RGZ' in the Sensor Controller Studio project panel and re-generate the driver." #endif // Task data Task_Struct myTask; Char myTaskStack[1024]; // Semaphore used to wait for Sensor Controller task ALERT event static Semaphore_Struct semScTaskAlert; void scCtrlReadyCallback(void) { } // scCtrlReadyCallback void scTaskAlertCallback(void) { // Wake up the OS task Semaphore_post(Semaphore_handle(&semScTaskAlert)); } // scTaskAlertCallback PIN_Config pLedPinTable[] = { Board_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, PIN_TERMINATE }; PIN_State ledPinState; void taskFxn(UArg a0, UArg a1) { PIN_Handle hLedPins; int isLedOn = 0; // Enable LED pins hLedPins = PIN_open(&ledPinState, pLedPinTable); // Initialize the Sensor Controller scifOsalInit(); scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback); scifOsalRegisterTaskAlertCallback(scTaskAlertCallback); scifInit(&scifDriverSetup); // Start the Sensor Controller task (not to be confused with OS tasks) scifStartTasksNbl(BV(SCIF_BUTTON_DEBOUNCER_TASK_ID)); // Main loop while (1) { // Wait for an ALERT callback Semaphore_pend(Semaphore_handle(&semScTaskAlert), BIOS_WAIT_FOREVER); // Clear the ALERT interrupt source scifClearAlertIntSource(); // Toggle LED1 if (isLedOn) { PIN_setOutputValue(hLedPins, Board_RLED, Board_LED_OFF); } else { PIN_setOutputValue(hLedPins, Board_RLED, Board_LED_ON); } isLedOn = !isLedOn; // Acknowledge the alert event scifAckAlertEvents(); } } // taskFxn int main(void) { Task_Params taskParams; // Initialize the PIN driver PIN_init(BoardGpioInitTable); // Configure the OS task Task_Params_init(&taskParams); taskParams.stack = myTaskStack; taskParams.stackSize = sizeof(myTaskStack); taskParams.priority = 3; Task_construct(&myTask, taskFxn, &taskParams, NULL); // Create the semaphore used to wait for Sensor Controller ALERT events Semaphore_Params semParams; Semaphore_Params_init(&semParams); semParams.mode = Semaphore_Mode_BINARY; Semaphore_construct(&semScTaskAlert, 0, &semParams); // Start TI-RTOS BIOS_start(); return 0; } // main

  • 试过了,不能在SCS中实现,无法同时将一个脚定义为输入输出,不知如何在SCS中进行输入输出切换。已经在TASK中实现DS18B20的读取,采用PIN_setConfig()进入输出输出切换,也还是方便的。
  • 你是在哪个工程里面实现的,no-rtos还是ti-RTOS工程里面实现的