Other Parts Discussed in Thread: CC2540
Helo,
I want to read analog inputs using CC 2540 usb dongle. Please someone guide, how to achieve this.?
Regards
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.
Helo,
I want to read analog inputs using CC 2540 usb dongle. Please someone guide, how to achieve this.?
Regards
i am using two usb dongles, i want to display the value which i read using analog input. I need step be step guidance for achieving this \.
Actually my question is how i can read analog values using 2540 usb dongle . I want to read values and show those values in Btool. Which sample program should i use for this?
yes i want to implement ADC as you discussed. Now my next question is, should i change hal files of Host test release Program for implementing ADC?
void main(void)
{
CLKCONCMD = (CLKCONCMD & ~(CLKCON_OSC | CLKCON_CLKSPD)) | CLKCON_CLKSPD_32M;
// Clock setting
P0SEL &= ~(0x08); // P0_3 as General-purpose I/O
P0DIR &= ~(0x08); // P0_3 as input
APCFG |= APCFG_APCFG3; // Analog I/O on P0_3 is enabled
P1SEL &= ~(0x10); // P1_4 as General-purpose I/O
P1DIR |= (0x10); //P1_4 as output
ADCCON1 = (ADCCON1 & ~ADCCON1_STSEL) | ADCCON1_STSEL_ST;
// Set [ADCCON1.STSEL] according to ADC configuration.
// The ADC conversion is triggered by setting [ADCCON1.ST = 1]
ADCCON2 = (ADCCON2_SREF_AVDD | ADCCON2_SDIV_512 | ADCCON2_SCH_AIN3);
// Set [ADCCON2.SREF/SDIV/SCH] according to ADC configuration.
// Reference voltage used for the sequence of conversions is AVDD5
// 12bits ENOB setting (14bits)
// P0_3 indicate the channel number on which a conversion is ongoing
while (1)
{
ADCCON1 |= ADCCON1_ST; // Start conversion
while( !(ADCCON1 & ADCCON1_EOC));
if (ADCH >= 0x40)
{
P1 &= ~0x10;
P1 &= ~0x10;
P1 &= ~0x10;
P1 &= ~0x10;
P1 &= ~0x10;
P1 |= 0x10;
P1 &= ~0x10;
P1 |= 0x10;
}
else
{P1 &= ~0x10;}
}
I have this code. Now i am unable to understand how to use it with Host test release. As you mentioned in previous answer that i should change the main file. i have to embed in main file where the code of Host Test Release is given.
hi,
I want to receive analog data in Btool from ADC of 2540 usb dongle using host test release program. Please guide how to do this.
Regards
Already provide help in your another duplicate post.