Skip to content

Instantly share code, notes, and snippets.

STC Micro 8051 Microcontroller Notes

Quick Notes

The critical few things you need to know about it are:

  1. They are 1T (single clock cycle) 8051 compatible MCUs (but some instructions may take as many as 5 or 6 clock cycles to complete) and most are capable of operating at up to 35MHz. Check the markings on your part. If it says something like "28I", then it means that your part has been rated to operate at up to 28MHz. Note that rather than use nice round numbers like 12MHz, which is possible, it is more customary to use specific operating frequencies that facilitate the generation of a lower error UART baud rate. I.e., 11.0592MHz, than would otherwise be possible.
  2. They have a built-in bootloader that emits a magic number, then listens on UART0 (RxD, TxD) on bootup. The ISP programmer uses this.
  3. There are two main HEX file download tools, the manufacturer's own STCISP which is an all singing and dancing development support tool (it has pinout information, timer configuration and code generation t
@travisbrown
travisbrown / sken.md
Last active January 16, 2023 14:26
Tweets from ZIO contributor "sken"

Update: I've been told by representatives of the Scala Center at EPFL that sharing the information below on the Scala Contributor list is a violation of the Scala Code of Conduct and could result in a ban.

This document contains some quotations by "sken", an active contributor to ZIO and member of the ZIO community. This individual uses the name Lorca in various places, including his first and longest-lived Twitter handle, and will be referred to as Lorca throughout this document. All of the information below is publicly available and easily linked to Lorca.

Note that all of the tweets below would have been visible to the other ZIO community members who regularly interacted with Lorca via the same Twitter account, including John De Goes, the CEO of [Ziverge](https://ziverge

@passcod
passcod / CARETAKERS.md
Last active December 29, 2021 17:28
Caretaker maintainership in a nutshell

Caretaker Maintainership

(If this file is included in a project, you can find the list of current caretakers at the bottom.)

In a small classical open-source project, maintainers do a lot, and if maintainers don't have time to do a lot, usually the project stalls. Finding new maintainers is hard because few people actively want to take over all the responsibilities of a project. There must be a different way.

With Caretaker Maintainership, "Maintainers" become "Caretakers". Caretakers' only mandatory responsibility is to grant Releasers commit and publish access to the project.

<link rel="shortcut icon" width=32px>
<canvas style="display: none" id="loader" width="16" height="16"></canvas>
<script>
class Loader {
constructor(link, canvas) {
this.link = link;
this.canvas = canvas;
this.context = canvas.getContext('2d');
this.context.lineWidth = 2;
#!/usr/bin/awk -f
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# Assumptions: the data is evenly spaced along the x-axis
# TODO: moving average
@hillexed
hillexed / portalexplanation.md
Last active June 16, 2019 23:30
BABA has PORTAL GUN

Here's how my level implementing Portal in Baba is You works! If you haven't seen it, here's a video: https://streamable.com/9pflr

Baba is You is a game played with the arrow keys. How can Baba fire a portal gun and still have the ability to walk around? The answer: there's one more button the game allows, and that's the wait button - which makes baba stand still and allows a turn to pass in the game world. In this level, the wait button does more than wait - it fires the portal gun.

The skull crosses are a gadget to activate an arbitrary rule when the wait button is pressed. The following rules are used to set it up:

FUNGUS MAKE BABA
BABA ON FUNGUS IS MOVE AND MOVE
BABA ON SKULL IS EMPTY
@passcod
passcod / __why-and-how-to-use.md
Last active March 22, 2023 13:33
Bootstrap 4 mixins for spacing utilities without classes

Why?

This:

.action {
  @extend .ml-3;
}
// ==UserScript==
// @name BTD from_list mute filter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description mm
// @author You
// @match https://tweetdeck.twitter.com
// @grant none
// ==/UserScript==
@achanda
achanda / dotexec.md
Last active March 8, 2018 03:52
Dot execing Rust
  • Wrapper script
root@dev:~# cat `which rustwrap`
#!/usr/bin/env bash

rustc "$1" -o foobar && shift && ./foobar "$@"
  • Mount binfmt_misc
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
@jdarpinian
jdarpinian / executable.c
Last active March 20, 2024 15:28
Add one line to your C/C++ source to make it executable.
///bin/true;COMPILER_OPTIONS="-g -Wall -Wextra --std=c99 -O1 -fsanitize=address,undefined";THIS_FILE="$(cd "$(dirname "$0")"; pwd -P)/$(basename "$0")";OUT_FILE="/tmp/build-cache/$THIS_FILE";mkdir -p "$(dirname "$OUT_FILE")";test "$THIS_FILE" -ot "$OUT_FILE" || $(which clang || which gcc) $COMPILER_OPTIONS -xc "$THIS_FILE" -o "$OUT_FILE" || exit;exec "$OUT_FILE" "$@"
#include <stdio.h>
int main() {
printf("Hello world!\n");
return 0;
}