Shop OBEX P1 Docs P2 Docs Learn Events
Putting Code into a COG — Parallax Forums

Putting Code into a COG

DiscoveryDiscovery Posts: 606
edited 2014-04-21 23:28 in Propeller 1
I could use some sample code that shows how to run a separate program in a COG. Actually, three programs will run in three separate COGs.

How is the coding accomplished?

Discovery
«1

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-04-04 10:22
    Look in the Propeller manual for the cognew instruction.

    -Phil
  • Dave HeinDave Hein Posts: 6,347
    edited 2014-04-04 10:25
    Discovery, based on your 3 other posts I assume you are asking how to do this in C. Look at the cog_c_toggle demo program to see how it's done. It's located in "My Documents/SimpleIDE/Propeller GCC Demos/toggle/cog_c_toggle".
  • twm47099twm47099 Posts: 867
    edited 2014-04-04 10:28
    Discovery wrote: »
    I could use some sample code that shows how to run a separate program in a COG. Actually, three programs will run in three separate COGs.

    How is the coding accomplished?

    Discovery
    If you are using C there is an example in the C-Learning System Tutorial. Here's the link:

    http://learn.parallax.com/propeller-c-functions/multicore-example

    If you are programing in Spin, I'd recommend using the Propeller Education Kit Labs Fundamentals book. It has lessons and code for using the cogs. You can download the pdf from this page:

    http://www.parallax.com/downloads/propeller-education-kit-labs-fundamentals-text

    Although the circuits use the Propeller Education Kit, it's easy enough to use with any Prop board. I use the quickstart and activity boards.

    Hope this helps
    Tom
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-04-04 11:12
    Oh, sorry: I didn't notice which subforum the question was posed in.

    -Phil
  • DiscoveryDiscovery Posts: 606
    edited 2014-04-04 11:14
    Thank's for the link.

    I am programming in "C".

    I will get right on it.

    Discovery
  • DiscoveryDiscovery Posts: 606
    edited 2014-04-04 12:36
    Hi,
    I wrote a test program composed of the Multicore Example as referenced above. Every character was checked and checked again...then again.

    The output is a string of about twenty 5001's followed by about the same number of 5002's and this format continues to 5003, 5004, etc.

    Any reason why it does that?

    Discovery
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2014-04-04 14:25
    Discovery wrote: »
    Hi,
    I wrote a test program composed of the Multicore Example as referenced above. Every character was checked and checked again...then again.

    The output is a string of about twenty 5001's followed by about the same number of 5002's and this format continues to 5003, 5004, etc.

    Any reason why it does that?

    Discovery

    Hi Discovery,

    Did you hand-enter Multicore Example into a new project, or did you run the example program supplied with the SimpleIDE Learn folder?

    If you hand-entered the code, could you please run Multicore Example.side from this folder: Documents\SimpleIDE\Learn\Examples\C Intro\Basics
    ....and tell us what happens?
  • DiscoveryDiscovery Posts: 606
    edited 2014-04-04 20:41
    Hi Steph,

    I hand entered the code. After Looking at the While Loops I noticed why the strange output appeared. The display rate in the main program was faster than the adder loop rate so the pattern emerged. I made the pause values the same and the 5000 number increased by one as it should.

    I used the same approach in the Multicore Example for my propeller development code and the COG worked fine. In my application, I designed the propeller COGs to operate with a math-coprocessor to handle floating point numbers, the main COG for my program, and three more COGs to run identical programs. These three identical programs use the input function to detect the rising edge of three square wave inputs, count the number of rising edges, and make the three summations available to the main COG program. I cannot get all three input counting cogs to work at the same time. I duplicated the one counting code three times in the main program but only the last referenced COG produces a measurement.

    There must be a cleaver way to get the COGS to run separately but in all my reading of forums and tutorials...I just cannot find any solution. I am getting frustrated. When I write programs for the BS2 modules...it is real breeze to use the pull-down library that explains the functions and how they are used. Whoever built the BS2 P-Basic code reference deserves a pat on the back. That was outstanding. It is too bad that the same was not done for the Propeller C. I could really use some hands on help.

    Discovery
  • jazzedjazzed Posts: 11,803
    edited 2014-04-04 20:51
    Discovery wrote: »
    Whoever built the BS2 P-Basic code reference deserves a pat on the back. That was outstanding. It is too bad that the same was not done for the Propeller C. I could really use some hands on help.
    Do you know where to find the Propeller C Library information?

    Would an index of all available functions be helpful?

    Today the functions are all described in the library page found under the SimpleIDE Help menu. The library page is also online here.

    The BS2 has a very limited but useful set of utility functions. Having a limited set makes things much easier.
  • DiscoveryDiscovery Posts: 606
    edited 2014-04-05 19:29
    Hi Jazzed,

    Yes
    Yes
    I have the Library available
    Limited but very informative

    My problem is to build an industrial robot control system using the propeller programmed in "C" that uses one COG for math co-processor functions, a second COG for the main control program, and three additional COGs that implement up/down counters that make the count variables available to the main program and receive separate inputs to zero the counters.
    I was provided code that allowed me to set up a COG with the up counter code (currently lacking the control signals for down counting) and it worked. However, when I tried to start another COG with the same program...the first COG was shut down.
    The program used a function start_cog() which does not show up in the library. Using start_cog two and three times does not work...only the last cog is working...it would appear.
    The function that makes sense to me to use is cog_run() which says it will run a function code in the next available cog. But when I try this I get and error that I cannot correct. There must be a lot more to using the function than meets the eye.
    What I really need is a short piece of code that shows precisely how to setup three COGs that work with passing global variable data between the main program and the three COG up/down counters. If you have setup two or more COGs that work, would you provide me the code so that I can learn how to implement it? Just looking at library functions isn't going to cut it.

    Discovery

    Oops...an error.

    I got the cart before the horse...I did not mean start_cog, I meant cogstart().

    Discovery
  • DiscoveryDiscovery Posts: 606
    edited 2014-04-08 07:48
    Steph and Andy Lindsay,

    The code that I generated and loaded into the three COGs that act as up/down counters cannot all run at the same time. Each one runs correctly as the GOG is started but stops as the next COG is started.

    How can this be corrected so that all three up/down counters operate at the same time?

    Sincerely,

    Discovery
  • SRLMSRLM Posts: 5,045
    edited 2014-04-08 08:15
    Discovery wrote: »
    Steph and Andy Lindsay,

    The code that I generated and loaded into the three COGs that act as up/down counters cannot all run at the same time. Each one runs correctly as the GOG is started but stops as the next COG is started.

    How can this be corrected so that all three up/down counters operate at the same time?

    Sincerely,

    Discovery

    Of course, to help us diagnose this issue you'll have to post your code.
  • ersmithersmith Posts: 6,054
    edited 2014-04-08 08:39
    Indeed, a code post would be helpful. In general there's certainly no problem in running multiple cogs at once, but the devil is in the details. Each cog needs its own stack (if you try to share then things will go bad quickly). Any variables shared between cogs have to be managed carefully, and probably have to be declared volatile. Make sure that if the cog is reading some initial data that the main program waits for it to start up before re-using that memory space.

    Here's an example that runs 3 counters in parallel and then loops printing out their values:
    /* simple program to illustrate 3 counters running at the same time */
    #include <stdio.h>
    #include <propeller.h>
    
    // stack to give to the new cogs; depending on the C code running this
    // could be larger or smaller (but needs to be at least sizeof(_thread_start_t))
    
    #define STACK_SIZE 512
    
    unsigned char stack1[STACK_SIZE];
    unsigned char stack2[STACK_SIZE];
    unsigned char stack3[STACK_SIZE];
    
    /* these are the variables that are incremented by the COGs
       they must be marked volatile so the compiler knows they may change
       unexpectedly
    */
    volatile int counter1;
    volatile int counter2;
    volatile int counter3;
    
    /* data structure passed to the increment function */
    struct myarg {
      volatile int *counter;  /* pointer to the variable to increment */
      int delta;     /* amount to increment */
      int sleep;     /* time to sleep between increments (in microseconds) */
    };
    
    /* the function run in the COGs */
    void increment(void *varg)
    {
      struct myarg *arg = (struct myarg *)varg;
      /* copy the variables out of the arg so they are in local
         registers (in case the COG that started us re-uses the memory */
    
      volatile int *counter = arg->counter;
      int delta = arg->delta;
      int naptime = arg->sleep;
    
      *counter = delta;  // indicate we have started
      for(;;) {
        usleep(naptime);
        *counter += delta; // actually do the increment
      }
    }
    
    /* function to start a COG running increment
       parameters are: variable to increment, delta, sleep time, and a stack
       returns cogstart result
    */
    int
    startinc(volatile int *counter, int delta, int sleep, void *stack, size_t stack_size)
    {
      struct myarg arg;
      int r;
    
      // zero out the counter; the new COG will change this to indicate it started
      *counter = 0;
    
      // set up the arguments
      arg.counter = counter;
      arg.delta = delta;
      arg.sleep = sleep;
      r = cogstart(increment, (void *)&arg, stack, stack_size);
    
      if (r < 0) {
        printf("error starting COG!\n");
        return r;
      }
      // wait for the caller to start
      while (*counter == 0)
        ;
    
      return r;
    }
    
    void
    main()
    {
      int cog;
    
      printf("multi-cog counter test...\n");
    
      // start up the cogs
      // note that each must have its own stack!
      cog = startinc(&counter1, 1, 1000000, stack1, sizeof(stack1));
      printf("started cog %d\n", cog);
      cog = startinc(&counter2, 10, 2000000, stack2, sizeof(stack2));
      printf("started cog %d\n", cog);
      cog = startinc(&counter3, 100, 3000000, stack3, sizeof(stack3));
      printf("started cog %d\n", cog);
    
      // now loop printing the counters
      for(;;) {
        printf("counters=\t%d\t%d\t%d\n", counter1, counter2, counter3);
      }
    }
    
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2014-04-08 08:53
    jazzed wrote: »


    Would an index of all available functions be helpful?

    ....

    Steve, I just installed the latest version of Madcap Flare to get going on that index. Stay tuned!
  • edited 2014-04-08 12:27
    Hmmm, you may have stumbled across some issues with the way the simpletools library handles the floating point co-processing. Updates will be posted soon. Please accept my apologies for the lost time.

    In the meantime, some test code is below with rudimentary versions of the features you explained. Here also is a temporary simpletools library fix (steps 1...7 for you). For the time being, please also avoid using the print function to display result of attempts to divide floating point values by 0.0.

    (0) For others who want to try this, replace your learn folder with the 2/27/14 or newer version available here http://learn.parallax.com/propeller-c-set-simpleide/update-your-learn-folder.
    (1) Use SimpleIDE's Open Project button to open Documents\SimpleIDE\Learn\Simple Libraries\Utility\libsimpletools\libsimpletools.side
    (2) If the project manager pane is not visible along the left, click the Open Project Manager button (bottom-left corner of SimpleIDE window) to display it.
    (3) Right click fpucog.c -> source/fpucog.c and select delete. (Or just click it and hit the delete key)
    (4) Make sure the Memory Model field in the Project Options tab is set to CMM Main RAM Compact.
    (5) Click the Build Project button.
    (6) Make sure it compiled.
    (7) Shut down all instances of SimpleIDE, then restart.
    #include "simpletools.h"                      // Include simpletools   
    
    void squareWaves3();                          // Forward declare squareWaves3
    volatile int sqwPin[] = {26, 27, 5};          // 3 square wave pins
    volatile int sqwFreq[] = {5, 6, 7};           // 3 square wave freqs
    
    void cycleCount3();                           // Forward declare cycelCount3
    volatile int countPin[] = {26, 27, 5};        // 3 counting pins
    volatile int cycles[] = {0, 0, 0};            // 3 cycle counts
    
    void floatCop();                              // Forward declare fp coprocessor
    volatile float errorVal;                      // Float value
    
    int main()                                    // Main function
    {
      cog_run(squareWaves3, 50);                  // Run squareWave3 in other cog
      cog_run(cycleCount3, 50);                   // Run cycleCount3 in other cog                   
      cog_run(floatCop, 50);                      // Run floatCop in other cog
    
      int reps = 0;                               // Start reps count at 0
      while(1)                                    // Main loop
      {
        for(int i = 0; i < 3; i++)                // i 0...2
          print("cycles[%d] = %d  ",              // Display cycles counted
                 i, cycles[i]);
        print("\nerrorVal = %f\n\n",              // Display errorVal
              errorVal);
        pause(1000);                              // Wait 1 s
        if(reps++ == 4)                           // If reps is 4
          for(int i = 0; i < 3; i++)              // ... double all frequencies
            sqwFreq[i] *= 2;
      }          
    }
    
    void squareWaves3()                           // Other cog 3 square waves 
    {
      int f[3];                                   // For frequency tracking
      int dt[3];                                  // Time tick increments
      int t[3];                                   // Time tick tracking
      for(int i = 0; i < 3; i++)                  // Set up 3 signals
      {
        f[i] = sqwFreq[i];                        // Local copy of freqs
        low(sqwPin[i]);                           // Initialize pins
        dt[i] = CLKFREQ/(f[i]*2);                 // Set up time increments
        t[i] = CNT;                               // Mark current times
      } 
      int i = 0;                                  // Initialize i;
      while(1)                                    // Cog loop
      {
        if(f[i] != sqwFreq[i])                    // If new freq
        {
          f[i] = sqwFreq[i];                      // Update values
          dt[i] = CLKFREQ/(f[i]*2);
        }      
        if(CNT - t[i] > dt[i])                    // If time's up
        {
          toggle(sqwPin[i]);                      // Toggle pin
          t[i] += dt[i];                          // Advance toggle timer
        }      
        i++;                                      // Advance index
        if(i == 3) i = 0;                         // Reset if out of range
      }
    }
    
    void cycleCount3()                            // 3 signal counters
    {
      int state[3];                               // States for comparison
      int i;
      for(i = 0; i < 3; i++)                      // Store initial states
      {
        state[i] = input(countPin[i]);            // Check each pin state
      }
      int inState;                                // For storing pin's current state
      i = 0;                                      // i -> zero
      while(1)                                    // Cog loop
      {
        inState = input(countPin[i]);             // Get input state of current pin
        if(state[i] != inState)                   // If state changed
        {
          if(!inState) cycles[i]++;               // If low, increment cycles
          state[i] = inState;                     // Remember current state
        }      
        i++;                                      // 012012012...
        if(i == 3) i = 0;
      }
    }
    
    void floatCop()                               // FP coprocessor
    {
      while(1)
      {
        errorVal = (((float) cycles[1] - (float) cycles[0]) / ((float) cycles[1] + 1));
      }  
    }
    
    
  • DiscoveryDiscovery Posts: 606
    edited 2014-04-08 18:08
    I am out of State and incommunicado until next week. I will review your answers when I return.
    Thank you

    Discovery
  • DiscoveryDiscovery Posts: 606
    edited 2014-04-14 16:07
    Hi,

    I am back and tried to run the ersmith code and the Lindsay code by hand entering the code into two programs. I received a compiler error on line 13 unsigned char STACK2[STACK_SIZE] for ersmith

    and

    an error on line 22 cog_run(squareWaves3, 50); for the Lindsay code.

    Would you put these two programs on the mydocuments/simpleIDE/propeller GCC Demos folder so that I can run your code?

    Sincerely,

    Discovery
  • SRLMSRLM Posts: 5,045
    edited 2014-04-14 17:09
    I'd check your transcription, or even better, simply copy and paste the code. ersmith's code compiles fine for me. I don't have simpletools on my machine, but I suspect that Andy's code may have suffered a transcription error as well.
  • DiscoveryDiscovery Posts: 606
    edited 2014-04-14 19:09
    There is no transcription error in ersmith's code. Every character, space, comma, etc. is identical...but it will not compile.

    I will try copying the code.

    Discovery
  • DiscoveryDiscovery Posts: 606
    edited 2014-04-14 19:17
    Eating crow...

    I just noticed the transcription errors. Three of them all semicolons.

    The code runs fine.

    Thank you for the suggestion.

    Sincerely,

    Discovery
  • ersmithersmith Posts: 6,054
    edited 2014-04-15 02:56
    Hand entering the code is fraught with dangers -- it's much better to copy and paste.

    [edited because I just noticed you managed to get it working -- glad you found the issues. In general it's helpful to post the exact compiler error when you get one -- that can help diagnose the issue.]

    Regards,
    Eric
  • DiscoveryDiscovery Posts: 606
    edited 2014-04-15 07:28
    There was a transcription error in my coding of ERSMITH's code. Three semicolons were missing. His code runs fine.

    For Andy Lindsay's code...I cannot find any error in transcription. The compiler will not compile cog_run.

    Discovery
  • edited 2014-04-15 09:07
    If you have not already followed the instructions on this page:

    http://learn.parallax.com/propeller-c-set-simpleide/update-your-learn-folder

    ...do so and then try again. Make sure to restart SimpleIDE after updating the library and before re-running the code example.

    If that doesn't make it work, copy all the error messages, and paste them into a reply on this thread. For best results in the forum post, add [noparse]
    just above the error messages and
    
    [/noparse] just below them.

    Example
    [noparse]
    Project Directory: C:/Users/alindsay/Documents/SimpleIDE Dev/Forums Discovery/
    
    propeller-elf-gcc.exe -v GCC 4.6.1 (propellergcc_v1_0_0_2054)
    propeller-elf-gcc.exe -I . -L . -I C:/Users/alindsay/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools -L C:/Users/alindsay/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools/cmm/ -I C:/Users/alindsay/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libsimpletext -L C:/Users/alindsay/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libsimpletext/cmm/ -I C:/Users/alindsay/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c -L C:/Users/alindsay/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c/cmm/ -o cmm/make a bug.elf -Os -mcmm -m32bit-doubles -fno-exceptions -std=c99 make a bug.c -lm -lsimpletools -lsimpletext -lsimplei2c -lm -lsimpletools -lsimpletext -lm -lsimpletools -lm
    make a bug.c: In function 'main':
    make a bug.c:17:3: error: expected ';' before '}' token
    Done. Build Failed!
    
    Click error or warning messages above to debug.
    
    [/noparse]

    Results

    It'll look like this in the post.
    Project Directory: C:/Users/alindsay/Documents/SimpleIDE Dev/Forums Discovery/
    
    propeller-elf-gcc.exe -v GCC 4.6.1 (propellergcc_v1_0_0_2054)
    propeller-elf-gcc.exe -I . -L . -I C:/Users/alindsay/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools -L C:/Users/alindsay/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools/cmm/ -I C:/Users/alindsay/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libsimpletext -L C:/Users/alindsay/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libsimpletext/cmm/ -I C:/Users/alindsay/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c -L C:/Users/alindsay/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c/cmm/ -o cmm/make a bug.elf -Os -mcmm -m32bit-doubles -fno-exceptions -std=c99 make a bug.c -lm -lsimpletools -lsimpletext -lsimplei2c -lm -lsimpletools -lsimpletext -lm -lsimpletools -lm
    make a bug.c: In function 'main':
    make a bug.c:17:3: error: expected ';' before '}' token
    Done. Build Failed!
    
    Click error or warning messages above to debug.
    
  • DiscoveryDiscovery Posts: 606
    edited 2014-04-16 05:38
    Hi Andy Lindsay,

    Andy, I was able to find and correct the semicolon errors in my transcription of ERSMITH's code and run the code but the code you provided is much closer to the configuration that my controller requires.

    If I can get your code to run, it should be a relatively easy task of inserting the additional control panel interface I/O to make the machine operate. I am just learning to program in "C" and find myself struggling to understand the commands that you and the other well seasoned "C" programmers use rather easily.

    I tried to copy your code but I could only get portions...actually it took three copy segments to get the entire code to print onto paper where I made the transcription into my code.

    What do you recommend as the best way for me to get your code into my machine?

    Sincerely,

    Discovery
  • DiscoveryDiscovery Posts: 606
    edited 2014-04-16 06:18
    Andy,

    I downloaded the Learn Folder files and began to perform the seven steps listed in your forum note. I was able to delete the function fpucog.c->source/fpucog.c.

    However, I could not make sure that the memory model was CMM because there is no Project Options Tab.

    I will assume that the ram memory is set to CMM and perform steps 5, 6, and 7.

    Discovery
  • DiscoveryDiscovery Posts: 606
    edited 2014-04-16 06:41
    Andy,
    I performed all the steps except step 4 and cog_run(squareWaves3, 50); will not compile.
    Build error status
    c:55:18:error:expected ')' before ';' token
    c:58:3:error:expected ';' before '}' token
    Build Failed

    I thought it was peculiar that there are no opening and closing brackets for the instructions contained within the FOR and IF functions but I am still a novice in 'C' programming. As a What If...I added the brackets to the FOR and IF functions and got the same build failures.

    Discovery
  • DiscoveryDiscovery Posts: 606
    edited 2014-04-16 08:47
    Hi Andy,

    The Build Status

    Propeller Experiment(3).c:55:18:error:expected ')' before ';' token
    Propeller Experiment(3).c:58:3:error:expected ';' before '}' token
    Done.Build Failed!

    I noticed in the first while function there are no opening and closing brackets in the FOR and IF functions. I added them and got the same result.

    The compiler halts at cog_run(squareWaves3, 50);

    I just don't see the problem.

    Sincerely,

    Discovery
  • Dave HeinDave Hein Posts: 6,347
    edited 2014-04-16 08:53
    Discovery, can you post a screenshot showing the entire build status? It's possible to get syntax errors in known good code if a #include failed. Did you get any other error messages?
  • SRLMSRLM Posts: 5,045
    edited 2014-04-16 08:54
    You're running into transcription errors again. I've attached the program from #16 as a file. Can you try that?
  • edited 2014-04-16 10:58
    If I can get your code to run, it should be a relatively easy task of inserting the additional control panel interface I/O to make the machine operate. I am just learning to program in "C" and find myself struggling to understand the commands that you and the other well seasoned "C" programmers use rather easily.

    Here is a link to a set of tutorials designed to take minimum time while guiding you through enough C language, circuits, and programming the Propeller to get up to speed with multicore projects.

    http://learn.parallax.com/propeller-c-tutorials
    I thought it was peculiar that there are no opening and closing brackets for the instructions contained within the FOR and IF functions but I am still a novice in 'C' programming. As a What If...I added the brackets to the FOR and IF functions and got the same build failures.

    The for and while commands operate on either a single statement, or a block of statements contained in braces { }.
    ...However, I could not make sure that the memory model was CMM because there is no Project Options Tab....

    ...Propeller Experiment(3).c:55:18:error:expected ')' before ';' token
    Propeller Experiment(3).c:58:3:error:expected ';' before '}' token
    Done.Build Failed!

    I noticed in the first while function there are no opening and closing brackets in the FOR and IF functions. I added them and got the same result.

    The compiler halts at cog_run(squareWaves3, 50);...

    From this, I'm seeing a number of potential issues after correcting any transcription errors. So, attached is a zip of the code from post #16.

    (8) Open SimpleIDE and click Help -> About. Verify that you have SimpleIDE Version 0.9.45 or higher. If not, go to this page, and follow the instructions to update your software http://learn.parallax.com/propeller-c-set-simpleide. If you do update your software, you will also need to update your learn folder again, following the instructions here: http://learn.parallax.com/propeller-c-set-simpleide/update-your-learn-folder.

    (9) Download Putting Code into a Cog.zip (attached).

    (10) Unzip it to your desktop.

    (11) Use SimpleIDE's Open Project button. Use the Open Project dialogue to find the "Putting Code into a Cog" folder on your desktop, and open "Control System Test and Display.side" from within that folder.

    (12) After you have opened "Control System Test and Display.side" into SimpleIDE, click the Run with Terminal button.

    If your board has LED's connected to P26, P27, and P5, they should blink fairly rapidly (at rates of 5, 6, and 7 Hz, and then double that after 5th SimpleIDE Terminal update). The SimpleIDE Terminal should display the cycles it counted at each pin. If you want to test externally applied signals, make sure to comment cog_run(squareWaves3, 50) by adding a // to the left of it. Then, re-run the program before applying the external signals.
Sign In or Register to comment.