hungdt-geeky / ktmt-luyentap Goto Github PK
View Code? Open in Web Editor NEWCác bài tập lập trình môn học kiến trúc máy tính (HUS)
Các bài tập lập trình môn học kiến trúc máy tính (HUS)
/*
// Viet chuong trinh dieu khien den LED
/*
Trong schematic, den LED duoc noi vao chan 7 <-> PE5(den LED duoc noi vao PORT E, bit so 5)
Muon duoc dieu khien duoc den LED thi bit ket noi den LED phai la OUTPUT.
/
/
Trong AVR co 3 thanh ghi tac dong vao bit
Thanh ghi DDR = Data DiRection: thanh ghi chi huong du lieu (INPUT/OUTPUT)
DDR = 0: bit do nhan du lieu tu device (INPUT) DDR = 1: bit do dua du lieu tu MCU ra ngoai device (OUTPUT)
Thanh ghi PORT: thanh ghi du lieu
PORT = 1 + OUTPUT: ghi du lieu loi ra len CVV(5V hoac 3.3V)
PORT = 1 + INPUT: treo bit do len VCC (PULL UP)
PORT = 0: ghi du lieu OUTPUT ve GND (0V)
Thanh ghi PIN: thanh ghi doc du lieu (INPUT)
Neu doc du lieu co logic la 5V (VCC) -> PIN = 1
Neu doc du lieu co logic la 0V (GND) -> PIN = 0
*/
/*
De den lED co the dieu khien duoc, thanh ghi DDR tac dong vao PORT E, bit phai bang 1
DDRE.5 = 1; // Thanh ghi DDR tac dong PORT 5, bit 5 = 1
Muon den LED sang, tuy thuoc vao cach tac dong vao den LED
Neu noi theo kieu K, LED sang khi PORT = 1
Neu noi theo kieu A, LED sang khi PORT = 0
"Kieu noi trong mach dien thuc hanh la kieu noi A"
Vay de den LED sang, thanh ghi PORT tac dong vao PORT E, bit 5 = 0
PORTE.5 = 0
*/
#include <io.h>
void main(void) {
DDRE.5 = 1;
PORTE.5 = 0;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.