Jump to content


  • Content Count

  • Joined

  • Last visited

About Unit

  • Rank
    Noob Class

Recent Profile Visitors

387 profile views
  1. Unit

    MSP430F5529 JSON Code

    Yes, I did. I learned quite a while back that only one application can access the COM port at a particular instant in time. So I closed the PuTTY window, then tried accessing the COM port via GUI Composer v2. Regards
  2. Unit

    MSP430F5529 JSON Code

    In a further update, I tried writing some code to sent similar information to the host PC: if (g%2 == 0){ strcpy(OutputString,"\r\n{\"LED\":0\}\r\n"); #ifdef UART_COMM // Send the message to the host over UART putsUART((BYTE*)OutputString,strlen(OutputString)); #endif } else{ strcpy(OutputString,"\r\n{\"LED\":1\}\r\n"); #ifdef UART_COMM // Send the message to the host over UART putsUART((BYTE*)OutputString,strlen(OutputString)); #endif } g++; I verified with PuTTY that the COM port does indeed, receive the information (http://i1337.photobucket.com/albums/o678/pulser18/puttyworks_zpsl9ahm2tz.png~original). When I try using the GUI Composer v2, the service says that it is connected to the COM port, but is waiting on data. The service never receives the data. Any advice? Regards
  3. Unit

    MSP430F5529 JSON Code

    Thanks for the link. I now understand how JSON works, and how the GUI interprets the information. Should be straight forward to write JSON-compliant messages now, with or without using that library. Regards
  4. Unit

    MSP430F5529 JSON Code

    Hello Forums I am trying to use GUI Composer v2 (on the cloud) to create a GUI for a battery managment system, similar to the one in the SLAA478 Application Report, using the MSP-EXP430F5529LP and bq76PL536EVM-3. I've decided to use USB/Serial comms, which requires me to modify the code to send the information using JSON. I am following the example of using USB/Serial IO: https://dev.ti.com/gc/designer/help/Tutorials/Serial/index.html. The code given is as follows: #include <aJSON.h> // most launchpads have a red LED #define LED RED_LED //see pins_energia.h for more LED definitions void printled_statewithjson(int state){ aJsonObject* root = aJson.createObject(); if (root == NULL) { return; } aJson.addItemToObject(root, "LED", aJson.createItem(state)); char* string = aJson.print(root); if (string != NULL) { Serial.println(string); free(string); } aJson.deleteItem(root); } // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(LED, OUTPUT); Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level) printled_statewithjson(1); // print json object with LED status set to 1 to UART delay(1000); // wait for a second digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW printled_statewithjson(0); // print json object with LED status set to 0 to UART delay(1000); // wait for a second } I am trying to fully understand this example code, before implementing it into my program. Using CCS Cloud, I stepped through the program in debug mode. From what I understand, the loop() function is essentially the main function, which blinks the LED; setup() does as expected and initializes the MCU LED pin, and opening a serial port at 9600 baud rate. I cannot, however, understand the printled_statewithjson() function. How exactly does it work to be able to send the information? Regards