STC15F2K60S2 MCU 8x8x8 Light Cube

Publisher:冷漠之心Latest update time:2020-11-28 Source: 51heiKeywords:STC15F2K60S2 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The circuit diagram is as follows:
51hei.png

Component list:
Name Quantity Specification/Model Remarks
Universal board 3 18*30cm   
single-chip microcomputer STC15F2K60S2 1 DIP40 Unless you know how to change the program, please do not replace
74hc154 4 Both wide and narrow packages are available
40P IC holder 1        
24P IC holder 4        
Electrolytic capacitor 47uF 1        
104 capacitor 1        
Slide switch 1        
Copper column (including nut) 4 M3*100mm   
lamp beads 540 2*5*7mm mist color optional
bent pin header 1 Each group of 40P   
straight pin header 8 Each group of 40P   
white flying wire 2 Several   
USB to TTL downloaders 1 PL2303 series or CH340 series
female to female DuPont wire 3 Each group of 40P   
female to male DuPont wire 1 Each group of 40P   
micro switch 1        

The source program of the single-chip microcomputer is as follows:

/*Author: Wind Bell*/

#include "STC15F2K60S2.h"

#include "intrins.h"

#include "basic.h"

#define SET 0x00

#define CLR 0x00

#define Segs P0        

#define Out P1            

sbit Rest=P3^0;

void IO_int();

void Timer1Init(void);


Byte code table[]={

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

};

Byte code Segs_tab[]={

0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,

0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf,

0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,

0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f,

};

void Timer0Init(void);

unsigned char Anm1=0;

unsigned int End,Anm=0;

void main()

{

        EA=1;

        End=sizeof(table);        

        IO_int();

        Timer0Init();

  while(1)                                          

  {

   if(Rest==0)IAP_CONTR=0x60;

   if(Anm>End)Anm=0;

   

        Segs=Segs_tab[Anm1];        

        Out=table[Anm1+Anm];

  }

}


void IO_int()

{

        P0M1=0x00;

        P0M0=0x00;

        P1M1=0x00;

        P1M0=0xff;

}

void Timer0Init(void) //100 microseconds @ 22.1184MHz

{

        AUXR |= 0x80; //Timer clock 1T mode

        TMOD &= 0xF0; //Set timer mode

        TL0 = 0x5C; //Set the initial timing value

        TH0 = 0xF7; //Set the initial value of timing

        TF0 = 0; // Clear TF0 flag

        ET0=1;

        TR0 = 1; //Timer 0 starts timing

}


void delay() interrupt 1                                         

{                          

        TR0=0;     

          Anm1=Anm1+1;

          if(Anm1>63)Anm1=0;

          Out=CLR;

          Segs=0xff;                                

        TR0=1;   

}



Keywords:STC15F2K60S2 Reference address:STC15F2K60S2 MCU 8x8x8 Light Cube

Previous article:89C52 single chip microcomputer controls ISD4004 voice chip, multi-segment recording and playback source code
Next article:51 single chip infrared control stepper motor

Recommended ReadingLatest update time:2024-11-17 12:51

PIC microcontroller to realize the program of running water lamp
#include pic.h //流水灯  #define uchar unsigned char #define uint  unsigned int __CONFIG(0x3B31); void delay(uint x) { uint a,b; for(a=x;a 0;a--)   for(b=110;b 0;b--); } void main() { uchar i,temp; TRISA=0x00; while(1) {   temp=1;   for(i=0;i 6;i++)   {          PORTA=~temp;//    temp=temp 1;//    delay(200);   } } }
[Microcontroller]
Application of single chip microcomputer in low power consumption temperature detection system
1 Introduction In measurement and instrumentation, temperature detection has almost become an indispensable part. Traditional analog temperature sensors are either complicated in peripheral circuits or require the design of A/D conversion and cumbersome operation, which are subject to certain restrictions in use. Th
[Microcontroller]
Application of single chip microcomputer in low power consumption temperature detection system
AVR microcontroller DS18B20 temperature reading program - Mother's Day gift
/* DS18B20 read temperature byte program This function took me a lot of time. The main problem was that it didn't work when 51 could. I didn't solve it until today. It turned out that the values ​​of some delay functions were wrong. So even if you have done it, it may not be easy to use. Don't be careless. AVR intern
[Microcontroller]
The latest performance comparison of the top 17 global MCU chip manufacturers
Recently, MCU giants such as Infineon and NXP have successively released their latest financial reports and forecasts. Amid the market downturn, the growth of automotive MCUs seems to be in trouble. The latest market continues to decline, and domestic manufacturers are risin
[Automotive Electronics]
The latest performance comparison of the top 17 global MCU chip manufacturers
Design and proteus simulation of simple digital voltmeter based on PIC16F877 microcontroller
1. System functions 1.1 Can measure 8 input voltage values ​​from 0 to 5V; 1.2 Display in turn on the LED digital tube; 1.3 Single channel selection display; 2. System hardware design 2.1 The microcontroller is PIC16F877 2.2 The keyboard is a 4×4 column keyboard with 10 numeric keys 0…9 and 5 function keys: channel di
[Microcontroller]
Design and proteus simulation of simple digital voltmeter based on PIC16F877 microcontroller
Application of Decoupling Capacitors in Single Chip Microcomputer Systems
The first knowledge point is the application of decoupling capacitors. First of all, we need to introduce the application background of decoupling capacitors. This background is electromagnetic interference, which is the legendary EMI.   1. In winter, especially in inland cities where the air is relatively dry, many f
[Microcontroller]
Application of Decoupling Capacitors in Single Chip Microcomputer Systems
BCD code uses hexadecimal form to represent the microcontroller storage data
BCD code borrows hexadecimal form to represent the microcontroller storage data, data number system, data type, data encoding analysis The data stored in the microcontroller is stored in binary format. Data system: binary, decimal, hexadecimal, etc. Data types: character type (one byte), integer type (two bytes)
[Microcontroller]
High-precision division program and its use of 51 single-chip microcomputer
When developing 51 single-chip microcomputer application systems, developers often encounter multi-byte division and reciprocal problems. However, the relevant programs introduced in some current materials are complex, single-function, and low-precision. In the process of developing the GZ93 multi-function program-cont
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号