Jump to content

Search the Community

Showing results for tags 'msp 430'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks

Calendars

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Sparkfun


Github

Found 1 result

  1. Hi frineds, Issue : I am data logging into my 1 gb sd card using given code. In my serial terminal window it shows that the data is being written in the sd card, but when i take it out from microcontroller interface and put it in the computer it shows nothing buy empty file (log.txt). Well i know one thing that can be causing this issue that is the log.txt file shows read only in my linux mint environment but still i can write anything in that file. I have attached a screen recording and screen shot file of the issue down below. Please help me... Thank you in advance... Code : #include <pfatfs.h> #include <pffconf.h> /*----------------------------------------------------------------------*/ /* Petit FatFs sample project for generic uC (C)ChaN, 2010 */ /*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------- Ported to Energia by calinp Copy the file LOG.txt from this file's location to the root of the SD-Card. 12/21/2013 Modified by bluehash(43oh) to log temperature data from the MSP430G2553 internal temperature sensor and log it to a file on the SD-Card References: http://forum.43oh.com/topic/3209-energia-library-petit-fatfs-sd-card-library/ */ #include "SPI.h" #include "pfatfs.h" #define cs_pin P2_3 // chip select pin #define read_buffer 128 // size (in bytes) of read buffer #define LOG_DELAY 5000 // 5000ms -> 5sec unsigned short int bw, br;//, i; char buffer[read_buffer]; int rc; //DIR dir; /* Directory object */ FILINFO fno; /* File information object */ uint32_t ui32_ReadTemp = 0; uint8_t StringLength = 0; char buf[30]; uint32_t counter = 0; uint32_t AccStringLength = 0; void setup() { pinMode(PUSH2, INPUT_PULLUP); Serial.begin(9600); // initialize the serial terminal analogReference(INTERNAL1V5); analogRead(TEMPSENSOR); // first reading usually wrong FatFs.begin(cs_pin); // initialize FatFS library calls Serial.print("\n\n\n MSP430 Temperature Logger \n\r"); Serial.println("Press S2 button to start..."); while(digitalRead(PUSH2)==1){} delay(100); while(digitalRead(PUSH2)==0){} } /* Stop with dying message */ void die ( int pff_err ) { Serial.println(); Serial.print("Failed with rc="); Serial.print(pff_err,DEC); for (;;) ; } void printDec(uint32_t ui) { Serial.print(ui/10, DEC); Serial.print("."); Serial.print(ui%10, DEC); } /*-----------------------------------------------------------------------*/ /* Program Main */ /*-----------------------------------------------------------------------*/ void loop() { #if 0 Serial.println(); Serial.println("Press button to start..."); while(digitalRead(PUSH2)==1){} delay(100); while(digitalRead(PUSH2)==0){} #endif ui32_ReadTemp = ((uint32_t)analogRead(TEMPSENSOR)*27069 - 18169625) *10 >> 16; #if DEBUG Serial.println(); Serial.println("Opening log file to write temperature(LOG.txt)."); delay(100); #endif rc = FatFs.open("LOG.TXT"); if (rc) die(rc); delay(100); bw=0; ui32_ReadTemp = ((uint32_t)analogRead(TEMPSENSOR)*27069 - 18169625) *10 >> 16; sprintf( buf, "%lu Current temperature is %lu.%lu\r\n", counter, ui32_ReadTemp/10, ui32_ReadTemp%10 ); counter++; StringLength = strlen(buf); Serial.println(buf); #if DEBUG Serial.print(StringLength, DEC); Serial.println(); Serial.print(AccStringLength, DEC); #endif rc = FatFs.lseek( AccStringLength ); if (rc) die(rc); AccStringLength = AccStringLength + 512; rc = FatFs.write(buf, StringLength,&bw); if (rc) die(rc); rc = FatFs.write(0, 0, &bw); //Finalize write if (rc) die(rc); rc = FatFs.close(); //Close file if (rc) die(rc); #if READ delay(100); Serial.println(); Serial.println("Read Temp data from the log file (LOG.txt)."); delay(100); rc = FatFs.open("LOG.TXT"); if (rc) die(rc); delay(100); for (;;) { rc = FatFs.read(buffer, sizeof(buffer), &br); /* Read a chunk of file */ if (rc || !br) break; /* Error or end of file */ for (uint16_t i = 0; i < br; i++) /* Type the data */ Serial.print(buffer); delay(100); } if (rc) die(rc); #endif // Log delay delay(LOG_DELAY); } Screencast_2017-05-27_15:45:33.mp4
×
×
  • Create New...