#include <stdint.h>
#include "stm8s208s.h"

void main(void)
{
    MEMLOC(CLK_CKDIVR) = 0x00; /* Set the frequency to 16 MHz */
    BITSET(CLK_PCKENR1, 7); /* Enable clk to TIM1 */

    // Configure timer
    // 250 ticks per second
    MEMLOC(TIM1_PSCRH) = (64000>>8);
    MEMLOC(TIM1_PSCRL) = (uint8_t)(64000 & 0xff);

    MEMLOC(TIM1_CR1) = 0x01; /* Enable timer */

    BITSET(PB_DDR, 0); /* Set PB0 as output */
    BITRST(PB_CR2, 0); /* Set low speed mode */
    BITSET(PB_CR1, 0); /* Set Push/Pull mode */

    for(;;) {
        if ((MEMLOC(TIM1_CNTRL)) % 250 <= 125) {
            BITTOG(PB_ODR, 0);
        }
    }
}

#include <stdint.h>
#include "stm8s208s.h"

void main(void)
{
    MEMLOC(CLK_CKDIVR) = 0x00; // Set the frequency to 16 MHz
    BITSET(CLK_PCKENR1, 7);

    // Configure timer
    // 1000 ticks per second
    MEMLOC(TIM1_PSCRH) = (16000>>8);
    MEMLOC(TIM1_PSCRL) = (uint8_t)(16000 & 0xff);
    // Enable timer
    MEMLOC(TIM1_CR1) = 0x01;

    /* Set PB0 as output */
    BITSET(PB_DDR, 0);

    /* Set low speed mode */
    BITRST(PB_CR2, 0);

    /* Set Push/Pull mode */
    BITSET(PB_CR1, 0);

    for(;;)
    {
        if ((MEMLOC(TIM1_CNTRL)) % 1000 <= 500) {
            BITTOG(PB_ODR, 0);
        }
    }
}

--- 
+++ 
@@ -3,28 +3,22 @@
 
 void main(void)
 {
-    MEMLOC(CLK_CKDIVR) = 0x00; // Set the frequency to 16 MHz
-    BITSET(CLK_PCKENR1, 7);
+    MEMLOC(CLK_CKDIVR) = 0x00; /* Set the frequency to 16 MHz */
+    BITSET(CLK_PCKENR1, 7); /* Enable clk to TIM1 */
 
     // Configure timer
-    // 1000 ticks per second
-    MEMLOC(TIM1_PSCRH) = (16000>>8);
-    MEMLOC(TIM1_PSCRL) = (uint8_t)(16000 & 0xff);
-    // Enable timer
-    MEMLOC(TIM1_CR1) = 0x01;
+    // 250 ticks per second
+    MEMLOC(TIM1_PSCRH) = (64000>>8);
+    MEMLOC(TIM1_PSCRL) = (uint8_t)(64000 & 0xff);
 
-    /* Set PB0 as output */
-    BITSET(PB_DDR, 0);
+    MEMLOC(TIM1_CR1) = 0x01; /* Enable timer */
 
-    /* Set low speed mode */
-    BITRST(PB_CR2, 0);
+    BITSET(PB_DDR, 0); /* Set PB0 as output */
+    BITRST(PB_CR2, 0); /* Set low speed mode */
+    BITSET(PB_CR1, 0); /* Set Push/Pull mode */
 
-    /* Set Push/Pull mode */
-    BITSET(PB_CR1, 0);
-
-    for(;;)
-    {
-        if ((MEMLOC(TIM1_CNTRL)) % 1000 <= 500) {
+    for(;;) {
+        if ((MEMLOC(TIM1_CNTRL)) % 250 <= 125) {
             BITTOG(PB_ODR, 0);
         }
     }
Reduce ticks to 250 to use 8bit diff
