I wrote code in Sensor-Controller Studio, wanted to make my digitron show numbers. It works when I use Sensor Controller Studio for Task testing.
And I copy the generated code into my Application, but When I debug, the voltage of pins keep at the level 0V
I added the following code into my main.c:
#include "scif.h"
/***** Defines *****/
#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_Struct myDigShowTask;
Char myDigShowTaskStack[1024];
PIN_Config pLedPinTable[] = {
PIN_ID(23) | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MED,
PIN_ID(24) | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MED,
PIN_ID(25) | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MED,
PIN_ID(26) | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MED,
PIN_TERMINATE
};
PIN_State digPinState;
PIN_Handle digPinHandle;
void scCtrlReadyCallback(void) {
}
void scTaskAlertCallback(void) {
}
void digshowTaskFxn(UArg a0, UArg a1) {
int i;
scifOsalInit();
scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
scifInit(&scifDriverSetup);
//scifStartRtcTicksNow(0x0000010);
scifStartTasksNbl(BV(SCIF_BRIGHT_LED_TASK_ID));
Task_sleep(1000);
for(i=0;i<16;i++) // used for
{
scifTaskData.brightLed.input.flowCTL[i] = 1;
}
while(1)
{
Task_sleep(1000);
}
}
int main(void)
{
Task_Params taskParams;
/* Call driver init functions. */
Board_initGeneral();
digPinHandle = PIN_open(&digPinState, pLedPinTable);
Assert_isTrue(ledPinHandle != NULL, NULL);
Task_Params_init(&taskParams);
taskParams.stack = myDigShowTaskStack;
taskParams.stackSize = sizeof(myDigShowTaskStack);
taskParams.priority = 3;
Task_construct(&myDigShowTask, digshowTaskFxn, &taskParams, NULL);
/* Initialize task */
//rxTaskInit();
/* Start BIOS */
BIOS_start();
return (0);
}
/*************************************************************************************************************************************/
Initialization Code (empty)
Execution Code:
U16* temp = #input.flowCTL;
while (state.exit == 0) {
while ( *temp == 0) {
state.i = state.i + 1;
temp = temp + 1;
if(state.i>=16) {
state.i = 0;
temp = #input.flowCTL;
}
}
state.A0 = state.i & 0x01 ;
state.A1 = (state.i & 0x02) >> 1;
state.A2 = (state.i & 0x04) >> 2;
state.A3 = (state.i & 0x08) >> 3;
if(state.A0 == 1) {
gpioSetOutput(7);
} else {
gpioClearOutput(7);
}
if(state.A1 == 1) {
gpioSetOutput(6);
} else {
gpioClearOutput(6);
}
if(state.A2 == 1) {
gpioSetOutput(5);
} else {
gpioClearOutput(5);
}
if(state.A3 == 1) {
gpioSetOutput(4);
} else {
gpioClearOutput(4);
}
fwDelayUs(1000,FW_DELAY_RANGE_2_MS);
if(state.i < 16) {
state.i= state.i + 1;
temp = temp + 1;
} else {
state.i = 0;
temp = #input.flowCTL;
}
}
Thanks
-Wong Ju