Giter Site home page Giter Site logo

ktmt-luyentap's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

kiendepzai99

ktmt-luyentap's Issues

Edit docs

/*

  • Bai_1.c
  • Created: 24-Sep-20 8:56:40 AM
  • Author: quockhanh
    */

// 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;

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.