初始化:实验三
This commit is contained in:
+13
-11
@@ -4,17 +4,19 @@
|
|||||||
#include "homework2.h"
|
#include "homework2.h"
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
ENLED = 0;
|
ENLED = 0; // 使能LED模块(低电平有效)
|
||||||
ADDR3 = 1;
|
ADDR3 = 1; // 设置74HC138译码器地址位
|
||||||
ADDR2 = 1;
|
ADDR2 = 1; // 138译码器输入地址位2
|
||||||
ADDR1 = 1;
|
ADDR1 = 1; // 138译码器输入地址位1
|
||||||
ADDR0 = 0;
|
ADDR0 = 0; // 138译码器输入地址位0(组合地址0111选择LEDS6组)
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
D1 = 0;
|
D1 = 0; // 点亮D1 LED(低电平点亮)
|
||||||
D2 = 1;
|
D2 = 1; // 熄灭D2 LED
|
||||||
Delay(100000);
|
Delay(100000); // 保持当前状态约100ms
|
||||||
D1 = 1;
|
|
||||||
D2 = 0;
|
D1 = 1; // 熄灭D1 LED
|
||||||
Delay(100000);
|
D2 = 0; // 点亮D2 LED
|
||||||
|
Delay(100000); // 保持当前状态约100ms
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
BasedOnStyle: Microsoft
|
||||||
|
Language: Cpp
|
||||||
|
|
||||||
|
###################################
|
||||||
|
# indent conf
|
||||||
|
###################################
|
||||||
|
|
||||||
|
UseTab: Never
|
||||||
|
IndentWidth: 4
|
||||||
|
TabWidth: 4
|
||||||
|
ColumnLimit: 0
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
NamespaceIndentation: All
|
||||||
|
FixNamespaceComments: false
|
||||||
|
BreakBeforeBraces: Linux
|
||||||
|
|
||||||
|
###################################
|
||||||
|
# other styles
|
||||||
|
###################################
|
||||||
|
|
||||||
|
#
|
||||||
|
# for more conf, you can ref: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
||||||
|
#
|
||||||
|
|
||||||
|
AllowShortIfStatementsOnASingleLine: true
|
||||||
|
|
||||||
|
AllowShortLoopsOnASingleLine: true
|
||||||
|
|
||||||
|
AllowShortBlocksOnASingleLine: true
|
||||||
|
|
||||||
|
IndentCaseLabels: true
|
||||||
|
|
||||||
|
SortIncludes: false
|
||||||
|
|
||||||
|
AlignConsecutiveMacros: AcrossEmptyLines
|
||||||
|
|
||||||
|
AlignConsecutiveAssignments: Consecutive
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
{
|
||||||
|
"name": "homework3",
|
||||||
|
"type": "C51",
|
||||||
|
"dependenceList": [],
|
||||||
|
"srcDirs": [
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"virtualFolder": {
|
||||||
|
"name": "<virtual_root>",
|
||||||
|
"files": [],
|
||||||
|
"folders": []
|
||||||
|
},
|
||||||
|
"outDir": "build",
|
||||||
|
"deviceName": null,
|
||||||
|
"packDir": null,
|
||||||
|
"miscInfo": {
|
||||||
|
"uid": "80551480bccf7f03745c8c0c32115131"
|
||||||
|
},
|
||||||
|
"targets": {
|
||||||
|
"Debug": {
|
||||||
|
"excludeList": [],
|
||||||
|
"toolchain": "Keil_C51",
|
||||||
|
"compileConfig": {
|
||||||
|
"options": "null"
|
||||||
|
},
|
||||||
|
"uploader": "Custom",
|
||||||
|
"uploadConfig": {
|
||||||
|
"bin": "",
|
||||||
|
"commandLine": "",
|
||||||
|
"eraseChipCommand": ""
|
||||||
|
},
|
||||||
|
"uploadConfigMap": {},
|
||||||
|
"custom_dep": {
|
||||||
|
"name": "default",
|
||||||
|
"incList": [],
|
||||||
|
"libList": [],
|
||||||
|
"defineList": []
|
||||||
|
},
|
||||||
|
"builderOptions": {
|
||||||
|
"SDCC": {
|
||||||
|
"version": 3,
|
||||||
|
"beforeBuildTasks": [],
|
||||||
|
"afterBuildTasks": [],
|
||||||
|
"global": {
|
||||||
|
"device": "mcs51",
|
||||||
|
"optimize-type": "speed",
|
||||||
|
"use-non-free": false
|
||||||
|
},
|
||||||
|
"c/cpp-compiler": {
|
||||||
|
"language-c": "c99"
|
||||||
|
},
|
||||||
|
"asm-compiler": {},
|
||||||
|
"linker": {
|
||||||
|
"$mainFileName": "main",
|
||||||
|
"output-format": "hex"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Keil_C51": {
|
||||||
|
"version": 2,
|
||||||
|
"beforeBuildTasks": [],
|
||||||
|
"afterBuildTasks": [],
|
||||||
|
"global": {
|
||||||
|
"ram-mode": "SMALL",
|
||||||
|
"rom-mode": "LARGE"
|
||||||
|
},
|
||||||
|
"c/cpp-compiler": {
|
||||||
|
"optimization-type": "SPEED",
|
||||||
|
"optimization-level": "level-8"
|
||||||
|
},
|
||||||
|
"asm-compiler": {},
|
||||||
|
"linker": {
|
||||||
|
"remove-unused": true,
|
||||||
|
"output-format": "elf"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version": "3.5"
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
##########################################################################################
|
||||||
|
# Append Compiler Options For Source Files
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
# syntax:
|
||||||
|
# <your pattern>: <compiler options>
|
||||||
|
# For get pattern syntax, please refer to: https://www.npmjs.com/package/micromatch
|
||||||
|
#
|
||||||
|
# examples:
|
||||||
|
# 'main.cpp': --cpp11 -Og ...
|
||||||
|
# 'src/*.c': -gnu -O2 ...
|
||||||
|
# 'src/lib/**/*.cpp': --cpp11 -Os ...
|
||||||
|
# '!Application/*.c': -O0
|
||||||
|
# '**/*.c': -O2 -gnu ...
|
||||||
|
|
||||||
|
version: "2.0"
|
||||||
|
options:
|
||||||
|
Debug:
|
||||||
|
files: {}
|
||||||
|
virtualPathFiles: {}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# dot files
|
||||||
|
/.vscode/launch.json
|
||||||
|
/.settings
|
||||||
|
/.eide/log
|
||||||
|
/.eide.usr.ctx.json
|
||||||
|
|
||||||
|
# project out
|
||||||
|
/build
|
||||||
|
/bin
|
||||||
|
/obj
|
||||||
|
/out
|
||||||
|
|
||||||
|
# eide template
|
||||||
|
*.ept
|
||||||
|
*.eide-template
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
Vendored
+40
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "build",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "${command:eide.project.build}",
|
||||||
|
"group": "build",
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "flash",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "${command:eide.project.uploadToDevice}",
|
||||||
|
"group": "build",
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "build and flash",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "${command:eide.project.buildAndFlash}",
|
||||||
|
"group": "build",
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "rebuild",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "${command:eide.project.rebuild}",
|
||||||
|
"group": "build",
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "clean",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "${command:eide.project.clean}",
|
||||||
|
"group": "build",
|
||||||
|
"problemMatcher": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"files.autoGuessEncoding": true,
|
||||||
|
"C_Cpp.default.configurationProvider": "cl.eide",
|
||||||
|
"C_Cpp.errorSquiggles": "disabled",
|
||||||
|
"files.associations": {
|
||||||
|
".eideignore": "ignore",
|
||||||
|
"*.a51": "a51",
|
||||||
|
"*.h": "c",
|
||||||
|
"*.c": "c",
|
||||||
|
"*.hxx": "cpp",
|
||||||
|
"*.hpp": "cpp",
|
||||||
|
"*.c++": "cpp",
|
||||||
|
"*.cpp": "cpp",
|
||||||
|
"*.cxx": "cpp",
|
||||||
|
"*.cc": "cpp"
|
||||||
|
},
|
||||||
|
"[yaml]": {
|
||||||
|
"editor.insertSpaces": true,
|
||||||
|
"editor.tabSize": 4,
|
||||||
|
"editor.autoIndent": "advanced"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extensions": {
|
||||||
|
"recommendations": [
|
||||||
|
"cl.eide",
|
||||||
|
"keroc.hex-fmt",
|
||||||
|
"xiaoyongdong.srecord",
|
||||||
|
"hars.cppsnippets",
|
||||||
|
"zixuanwang.linkerscript",
|
||||||
|
"redhat.vscode-yaml",
|
||||||
|
"IBM.output-colorizer",
|
||||||
|
"cschlosser.doxdocgen",
|
||||||
|
"ms-vscode.vscode-serial-monitor",
|
||||||
|
"alefragnani.project-manager",
|
||||||
|
"cl.stm8-debug"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user