Jump to content
43oh

Recommended Posts

The latest official version of Energia (energia-0101E0012) does not define TEMPSENSOR for the TM4C1294 MCU. The suggested solution discussed at https://github.com/energia/Energia/pull/364# does not work for me. The function call to analogRead(TEMPSENSOR) is hanging the program. I have found a quick and simply solution for the problem, so anyone can use it until a better solution will be found.

 

1. Add this line to file pins_energia.h in folder Energia/hardware/lm4f/variants/launchpad_129

   #define TEMPSENSOR PB_1 //Will be translated to ADC_CTL_TS

2. In the same file modify the following line (in the definition of array digital_pin_to_analog_in[], near to end of file):

NOT_ON_ADC, // 95 - PB_1 unrouted

simply replace it by

ADC_CTL_TS, // 95 - PB_1 unrouted

These modifications define the TEMPSENSOR symbol and will select the internal temperature sensor when readAnalog(TEMPSENSOR) is called.

 

Here is a simple example sketch:

uint32_t val; 
float temp;  

void setup() {
  Serial.begin(9600);
}

void loop() {
  delay(1000); 
  val = analogRead(TEMPSENSOR); 
  Serial.print("adc:");         //raw ADC data
  Serial.print(val);
  temp = 147.5 - 75*3.3*val/4096;    //temperature in Celsius
  Serial.print("  temp:");      
  Serial.println(temp,1); 
}

Good luck!

 

Istvan Cserny

Link to post
Share on other sites
  • 1 year later...

ok thank you

i tried the above code and it working fine..

 

i am doing the project of smart sensor data acquisition module for acoustic emission sensor with wireless communication.

I want to make my module smart by adding various features like temperature compensation, self-calibration, input detection, webpage access, Plug n play etc. and other also can be included.

i don't know much about tm4c1294 connected launchpad. So how many features are there and what can we do with this launchpad to make my data acquisition system smart.

Please give me some ideas and suggest me some examples of tm4c1294 in energia.

 

Thank you

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...