Jump to content

websterling

Members
  • Content Count

    38
  • Joined

  • Last visited

  • Days Won

    1

websterling last won the day on August 21 2011

websterling had the most liked content!

About websterling

  • Rank
    Advanced Member
  1. There should be a sub-directory named 'reference' in your Energia directory. I think it's only 8 bits at a time either way.
  2. SPI.transfer only transfers 8 bits. This is what I'm using to transfer a 16 bit value to a DAC. void SPIWrite(int value){ // value is 16 bits // take the LE ( SS ) pin high to inhibit data latching: digitalWrite(latchEnablePin, HIGH); MSB = highByte(value); LSB = lowByte(value); SPI.transfer(MSB); SPI.transfer(LSB); // take the LE ( SS ) pin low to latch the data: digitalWrite(latchEnablePin, LOW); }
  3. Did you reconfigure the RXD and TXD jumpers on the Launchpad?
  4. Do we really need to maximize compatibility with the Arduino? If there's something that's MSP430 specific that offers an improvement to Energia, then maintaining Arduino compatibility shouldn't hold Energia back from incorporating the improvement. Energia should be Arduino-like, rather than Arduino compatible. This doesn't have to be "No Microprocessor Left Behind."
  5. I have a couple of things I'll share once I get them to a presentable point- maybe in the next week or two. This particular project is for a system to monitor carbon monoxide levels in the house during winter while heating with a wood stove. Thanks for your efforts on Energia and on my bugs.
  6. Thanks for the fix. It solved the problem in the sample code. And thanks for the tip about Hardware Serial; I hadn't considered this. I was using TimerSerial begin() and end() to work around the conflict between TimerSerial and PWM using analogWrite. Hardware Serial seems to solve that problem. Thanks, George
  7. Hey, energia, A simple program to read and print the raw adc_value from TEMPSENSOR #include uint32_t adc_value; TimerSerial mySerial; void setup(){ mySerial.begin(); analogReference(INTERNAL1V5); } void loop(){ delay(5000); // delay to open monitor mySerial.print("\nWrite something\n"); adc_value = analogRead(TEMPSENSOR); mySerial.print(adc_value, DEC); mySerial.end(); mySerial.begin(); mySerial.print("\nWrite something else\n"); adc_value = analogRead(TEMPSENSOR); mySerial.print(adc_value, DEC); mySerial.print("\n"); } The output from looping through the program 4 times: Write something 74 Write something else 746 Write something 74 Write something else 747 Write something 76 Write something else 761 Write something 76 Write something else 755 Thanks for looking into this, George
  8. My understanding is that using TimerSerial the following should print the 2 statements. And it does work as expected, printing both strings. mySerial.begin(); mySerial.print("Write something\n"); mySerial.end(); mySerial.begin(); mySerial.print("Write something else\n"); The following code does not work as expected. mySerial.begin(); mySerial.print("Write something\n"); adc_value = analogRead(pin); mySerial.print(adc_value, DEC); mySerial.end(); mySerial.begin(); mySerial.print("Write something else\n"); adc_value = analogRead(pin); mySerial.print(adc_value, DEC); I expected both adc_value's to be the same, but they're not. The first is correct, the second is wrong. The strings do print correctly. This is using 0101E0006 on a 2553 on a Rev. 1.4 Launchpad with the crystal installed. Am I missing something, or have I stumbled across another bug? Thanks, George
  9. The temperature is higher because the temperature sensor is likely on the same die as the microprocessor, and there is some heating due to power dissipation. I can't remember the specifics, but I think my problem was in the programming. I don't think power dissipation could cause the chip to run 20 degrees higher than ambient.
  10. https://github.com/energia/Energia http://energia.github.com/Energia/
  11. Thanks, rick! I patched wiring_analog.c and my code runs as expected. I wish I had the experience to go into the internals of Energia and contribute by fixing these things, but I don't. But I guess that he who finds bugs (and reports them) also contributes. Thanks, again, George
  12. Some additional information in case anyone is interested. If I change the code so that each analog Read() is called 2 times- for example: temp_raw = analogRead(TEMPSENSOR); delay(1000); temp_raw = analogRead(TEMPSENSOR); delay(1000); temp = temp_raw/4; The output is in the order expected. I edited the title of this thread to make it more indicative of what the problem is.
  13. I'm trying to develop my current project entirely in Energia. Since Energia is still in development, I'm breaking the code down into chunks and making sure that things work as expected. The following code gets 3 values from the ADC (TEMPSENSOR and 2 analog inputs), divides each value by 4, and writes the resulting values out to the Serial Monitor. I can vary the voltage to the analog inputs with a potentiometer. This is using 0101E0006 on a 2553 on a Rev. 1.4 Launchpad with the crystal installed. #include #define CO_IN A4 //P1.4 #define RH_IN A5 //P1.5 uint32_t co_volts; uint32_t rh_volts; uint32_t temp_raw; uint8_t co_value; uint8_t rh_value; uint8_t temp; TimerSerial mySerial; void setup(){ mySerial.begin(); } void loop(){ analogReference(INTERNAL1V5); delay(100); //the delays are to make sure the references and the adc have settled temp_raw = analogRead(TEMPSENSOR); delay(100); temp = temp_raw/4; analogReference(INTERNAL2V5); delay(100); co_volts = analogRead(CO_IN); delay(100); co_value = co_volts/4; rh_volts = analogRead(RH_IN); delay(100); rh_value = rh_volts/4; mySerial.print("T: "); mySerial.print(temp, DEC); mySerial.print("\t"); mySerial.print("C: "); mySerial.print(co_value, DEC); mySerial.print("\t"); mySerial.print("R: "); mySerial.println(rh_value, DEC); } I can see the outputs vary as the pots are rotated. The output in the Serial Monitor is of the form- T: 244 C: 189 R: 0 The problem is that the output values are shifted. The printed value for T is actually the value for R; the value for C is actually T; and R is actually C. The code is fairly simple and I can't see anything wrong with it. Is there something I have overlooked/gotten wrong, or have I stumbled into another bug? Thanks, George
  14. Thanks, Robert, It now works as expected.
×
×
  • Create New...