archieve: homework7 test1
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* name: homework7.h
|
||||||
|
* author: msksbr
|
||||||
|
* date: 2025-5-20
|
||||||
|
* purpose:
|
||||||
|
* variable:
|
||||||
|
* 1. pins number for 8x8 LED matrix
|
||||||
|
* function:
|
||||||
|
* 1. initialize the 8x8 LED matrix x template
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <REG52.H>
|
||||||
|
|
||||||
|
// variable:
|
||||||
|
// 1. pins number for 8x8 LED matrix:
|
||||||
|
// Y template:
|
||||||
|
sbit LED_Y0 = P2 ^ 0;
|
||||||
|
sbit LED_Y1 = P2 ^ 1;
|
||||||
|
sbit LED_Y2 = P2 ^ 2;
|
||||||
|
sbit LED_Y3 = P2 ^ 3;
|
||||||
|
sbit LED_Y4 = P2 ^ 4;
|
||||||
|
sbit LED_Y5 = P2 ^ 5;
|
||||||
|
sbit LED_Y6 = P2 ^ 6;
|
||||||
|
sbit LED_Y7 = P2 ^ 7;
|
||||||
|
// X template:
|
||||||
|
sbit LED_X0 = P3 ^ 0;
|
||||||
|
sbit LED_X1 = P3 ^ 1;
|
||||||
|
sbit LED_X2 = P3 ^ 2;
|
||||||
|
sbit LED_X3 = P3 ^ 3;
|
||||||
|
sbit LED_X4 = P3 ^ 4;
|
||||||
|
sbit LED_X5 = P3 ^ 5;
|
||||||
|
sbit LED_X6 = P3 ^ 6;
|
||||||
|
sbit LED_X7 = P3 ^ 7;
|
||||||
|
|
||||||
|
// function:
|
||||||
|
// 1. initialize the 8x8 LED matrix x template:
|
||||||
|
void init_x_template()
|
||||||
|
{
|
||||||
|
LED_X0 = 0;
|
||||||
|
LED_X1 = 0;
|
||||||
|
LED_X2 = 0;
|
||||||
|
LED_X3 = 0;
|
||||||
|
LED_X4 = 0;
|
||||||
|
LED_X5 = 0;
|
||||||
|
LED_X6 = 0;
|
||||||
|
LED_X7 = 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* name: test1.c
|
||||||
|
* author: msksbr
|
||||||
|
* date: 2025-5-20
|
||||||
|
* description: a test program for a homework
|
||||||
|
* homework zh_CN: 点亮点阵左上角的那个LED小灯
|
||||||
|
* homework en_US: light up the LED in the top left corner of the LED matrix
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "homework7.h"
|
||||||
|
|
||||||
|
void test1()
|
||||||
|
{
|
||||||
|
init_x_template();
|
||||||
|
LED_X0 = 1;
|
||||||
|
LED_Y7 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
test1();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user