Shop OBEX P1 Docs P2 Docs Learn Events
PropDNA+RTC Board and SimpleIDE - Page 2 — Parallax Forums

PropDNA+RTC Board and SimpleIDE

2»

Comments

  • jazzedjazzed Posts: 11,803
    edited 2013-12-14 09:16
    Rsadeika wrote: »
    Since I have not gotten any more suggestions for resolving the problem I will start from scratch and will blame the problem on a bad program design/implementation. I do not know of any other way of resolving this issue, I just hope that in my new design, I do not run into the same problem and find out that maybe it has something to do with program memory shortages that is not apparently showing itself, in whatever manner that may occur. So, back to design status...

    Ray
    Post a zip of your project so that I can reproduce your problems. I'll look at it later today. No time at the moment.
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-14 09:39
    Thanks for the offer jazzed, but I think I have to learn how too muddle through these problems on my own. I was just giving a warning to who ever was looking at my program that there will not be any further code adjustments, on to a new design.

    Ray
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-14 13:41
    I was able to replicate the problem in a much smaller program. Basically when you type in 'testlog' command, senselog COG writes to the SD, as expected, when you go to type in another command, the program is locked. I guess the experts will have to explain to me why that is occurring.

    Ray
    /*
      Env_senseP1.c
      December 14, 2013 
    */
    #include "simpletools.h"
    #include "simpletext.h"
    #include "fdserial.h"
    
    #include "sRTC.h"
    
    
    /* Auto sd_mount of SD. */
    extern _Driver _NullDriver;
    extern _Driver _FileDriver;
    
    _Driver *_driverlist[] = {
      &_NullDriver,
      &_FileDriver,
      NULL
    };
    
    serial *xbee;
    FILE *sp;
    
    static volatile int logstat;
    
    unsigned int sht11stack[40 + 25];  // 40 + 25
    unsigned int sensestack[40 + 25];  // 40 + 25
    
    void menu(void);
    
    /* COG functions. */
    void sht11(void* par);
    void senselog(void* par);
    
    
    
    int main()
    {
      // Add startup code here.
    /* Open a file for append. */
      if((sp=fopen("SenseD.txt","a"))==0)
      {
        while(1)
        {
          high(27);    // Red LED, error on open.
          pause(500);
          low(27);
          pause(500);
        }
      }
      else
      {
        high(26);  // Green LED, file was opened.
      }
    
    /* Start the sht11 cog. */
      cogstart(&sht11, NULL, sht11stack, sizeof(sht11stack));
    /* Start the senselog cog. */
      cogstart(&senselog, NULL, sensestack, sizeof(sensestack));
      pause(100);
    
    /* Init the XBee module. */
    /*                     Rx  Tx mode BAUD */
      xbee = fdserial_open(25, 24, 0, 9600);
      pause(50);
    /* Start the Sensirion RTC. */
      sRTC_Start();
      sRTC_Update();
      sRTC_Set24hourmode(1);
      sRTC_Update();
      char inBuff[40];
    
      menu();
     
      while(1)
      {
        // Add main loop code here.
        writeStr(xbee,"> ");
        readStr(xbee, inBuff, 40);
        if(!strcmp(inBuff, "help")) menu();
        else if(!strcmp(inBuff,"testlog"))
        {
          logstat = 1;
        }
        else
        {
          writeLine(xbee,"Invalid Command!");
        }    
      }  
    }
    
    void menu()
    {
      writeStr(xbee, "Menu - help, testlog \n");
    }
    
    
    void sht11(void* par)
    {
      while(1)
      {
        pause(100);
      }
    }
    
    
    void senselog(void* par)
    {
      int sostat;
      while(1)
      {
        sostat = logstat;
        if(sostat == 1)
        {
          //high(27);
          sp = fopen("SenseD.txt", "a");
          char outBuff[] = {' ',' '};
          int day, month, year;
          sRTC_Update();
          month = sRTC_Getmonth();
          sprint(outBuff,"%d",month);
          fwrite(outBuff,1,2,sp);
          fwrite("/",1,1,sp);
          fclose(sp);
          //low(27);
          logstat = 0;
        }
        pause(250);
      }
    }
    
  • jazzedjazzed Posts: 11,803
    edited 2013-12-14 14:22
    You need to close your file after opening it, and your senselog stack is not big enough.

    I changed the stack to this: unsigned int sensestack[40 + 150]; // 40 + 25
    Then added fclose(sd); after your green LED on line 55.

    Stdio things are very expensive in stack and code terms. The 25 longs allocated for extra stack was just not sufficient.
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-14 14:58
    Thanks jazzed, I just tried it with your suggestions, and of course it works as expected.

    This stack business, as I increase the senslog COG with more code lines, will I also have too increase the stack size? And of course when I add code lines to the sht11 COG I presume I will have too increase the stack size of that COG also? As you increase the stack sizes, I did not see the Code Size reading increase at all, so how do I know how much memory I have left? And does the stack use hub or COG memory, or a combination of both? 'sensestack[40 + 150]' , why is the stack size allocated in two parts, previously it was just one number? Is the 150 of greater importance than the 40 value?

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2013-12-14 16:14
    Ray, 40 ints (160 bytes) is the minimum cogstart stack size. Everything else is for the file operation functions in the senselog COG.

    I suspect that the file-system code has the biggest stack requirement. Once you have enough stack "per cogstart function", you're probably Ok.

    Code size will not increase with stack requirements. Stack required is almost nothing ... until you start using it. I'll do some experiments to find a way to determine what the stack usage is - give me some time on that.

    BTW, I don't understand why your Simple Library code doesn't show up in your ZIP file. I had to remove all those project links before it would compile. What SimpleIDE version are you using?
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-14 16:36
    I am using 0-9-45, I just recently went to the Learn site, and used their instructions to download it. Because my program size is quite large I have too keep a sharp eye on the stack sizes and how they are impacting my program, this is really cutting it close in terms of memory use. Thanks again jazzed.

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2013-12-14 19:23
    Ray,

    Can you please do a Zip on your project? Then post the Build Status for me here (right-click select-all, copy, then paste).

    Thanks.
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-15 02:25
    This is the latest.

    Ray
    propeller-elf-gcc.exe -v GCC 4.6.1 (propellergcc_v1_0_0_2162)
    propeller-elf-gcc.exe -I . -L . -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libsimpletext -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libsimpletext/cmm/ -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libfdserial -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libfdserial/cmm/ -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools/cmm/ -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c/cmm/ -Os -mcmm -m32bit-doubles -fno-exceptions -std=c99 -c basic_i2c_driver.c -o cmm/basic_i2c_driver.o
    propeller-elf-gcc.exe -I . -L . -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libsimpletext -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libsimpletext/cmm/ -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libfdserial -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libfdserial/cmm/ -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools/cmm/ -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c/cmm/ -Os -mcmm -m32bit-doubles -fno-exceptions -std=c99 -c sht11.c -o cmm/sht11.o
    propeller-elf-gcc.exe -I . -L . -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libsimpletext -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libsimpletext/cmm/ -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libfdserial -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libfdserial/cmm/ -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools/cmm/ -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c/cmm/ -Os -mcmm -m32bit-doubles -fno-exceptions -std=c99 -c sRTC.c -o cmm/sRTC.o
    propeller-elf-gcc.exe -I . -L . -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libsimpletext -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libsimpletext/cmm/ -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libfdserial -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libfdserial/cmm/ -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools/cmm/ -I C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c -L C:/Users/Ray/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c/cmm/ -o cmm/Env_senseP1.elf -Os -mcmm -m32bit-doubles -fno-exceptions -std=c99 cmm/basic_i2c_driver.o cmm/sht11.o cmm/sRTC.o Env_senseP1.c -lm -lsimpletext -lfdserial -lsimpletools -lsimplei2c -lm -lsimpletext -lfdserial -lsimpletools -lm -lsimpletext -lfdserial -lm -lsimpletext -lm
    propeller-load -s cmm/Env_senseP1.elf
    Patching __cfg_sdspi_config1 with 00000000
    Patching __cfg_sdspi_config2 with 00000000
    propeller-elf-objdump -h cmm/Env_senseP1.elf
    Done. Build Succeeded!

    propeller-load.exe -Dreset=dtr -I C:/Program Files (x86)/SimpleIDE/bin/../propeller-gcc/propeller-load/ -b DNA cmm/Env_senseP1.elf -r -p COM16
    Propeller Version 1 on COM16

    Patching __cfg_sdspi_config1 with 02000101
    Loading cmm/Env_senseP1.elf to hub memory

    22144 bytes sent

    Verifying RAM ...
    OK
  • jazzedjazzed Posts: 11,803
    edited 2013-12-15 07:57
    Rsadeika wrote: »
    This is the latest.

    Ray

    Did you press the Zip button?
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-15 10:28
    The little zipper icon, yes I did. I did do this in a Project View, if that makes a difference.

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2013-12-15 11:45
    When I do Zip, I get a build status like this:
    Archiving Project: C:/Users/Steve/AppData/Local/Temp/codegen.zip
    Adding codegen.c
    Adding codegen.side
    Adding library/libsimplei2c/Documentation simplei2c Library.html
    Adding library/libsimplei2c/Doxyfile.doxyfile
    Adding library/libsimplei2c/libsimplei2c.c
    Adding library/libsimplei2c/libsimplei2c.side
    Adding library/libsimplei2c/simplei2c.c
    Adding library/libsimplei2c/simplei2c.h
    Adding library/libsimplei2c/cmm/libsimplei2c.a
    Adding library/libsimplei2c/cmm/libsimplei2c.binary
    Adding library/libsimplei2c/cmm/libsimplei2c.map
    Adding library/libsimplei2c/html/annotated.html
    Adding library/libsimplei2c/html/bc_s.png
    Adding library/libsimplei2c/html/bdwn.png
    Adding library/libsimplei2c/html/classes.html
    Adding library/libsimplei2c/html/closed.png
    Adding library/libsimplei2c/html/doxygen.css
    Adding library/libsimplei2c/html/doxygen.png
    Adding library/libsimplei2c/html/dynsections.js
    Adding library/libsimplei2c/html/files.html
    Adding library/libsimplei2c/html/ftv2blank.png
    Adding library/libsimplei2c/html/ftv2cl.png
    Adding library/libsimplei2c/html/ftv2doc.png
    Adding library/libsimplei2c/html/ftv2folderclosed.png
    Adding library/libsimplei2c/html/ftv2folderopen.png
    Adding library/libsimplei2c/html/ftv2lastnode.png
    Adding library/libsimplei2c/html/ftv2link.png
    Adding library/libsimplei2c/html/ftv2mlastnode.png
    Adding library/libsimplei2c/html/ftv2mnode.png
    Adding library/libsimplei2c/html/ftv2mo.png
    Adding library/libsimplei2c/html/ftv2node.png
    Adding library/libsimplei2c/html/ftv2ns.png
    Adding library/libsimplei2c/html/ftv2plastnode.png
    Adding library/libsimplei2c/html/ftv2pnode.png
    Adding library/libsimplei2c/html/ftv2splitbar.png
    Adding library/libsimplei2c/html/ftv2vertline.png
    Adding library/libsimplei2c/html/globals.html
    Adding library/libsimplei2c/html/globals_func.html
    Adding library/libsimplei2c/html/index.html
    Adding library/libsimplei2c/html/jquery.js
    Adding library/libsimplei2c/html/libsimplei2c_8c.html
    Adding library/libsimplei2c/html/nav_f.png
    Adding library/libsimplei2c/html/nav_g.png
    Adding library/libsimplei2c/html/nav_h.png
    Adding library/libsimplei2c/html/open.png
    Adding library/libsimplei2c/html/simplei2c_8c.html
    Adding library/libsimplei2c/html/simplei2c_8h_source.html
    Adding library/libsimplei2c/html/structi2c__st.html
    Adding library/libsimplei2c/html/sync_off.png
    Adding library/libsimplei2c/html/sync_on.png
    Adding library/libsimplei2c/html/tab_a.png
    Adding library/libsimplei2c/html/tab_b.png
    Adding library/libsimplei2c/html/tab_h.png
    Adding library/libsimplei2c/html/tab_s.png
    Adding library/libsimplei2c/html/tabs.css
    Adding library/libsimplei2c/lmm/libsimplei2c.a
    Adding library/libsimplei2c/lmm/libsimplei2c.binary
    Adding library/libsimplei2c/xmm_single/libsimplei2c.a
    Adding library/libsimplei2c/xmm_split/libsimplei2c.a
    Adding library/libsimplei2c/xmmc/libsimplei2c.a
    Adding library/libsimpletext/Documentation serial Library.html
    Adding library/libsimpletext/Documentation simpletext Library.html
    Adding library/libsimpletext/Doxyfile.doxyfile
    Adding library/libsimpletext/doscanf.c
    Adding library/libsimpletext/dosprint.c
    Adding library/libsimpletext/dprint.c
    Adding library/libsimpletext/dscan.c
    Adding library/libsimpletext/floatToString.c
    Adding library/libsimpletext/getBin.c
    Adding library/libsimpletext/getChar.c
    Adding library/libsimpletext/getDec.c
    Adding library/libsimpletext/getFloat.c
    Adding library/libsimpletext/getHex.c
    Adding library/libsimpletext/getStr.c
    Adding library/libsimpletext/gets.c
    Adding library/libsimpletext/libsimpletext.c
    Adding library/libsimpletext/libsimpletext.c.orig
    Adding library/libsimpletext/libsimpletext.side
    Adding library/libsimpletext/libsimpletext.zip
    Adding library/libsimpletext/print.c
    Adding library/libsimpletext/printNumber.c
    Adding library/libsimpletext/putBin.c
    Adding library/libsimpletext/putChar.c
    Adding library/libsimpletext/putDec.c
    Adding library/libsimpletext/putFloat.c
    Adding library/libsimpletext/putHex.c
    Adding library/libsimpletext/putLine.c
    Adding library/libsimpletext/putLine.c.orig
    Adding library/libsimpletext/putStr.c
    Adding library/libsimpletext/putStr.c.orig
    Adding library/libsimpletext/putln.c
    Adding library/libsimpletext/safe_gets.c
    Adding library/libsimpletext/scan.c
    Adding library/libsimpletext/scanf_getf.c
    Adding library/libsimpletext/scanf_getl.c
    Adding library/libsimpletext/serial.h
    Adding library/libsimpletext/serial.h.orig
    Adding library/libsimpletext/serial_close.c
    Adding library/libsimpletext/serial_open.c
    Adding library/libsimpletext/serial_open.c.orig
    Adding library/libsimpletext/serial_rxtx.c
    Adding library/libsimpletext/serial_rxtx.c.orig
    Adding library/libsimpletext/simpleterm.c
    Adding library/libsimpletext/simpleterm_close.c
    Adding library/libsimpletext/simpletext.h
    Adding library/libsimpletext/simpletext.h.orig
    Adding library/libsimpletext/sprint.c
    Adding library/libsimpletext/sscan.c
    Adding library/libsimpletext/stringToFloat.c
    Adding library/libsimpletext/tags
    Adding library/libsimpletext/writeBin.c
    Adding library/libsimpletext/writeBinDigits.c
    Adding library/libsimpletext/writeChar.c
    Adding library/libsimpletext/writeDec.c
    Adding library/libsimpletext/writeDecDigits.c
    Adding library/libsimpletext/writeFloat.c
    Adding library/libsimpletext/writeFloatPrecision.c
    Adding library/libsimpletext/writeHex.c
    Adding library/libsimpletext/writeHexDigits.c
    Adding library/libsimpletext/writeLine.c
    Adding library/libsimpletext/writeStr.c
    Adding library/libsimpletext/writeStrDigits.c
    Adding library/libsimpletext/cmm/libsimpletext.a
    Adding library/libsimpletext/cmm/libsimpletext.binary
    Adding library/libsimpletext/html/annotated.html
    Adding library/libsimpletext/html/bc_s.png
    Adding library/libsimpletext/html/bdwn.png
    Adding library/libsimpletext/html/classes.html
    Adding library/libsimpletext/html/closed.png
    Adding library/libsimpletext/html/doxygen.css
    Adding library/libsimpletext/html/doxygen.png
    Adding library/libsimpletext/html/dynsections.js
    Adding library/libsimpletext/html/files.html
    Adding library/libsimpletext/html/float_to_string_8c.html
    Adding library/libsimpletext/html/ftv2blank.png
    Adding library/libsimpletext/html/ftv2cl.png
    Adding library/libsimpletext/html/ftv2doc.png
    Adding library/libsimpletext/html/ftv2folderclosed.png
    Adding library/libsimpletext/html/ftv2folderopen.png
    Adding library/libsimpletext/html/ftv2lastnode.png
    Adding library/libsimpletext/html/ftv2link.png
    Adding library/libsimpletext/html/ftv2mlastnode.png
    Adding library/libsimpletext/html/ftv2mnode.png
    Adding library/libsimpletext/html/ftv2mo.png
    Adding library/libsimpletext/html/ftv2node.png
    Adding library/libsimpletext/html/ftv2ns.png
    Adding library/libsimpletext/html/ftv2plastnode.png
    Adding library/libsimpletext/html/ftv2pnode.png
    Adding library/libsimpletext/html/ftv2splitbar.png
    Adding library/libsimpletext/html/ftv2vertline.png
    Adding library/libsimpletext/html/get_bin_8c.html
    Adding library/libsimpletext/html/get_char_8c.html
    Adding library/libsimpletext/html/get_dec_8c.html
    Adding library/libsimpletext/html/get_float_8c.html
    Adding library/libsimpletext/html/get_hex_8c.html
    Adding library/libsimpletext/html/globals.html
    Adding library/libsimpletext/html/globals_func.html
    Adding library/libsimpletext/html/globals_type.html
    Adding library/libsimpletext/html/index.html
    Adding library/libsimpletext/html/jquery.js
    Adding library/libsimpletext/html/nav_f.png
    Adding library/libsimpletext/html/nav_g.png
    Adding library/libsimpletext/html/nav_h.png
    Adding library/libsimpletext/html/open.png
    Adding library/libsimpletext/html/put_bin_8c.html
    Adding library/libsimpletext/html/put_char_8c.html
    Adding library/libsimpletext/html/put_dec_8c.html
    Adding library/libsimpletext/html/put_float_8c.html
    Adding library/libsimpletext/html/put_hex_8c.html
    Adding library/libsimpletext/html/put_line_8c.html
    Adding library/libsimpletext/html/put_str_8c.html
    Adding library/libsimpletext/html/serial_8h.html
    Adding library/libsimpletext/html/serial_8h_source.html
    Adding library/libsimpletext/html/serial__open_8c.html
    Adding library/libsimpletext/html/simpleterm_8c.html
    Adding library/libsimpletext/html/simpleterm__close_8c.html
    Adding library/libsimpletext/html/simpletext_8h.html
    Adding library/libsimpletext/html/simpletext_8h_source.html
    Adding library/libsimpletext/html/structserial__info.html
    Adding library/libsimpletext/html/structtext__struct.html
    Adding library/libsimpletext/html/sync_off.png
    Adding library/libsimpletext/html/sync_on.png
    Adding library/libsimpletext/html/tab_a.png
    Adding library/libsimpletext/html/tab_b.png
    Adding library/libsimpletext/html/tab_h.png
    Adding library/libsimpletext/html/tab_s.png
    Adding library/libsimpletext/html/tabs.css
    Adding library/libsimpletext/html/write_bin_8c.html
    Adding library/libsimpletext/html/write_bin_digits_8c.html
    Adding library/libsimpletext/html/write_char_8c.html
    Adding library/libsimpletext/html/write_dec_8c.html
    Adding library/libsimpletext/html/write_dec_digits_8c.html
    Adding library/libsimpletext/html/write_float_8c.html
    Adding library/libsimpletext/html/write_float_precision_8c.html
    Adding library/libsimpletext/html/write_hex_8c.html
    Adding library/libsimpletext/html/write_hex_digits_8c.html
    Adding library/libsimpletext/html/write_line_8c.html
    Adding library/libsimpletext/html/write_str_8c.html
    Adding library/libsimpletext/html/write_str_digits_8c.html
    Adding library/libsimpletext/lmm/libsimpletext.a
    Adding library/libsimpletext/lmm/libsimpletext.binary
    Adding library/libsimpletext/xmm_single/libsimpletext.a
    Adding library/libsimpletext/xmm_split/libsimpletext.a
    Adding library/libsimpletext/xmmc/libsimpletext.a
    Adding library/libsimpletools/Documentation simpletools Library.html
    Adding library/libsimpletools/Documentation simpletools Library.html.orig
    Adding library/libsimpletools/Doxyfile.doxyfile
    Adding library/libsimpletools/Doxyfile.doxyfile.orig
    Adding library/libsimpletools/LearnHeading.png
    Adding library/libsimpletools/ParallaxLogo.png
    Adding library/libsimpletools/libsimpletools.c
    Adding library/libsimpletools/libsimpletools.side
    Adding library/libsimpletools/simpletools.h
    Adding library/libsimpletools/simpletools.h.orig
    Adding library/libsimpletools/cmm/libsimpletools.a
    Adding library/libsimpletools/cmm/libsimpletools.binary
    Adding library/libsimpletools/html/ParallaxLogo.png
    Adding library/libsimpletools/html/bc_s.png
    Adding library/libsimpletools/html/bdwn.png
    Adding library/libsimpletools/html/closed.png
    Adding library/libsimpletools/html/doxygen.css
    Adding library/libsimpletools/html/doxygen.png
    Adding library/libsimpletools/html/dynsections.js
    Adding library/libsimpletools/html/files.html
    Adding library/libsimpletools/html/files.html.orig
    Adding library/libsimpletools/html/ftv2blank.png
    Adding library/libsimpletools/html/ftv2cl.png
    Adding library/libsimpletools/html/ftv2doc.png
    Adding library/libsimpletools/html/ftv2folderclosed.png
    Adding library/libsimpletools/html/ftv2folderopen.png
    Adding library/libsimpletools/html/ftv2lastnode.png
    Adding library/libsimpletools/html/ftv2link.png
    Adding library/libsimpletools/html/ftv2mlastnode.png
    Adding library/libsimpletools/html/ftv2mnode.png
    Adding library/libsimpletools/html/ftv2mo.png
    Adding library/libsimpletools/html/ftv2node.png
    Adding library/libsimpletools/html/ftv2ns.png
    Adding library/libsimpletools/html/ftv2plastnode.png
    Adding library/libsimpletools/html/ftv2pnode.png
    Adding library/libsimpletools/html/ftv2splitbar.png
    Adding library/libsimpletools/html/ftv2vertline.png
    Adding library/libsimpletools/html/globals.html
    Adding library/libsimpletools/html/globals.html.orig
    Adding library/libsimpletools/html/globals_defs.html
    Adding library/libsimpletools/html/globals_defs.html.orig
    Adding library/libsimpletools/html/globals_func.html
    Adding library/libsimpletools/html/globals_func.html.orig
    Adding library/libsimpletools/html/index.html
    Adding library/libsimpletools/html/index.html.orig
    Adding library/libsimpletools/html/jquery.js
    Adding library/libsimpletools/html/nav_f.png
    Adding library/libsimpletools/html/nav_g.png
    Adding library/libsimpletools/html/nav_h.png
    Adding library/libsimpletools/html/open.png
    Adding library/libsimpletools/html/simpletools_8h.html
    Adding library/libsimpletools/html/simpletools_8h.html.orig
    Adding library/libsimpletools/html/simpletools_8h_source.html
    Adding library/libsimpletools/html/simpletools_8h_source.html.orig
    Adding library/libsimpletools/html/sync_off.png
    Adding library/libsimpletools/html/sync_on.png
    Adding library/libsimpletools/html/tab_a.png
    Adding library/libsimpletools/html/tab_b.png
    Adding library/libsimpletools/html/tab_h.png
    Adding library/libsimpletools/html/tab_s.png
    Adding library/libsimpletools/html/tabs.css
    Adding library/libsimpletools/lmm/libsimpletools.a
    Adding library/libsimpletools/source/addfiledriver.c
    Adding library/libsimpletools/source/count.c
    Adding library/libsimpletools/source/dac.c
    Adding library/libsimpletools/source/eeprom_getByte.c
    Adding library/libsimpletools/source/eeprom_getFloat.c
    Adding library/libsimpletools/source/eeprom_getInt.c
    Adding library/libsimpletools/source/eeprom_getStr.c
    Adding library/libsimpletools/source/eeprom_init.c
    Adding library/libsimpletools/source/eeprom_putByte.c
    Adding library/libsimpletools/source/eeprom_putFloat.c
    Adding library/libsimpletools/source/eeprom_putInt.c
    Adding library/libsimpletools/source/eeprom_putStr.c
    Adding library/libsimpletools/source/fpucog.c
    Adding library/libsimpletools/source/freqout.c
    Adding library/libsimpletools/source/getDirection.c
    Adding library/libsimpletools/source/getDirections.c
    Adding library/libsimpletools/source/getOutput.c
    Adding library/libsimpletools/source/getOutputs.c
    Adding library/libsimpletools/source/getState.c
    Adding library/libsimpletools/source/getStates.c
    Adding library/libsimpletools/source/high.c
    Adding library/libsimpletools/source/i2c_in.c
    Adding library/libsimpletools/source/i2c_init.c
    Adding library/libsimpletools/source/i2c_out.c
    Adding library/libsimpletools/source/i2cinit.c
    Adding library/libsimpletools/source/input.c
    Adding library/libsimpletools/source/itoa.c
    Adding library/libsimpletools/source/low.c
    Adding library/libsimpletools/source/mark.c
    Adding library/libsimpletools/source/pause.c
    Adding library/libsimpletools/source/pause_us.c
    Adding library/libsimpletools/source/pulseIn.c
    Adding library/libsimpletools/source/pulseOut.c
    Adding library/libsimpletools/source/pwm.c
    Adding library/libsimpletools/source/rcTime.c
    Adding library/libsimpletools/source/reverse.c
    Adding library/libsimpletools/source/sddriverconfig.c
    Adding library/libsimpletools/source/setDacBits.c
    Adding library/libsimpletools/source/setDirection.c
    Adding library/libsimpletools/source/setDirections.c
    Adding library/libsimpletools/source/setForget.c
    Adding library/libsimpletools/source/setIoDt.c
    Adding library/libsimpletools/source/setOutput.c
    Adding library/libsimpletools/source/setOutputs.c
    Adding library/libsimpletools/source/setPauseDt.c
    Adding library/libsimpletools/source/setStates.c
    Adding library/libsimpletools/source/setTimeout.c
    Adding library/libsimpletools/source/shiftIn.c
    Adding library/libsimpletools/source/shiftOut.c
    Adding library/libsimpletools/source/squareWave.c
    Adding library/libsimpletools/source/timeout.c
    Adding library/libsimpletools/source/toggle.c
    Adding library/libsimpletools/source/wait.c
    Adding library/libsimpletools/xmm_single/libsimpletools.a
    Adding library/libsimpletools/xmm_split/libsimpletools.a
    Adding library/libsimpletools/xmm_split/libsimpletools.map
    Adding library/libsimpletools/xmmc/libsimpletools.a
    Done.
    
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-15 13:11
    Oh, that's what you wanted, sorry.

    Ray
    Archiving Project: C:/Users/Ray/AppData/Local/Temp/Env_senseP1(1).zip
    Adding Env_senseP1(1).c
    Adding Env_senseP1(1).side
    Adding basic_i2c_driver.c
    Adding basic_i2c_driver.h
    Adding sRTC.c
    Adding sRTC.h
    Adding sht11.c
    Adding sht11.h
    Done.
  • jazzedjazzed Posts: 11,803
    edited 2013-12-15 13:21
    Rsadeika wrote: »
    Oh, that's what you wanted, sorry.

    Ray

    Does your project always have -I ./library/* in it?
    Does your library really live under your project folder?

    Typically projects live in a workspace like SimpleIDE/My Projects and the library lives in the SimpleIDE/Learn/Simple Libraries folder.
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-15 13:50
    I did a standard install, the only thing that I did do different is chose a Workspace Folder on an external drive. Now, I was looking at the Project Manager and I have two that are -I C:/Users ..., and two that are -L C:/Users... One of each for .../libfdserial, and one of each for libsimpletext. I do not see anything for .../libsimpletools.
    If I am not mistaken, I had the same thing occur for 0-9-43, but it seems like everything is compiling correctly, I think?

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2013-12-15 14:03
    Rsadeika wrote: »
    I did a standard install, the only thing that I did do different is chose a Workspace Folder on an external drive. Now, I was looking at the Project Manager and I have two that are -I C:/Users ..., and two that are -L C:/Users... One of each for .../libfdserial, and one of each for libsimpletext. I do not see anything for .../libsimpletools.
    If I am not mistaken, I had the same thing occur for 0-9-43, but it seems like everything is compiling correctly, I think?

    Ray
    Thanks Ray.

    Can you please remove the -L and -I project entries and try the ZIP again?
    I'm guessing that ZIP is ignoring the Library folder because of those entries.

    Really would like to resolve this - it's hard to tell if it's a feature or a bug at the moment.
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-15 14:25
    Still no libsimpletools, I did a build and did not get any errors.

    Ray
    Archiving Project: C:/Users/Ray/AppData/Local/Temp/Env_senseP1(2).zip
    Adding Env_senseP1(2).c
    Adding Env_senseP1(2).side
    Adding basic_i2c_driver.c
    Adding basic_i2c_driver.h
    Adding sRTC.c
    Adding sRTC.h
    Adding sht11.c
    Adding sht11.h
    Done.
  • jazzedjazzed Posts: 11,803
    edited 2013-12-15 14:49
    Last zip request.

    Can you Click "Clear Settings" on Properties -> General, then "Cancel", then restart SimpleIDE. You will need to use Project -> Open to get your project back. Then do ZIP again, and let me know if that changes anything.

    Thanks.
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-15 14:57
    Does not look like anything changed.

    Ray
    Archiving Project: C:/Users/Ray/AppData/Local/Temp/Env_senseP1(3).zip
    Adding Env_senseP1(3).c
    Adding Env_senseP1(3).side
    Adding basic_i2c_driver.c
    Adding basic_i2c_driver.h
    Adding sRTC.c
    Adding sRTC.h
    Adding sht11.c
    Adding sht11.h
    Done.
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-17 03:46
    Below is my latest program, I added two new commands: five24 - logs every five minutes for twenty four hours; five1 - logs every five minutes for one hour. I wanted to make sure the global variables are affecting the senselog COG in the expected manner. The next command should be a command that has a time start, time end, and a duration time, this should be a little more challenging, memory space permitting.

    Because this program will be running 24/7, I need to have a method of exchanging the SD card without having too turn off the device. Since it is not set up with a "hot swapping" capability, I guess I need something like an 'unmount' and 'mount' commands. Is there something like that in the SD support code?

    This is not a project yet, I still have to make sure I completely understand how the stack allocation works, and how many more COG sessions I can add with the current memory constraints.

    Ray
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-19 13:57
    Below is a code snippet that has a nested if loop, is that legal in C? The program compiles without errors, and does not give a warning as to the legality of the nested if loop, but it is not doing what I want it too do. If that is not legal what would be the correct coding for that block of code?

    Ray
          while(1)
          {
              /* Check for stop. */
              int real_ms,real_mh;
              int temp3,temp4,temp5;
              real_mh = get_Hour(temp4);
              real_ms = get_Minute(temp3);
              if(stop_h == real_mh)  // Check stop hour
              {
                if(stop_m == real_ms) //break; // Check stop minute
                {
                  fclose(sp);
                  low(27);
                  logstat = 0;
                  break;
                }
              }
              // Do data logging
              time_SD();             // Get time.
              fwrite("  ",1,2,sp);
              sprint(outBuff,"%f",sht11_temp);
              fwrite(outBuff,1,8,sp);  // Write temp.
              fwrite("  ",1,2,sp);
              sprint(outBuff,"%f",sht11_humid);
              fwrite(outBuff,1,8,sp);  // Write humid.
              fwrite("\r\n",1,2,sp);  // CR
              sleep(timer_d);   // Sleep for xxx minutes. Sleep time       
          }
    
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-20 06:26
    I finally resolved the issue, in the previous post, a couple of bugs, so obvious, but I could not see them, what a horrible experience. I still have to get a handle on the stack allocation experience, if you do not get it right, it shows up in the program in a very subtle way, you end up scratching your head as to what you think the problem is.

    Is the Propeller Platform a dead issue? I noticed at the MGH Designs site that it is very quiet in terms of new shields being offered, so is this a platform that you should spend resources on? But, I do not see anybody else offering a product that has an on board RTC and flash ram. I think the Propeller is still looking for a good, workable platform to reside on. Decisions, decisions, what is my next move?

    Ray
  • dgatelydgately Posts: 1,630
    edited 2013-12-20 09:10
    Rsadeika wrote: »
    Below is a code snippet that has a nested if loop, is that legal in C?
          while(1)
          {
            ...
              sleep(timer_d);   // Sleep for xxx minutes. Sleep time       
          }
    

    Well, if's aren't loops themselves. Your 'while' block is the only loop here. Nested loops and if statements can be nested in C...

    I find that 'break' statements can be confusing and have caused even large corporations (see: http://stackoverflow.com/questions/2565659/i-want-to-know-the-behaviour-of-break-statement-in-c-does-it-work-only-for-fo) consternation in the past, so I try to avoid them unless I can't see a better way to code around them. (I know this will cause forum upheaval, but that's just me!)...

    Since your outer if block (when true) doesn't do anything if the inner block is false, why use the break statement at all? I tried to simplify your code example, below. Also, although C or C++ compilers may optimize the declarations of your ints, for clarity I would move those declarations out of the while loop.
          int real_ms,real_mh;
          int temp3,temp4,temp5;
          while(1)
          {
              /* Check for stop. */
              real_mh = get_Hour(temp4);
              real_ms = get_Minute(temp3);
              if(stop_h == real_mh && stop_m == real_ms)  // Check stop hour
              {
                fclose(sp);
                low(27);
                logstat = 0;
              }
              else
              {
                // Do data logging
                time_SD();             // Get time.
                fwrite("  ",1,2,sp);
                sprint(outBuff,"%f",sht11_temp);
                fwrite(outBuff,1,8,sp);  // Write temp.
                fwrite("  ",1,2,sp);
                sprint(outBuff,"%f",sht11_humid);
                fwrite(outBuff,1,8,sp);  // Write humid.
                fwrite("\r\n",1,2,sp);  // CR
                sleep(timer_d);   // Sleep for xxx minutes. Sleep time 
              }      
          }
    

    Take my changes with a grain of salt, of course.

    dgately
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-20 09:22
    Thanks dgately, here is my version of how I solved the issue. There is a big while loop that is not shown here, so I figured this would be a good way to check for start and stop times based on hour and minute. Now I can just as easily add a month variable to this, I think the if statement(s) can handle another '&&' for the month.

    Ray
          while(1)
          {
    /* Check for start. */
            int real_sm,real_sh;
            int temp,temp1,temp2;
            real_sh = get_Hour(temp1);
            real_sm = get_Minute(temp);
            if((start_h == real_sh) && (start_m == real_sm)) break;
          }
          while(1)
          {
              /* Check for stop. */
              high(27);
              int real_ms,real_mh;
              int temp3,temp4,temp5;
              real_mh = get_Hour(temp4);
              real_ms = get_Minute(temp3);
              if((stop_h == real_mh) && (stop_m == real_ms)) break; // Check stop hour
              // Do data logging
              time_SD();             // Get time.
              fwrite("  ",1,2,sp);
              sprint(outBuff,"%f",sht11_temp);
              fwrite(outBuff,1,8,sp);  // Write temp.
              fwrite("  ",1,2,sp);
              sprint(outBuff,"%f",sht11_humid);
              fwrite(outBuff,1,8,sp);  // Write humid.
              fwrite("\r\n",1,2,sp);  // CR
              sleep(timer_d);   // Sleep for xxx minutes. Sleep time       
          }
          fclose(sp);
          low(27);
          logstat = 0;
        }
    
  • jazzedjazzed Posts: 11,803
    edited 2013-12-20 09:34
    Upheaval !!!

    LOL
Sign In or Register to comment.