Strange Behaviour Propeller Mini ?

Hi there,
I'm very new to this propeller things and observe strange behaviour at my first (well, second, the "Hello World" worked out of the box) learn program.

I have a Propeller Mini (very recent) and the board is set to "GENERIC"
I have altered the program "cog info exchange.c" as follows:
  Cog Info Exchange.c
  Example of two cogs exchanging information with a volatile global variable.
  The main function in cog 0 changes the value; and it affects the blink function's
  rate running in cog 1.

#include "simpletools.h"                      // Library include

void blink();                                 // Forward declaration
int *cog;                                     // For storing process ID
volatile int dt;                              // Declare dt for both cogs

int main()                                    // Main function
  while(1) {        // <<-- added this
    dt = 100;                                 // Set value of dt to 100
    cog = cog_run(blink, 128);                // Run blink in other cog
    pause(2000);                              // Let run for 2 s

    dt = 20;                                  // Update value of dt
    pause(2000);                              // New rate for 2 s
  }                     // <<--          
  cog_end(cog);                               // Stop the cog

void blink()                                  // Function for other cog
  while(1)                                    // Endless loop
    high(14);                                 // LED on
    pause(dt);                                // ...for dt ms
    low(14);                                  // LED off
    pause(dt);                                // ...for dt ms

The expected behaviour would be a pulse with 50/50 duty cycle changing from 5Hz to 25Hz and back ... but it does not!
The duty cycle is not 50/50 and changes until it is 100/0 which is effectively a high voltage on pin 14 ....

What am I missing?


Sign In or Register to comment.