Skip to content

Instantly share code, notes, and snippets.

View captdam's full-sized avatar
🛠️
Back to dev

Captdam captdam

🛠️
Back to dev
View GitHub Profile
@captdam
captdam / ATM.ino
Created March 23, 2019 00:57
Embeded system project2 part2
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdint.h>
#include <IRremote.h>
#include <LiquidCrystal.h>
#define TIMEOUT 120
#include <avr/io.h>
#include <avr/interrupt.h>
#include <LiquidCrystal.h>
#include <stdint.h>
#define LED 9
#define PUSH 8
#define TIMEOUT 10000
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
--2 4-bit divider
--Include libearies
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
--Block IO
entity divider is
port(
--8-bit ALU unit
--Include libearies
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
--Block IO
entity alu is
port(
@captdam
captdam / Ultrasonic Sensor Demo
Last active December 20, 2018 07:48
ultrasonic-sensor.a51
;
@captdam
captdam / func_uart.a51
Last active December 20, 2018 05:53
Intel 8051 MCU UART functions
FUNC_UART_SEND_RAW:
; UART Function, send the value stored in ACC, in raw binary format
; Input: ACC: The value
; Output: void
MOV SBUF, A
JMP $
RET
;It is recommanded to write this block in the parent function, instead of call this function
FUNC_UART_SEND_STRING:
@captdam
captdam / func_spi.a51
Last active November 9, 2018 08:58
Intel 8051 MCU Software SPI
FUNC_SPI:
; SPI Function (Start - Send cmd - Exchange data - end)
; MSB send first
; Input: A: Send cmd; B: Send data;
; Return: A: Get data;
MISO EQU P3.4
MOSI EQU P3.5
SCLK EQU P3.6
SS EQU P3.7
@captdam
captdam / template.a51
Last active December 19, 2018 08:55
STC89C52RC template.a51
;SFR - STC89C52RC
XICON EQU 0xC0
T2CON EQU 0xC8
T2MOD EQU 0xC9
RCAP2L EQU 0xCA
RCAP2H EQU 0xCB
TL2 EQU 0xCC
TH2 EQU 0xCD
WDT_CONTR EQU 0xE1
ISP_DATA EQU 0xE2