TI中文支持网
TI专业的中文技术问题搜集分享网站

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

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

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

YiKai Chen:

理論上沒有問題、沒有相關例程、你得自己寫程序

da qin zheng sheng:

scs没有完全开放。

da qin zheng sheng:

使用普通io就可以了,使用寄存器操作效果比较好,多看英文手册。

Viki Shi:

没有具体例程,不过你可以看下TI-RTOS里的驱动部分,以了解UART和PIN是否满足1-Wire协议的需要。

Alvin Chen:

回复 Viki Shi:

这是完全可以做到的,你可以参考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) {} // scCtrlReadyCallbackvoid scTaskAlertCallback(void) {// Wake up the OS taskSemaphore_post(Semaphore_handle(&semScTaskAlert));} // scTaskAlertCallbackPIN_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 pinshLedPins = PIN_open(&ledPinState, pLedPinTable);// Initialize the Sensor ControllerscifOsalInit();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 loopwhile (1) {// Wait for an ALERT callbackSemaphore_pend(Semaphore_handle(&semScTaskAlert), BIOS_WAIT_FOREVER);// Clear the ALERT interrupt sourcescifClearAlertIntSource();// Toggle LED1if (isLedOn) {PIN_setOutputValue(hLedPins, Board_RLED, Board_LED_OFF);} else {PIN_setOutputValue(hLedPins, Board_RLED, Board_LED_ON);}isLedOn = !isLedOn;// Acknowledge the alert eventscifAckAlertEvents();}} // taskFxnint main(void) {Task_Params taskParams;// Initialize the PIN driverPIN_init(BoardGpioInitTable);// Configure the OS taskTask_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 eventsSemaphore_Params semParams;Semaphore_Params_init(&semParams);semParams.mode = Semaphore_Mode_BINARY;Semaphore_construct(&semScTaskAlert, 0, &semParams);// Start TI-RTOSBIOS_start();return 0;} // main
user3692850:

回复 xie wei:

你是在哪个工程里面实现的,no-rtos还是ti-RTOS工程里面实现的

赞(0)
未经允许不得转载:TI中文支持网 » 在CC1310上想用 Sensor Controller读取DS18B20的温度数据是否能实现?
分享到: 更多 (0)