User Tools

Site Tools


dev8051:dev8051

This is an old revision of the document!


Things 8051

Merging all my notes related to 8051-based system development.

Core 8051

Microcontroller/board info.

Board51:stc15w204s (8-pin)

Picture

stc15w204s front stc15w204s back

Block diagram

stc15w204s pins stc15w204s pins

May need proper USB2serial cable (e.g. PL2303-based)

stc15w204s pins

2024/11/11 11:48 · azman

Code 8051

Example codes (in C) for the classical Intel-8051 (mcu51) microcontroller core. Using my1code51 library. Tested using sdcc open source compiler and stc12 device.

Codes for NMK322

Codes to test hardware modules available for our NMK322 Microcontroller lab.

Code: IR module and Ultrasonic sensor module

Testing IR module and HC-SR04 ultrasonic sensor module.

Code: BT module and servo

Testing HC06 bluetooth module , TowerPro MG996R servo.

Testing HC06 bluetooth module , TowerPro MG996R servo & Text LCD.

Code: RFID module and OLED

Testing RFID (FRC522) and OLED (ssd1306).

Code: Testing Base Kit

Testing Base Kit (202425s1).

Code: relay

Testing basic relay.

relay.c
/*----------------------------------------------------------------------------*/
#include "timer.h"
#include "uart.h"
/*----------------------------------------------------------------------------*/
MY1SBIT(DRIVE,PIN20);
MY1SBIT(INPUT,PIN10);
/*----------------------------------------------------------------------------*/
void main(void) {
	unsigned char wait;
	timer_init();
	uart_init();
	uart_puts("\nTESTING RELAY\n");
	DRIVE = 1; /* active low */
	INPUT = 1;
	while(1) {
		if (INPUT==0) {
			uart_puts("-- Switch ON... ");
			DRIVE = 0;
			wait = 3*TIMER_LOOP_1S;
			do { timer_wait(TIMER_VAL50MS); } while (--wait);
			uart_puts("OFF.\n");
			DRIVE = 1;
			while (!INPUT);
		}
	}
}
/*----------------------------------------------------------------------------*/

Code: gtuc51

Test code for the old GTUC51B001 development board.

2024/11/11 11:50 · azman
dev8051/dev8051.1731297193.txt.gz · Last modified: by azman