Hi
I am very new with the TMS570 and actually with programming.I use TMS570ls3137 usb kit
I made adc reading program giving example in the videos of the ti. I mention about reading light sensor output from the terminal. I used this output value for lighting led on the usb kit you can see below when value less than 2000 turn on led when it much more turn off led.
But now I want make this program different . When I read light sensor value i want to set led brightness about this value.
When I put light on the light sensor it gives 4096 value maximum, it gives 0 when dark happen . I want to use 0 to 4096 value for arrange brightness of any led
on the usb kit it doesnt matter. When full 4096 value the led must be dark and it slowly increase brightness,when it reach 0 value it gives full bright.
Thanks from now
oid main(void)
{
/* USER CODE BEGIN (3) */
gioSetDirection(hetPORT1, 0xFFFFFFFF);
adcData_t adc_data; //ADC Data Structure
adcData_t *adc_data_ptr = &adc_data; //ADC Data Pointer
unsigned int NumberOfChars, value; //Declare variables
sciInit(); //Initializes the SCI (UART) module
adcInit(); //Initializes the ADC module
while(1) // Loop to acquire and send ADC sample data via the SCI (UART)
{
adcStartConversion(adcREG1, 1U); //Start ADC conversion
while(!adcIsConversionComplete(adcREG1, 1U)); //Wait for ADC conversion
adcGetData(adcREG1, 1U, adc_data_ptr); //Store conversion into ADC pointer
value = (unsigned int)adc_data_ptr->value;
NumberOfChars = ltoa(value,(char *)command);
sciSend(scilinREG, 2, (unsigned char *)"0x"); //Sends '0x' hex designation chars
sciSend(scilinREG, NumberOfChars, command); //Sends the ambient light sensor data
sciSend(scilinREG, 2, (unsigned char *)"\r\n"); //Sends new line character
if(NumberOfChars<0x2000)
{
gioSetBit(hetPORT1, 0, 1);
}
else
{
gioSetbit(hetPORT1, 0, 0);
}
}