Close

A Simple Program

A project log for Tiny Bit Machine

An 8-bit solar powered gadget.

gordonGordon 08/17/2024 at 06:080 Comments

Below is simple 9 byte program. I wrote it while doing low power tests.

R1 127:  8M L0H S1 LPR1: EOP

 A brief explanation of whats going on:

  1. R1 127 (Set register 1 to value of 127)
  2. :         (Expression Seperator symbol)
  3. 8M                  (Deep Sleep 8 minute)
  4. L0H                    (Set LED 0 Pin High)
  5. S1                              (Delay 1 Second)
  6. LPR1      (Loop expression the amount of times equal to value of register 1)
  7. :         (Expression Seperator symbol)
  8.  EOP  (End of program code, not really needed but could prevent issues...)

This program will sleep for 8 minutes, flash LED for 1 second, then sleep for 8 minutes, and repeat 127 times... or ~17 hours!

There is an OP for setting LED low, and I originally wrote this like: deepsleep,led on sleep 1 sec, led off, sleep one sec, loop. But then I realized the devices function for going into deepsleep changes all pins to input pull_down. So there is no need to call L0L (OP for setting LED 0 low, yeah i know... lol) if the next OP is a deep sleep call.

Below is the binary code for the program:

1000 0001
0111 1111
1111 1111
1011 1000
1101 0100
1001 0001
1010 0001
1111 1111
1000 0000

Discussions