Close

PIC10F200 version

A project log for desperate firefly

Silicon Laboratories inc. sell MCU named Busy Bee, I decided to give it a try by transforming one in desperate firefly.

JacquesJacques 12/17/2017 at 00:320 Comments

I was not done yet. I decided to create  a PIC10F200 version of desperate firefly.

The PIC10F200 is the simplest MCU available.  As for peripherals it only have an 8 bits timer and a watchdog timer. 256x12bits words  of flash memory and 16 bytes of RAM. It run on an 4Mhz internal oscillator. PIC execute instructions in 4 clocks cycles, this means 1 million instructions par second at most because branch and call needs 8 clocks cycles. Although the Fsys frequency can't be reduce to save power, the MCU can be placed in a low power mode using <i>sleep</i> machine code instruction.  When in sleep mode the MCU can be reset by the watchdog timer overrun. So in this version the strategy was to put the MCU in sleep mode and use the watchdog timer to reset it at regular interval, set the new status of the LED according to message bitstream stored in flash memory and then put the MCU back in sleep.

The MPLABX project is included in PIC10F200_version on the github repository

I prefer to code these little MCU in assembler.

   include "P10F200.INC"
    
    
    ; LED connected on GP2
    constant LED=(1<<GP2)  
    ; sos message bit counter
    constant count=16 ; this is a variable at address 16.
    
    code 
    org 0
; hardware init
    movlw (1<<NOT_GPWU)|(1<<PSA)|4
    OPTION
    movlw ~LED
    TRIS  GPIO
    btfss STATUS,NOT_TO ; if a power reset clear count
    goto next_bit
    clrf count
    
next_bit:
    movfw count
    call sos
    xorlw 0
    skpz 
    bcf GPIO,GP2
    skpnz
    bsf GPIO,GP2
    incf count
    movlw .28
    xorwf count,W
    skpnz
    clrf count
    sleep

sos: ; data  message 0=LEDoff, 1=LEDon
    addwf PCL,F
    dt 1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,0,0,0,0,0
    
    end
    

The measured current drain is very similar to the EFM8BB10F8G version.

Discussions