1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798#include #include #include #define sei() {#asm("sei")}unsigned char led = 0b00000000;int status = 0;interrupt [2] void int0_func(){ // INT.0의 인터럽트 벡터는 2 if(status == 2){} else if(status == 3){ led = (led>>1)&led..
int0에서 Low level 검출 시 count 값을 하나 증가 count 값을 2진수로 led 표현 count값 초기값은 0, 최대값을 255로 정의 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 #include #include #include unsigned char led = 0; interrupt [2] void add_num(){ // INT.0의 인터럽트 벡터는 2 if(led == 255){ led = 0; PORTB = ~led; delay_ms(300); }else { led = led +1; PORTB = ~led; delay_ms(300); } } void main(){ EIMSK..
연습문제 1 ✓ PD0의 상태를 확인하여 SW3의 눌림을 확인 ✓ 스위치가 눌리는 숫자를 count하여 이진수로 LED 표시 ✓ 255번 이상일 시 에는 초기값 0 으로 변경 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #include #include #include void main(void) { unsigned char count = 0x00; DDRB = 0xff; DDRD = 0x00; while(1){ if(PIND.0 == 0){ count++; delay_ms(100); } PORTB = ~count; } } cs 추가 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22..
이차원 배열 12345678910111213141516171819202122#include int main() { // m[10][10]에서 m[0]의 의미는 무엇인가? int m[10][10] = { {11,12,13,14,15,16,17,18,19,10}, {21,22,23,24,25,26,27,28,29,20}, }; printf("이차원 배열의 인덱스 : %d\n", m); printf("이차원 배열의 첫 행 인덱스 : %d\n", m[0]); printf("이차원 배열의 첫 행, 첫 열의 원소 : %d\n", m[0][0]); // m[n]은 행에 대한 인덱스라고 할 수 있다. // m[10][10]에서 (m+1)의 의미는 무엇인가? printf("인덱스의 주소 : %d\n", m); print..
- const : 상수표 같은 읽기 전용 변수에 사용 : 혹 const 안붙인 상수 변수중 멤버 하나만 바꿔도, .const/.bss에 메모리 이중으로 잡히고 초기화때 복사도 함 : const char *A; A = "sample"(OK); *A = 'c'(X); A는 상수문자 포인터므로, A가 가리킨 *A는 상수문자이므로 변경불가 : char * const A = "sample"; A[1] = 'i'(OK); A++(X); A는 상수 (문자포인터)므로, 주소값이 상수로 변경불가 - volatile : 외부장치/인터럽트에 의해 변경되는 메모리, 딜레이를 위한 루프 등 일반적인 컴파일러가 변경할 코드를 못 건드리게 함 : 데이터가 휙 날아가거나 일시적이기 때문에 (volatile의 뜻), 컴파일러가 최적화..
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity VGA_Pattern_Generator is port( nRst : in std_logic; clk : in std_logic; VGA_CLK : out std_logic; VGA_BLANK : out std_logic; VGA_HS : out std_logic; VGA_VS : o..
0~15를 카운팅하여 LED로 표시하는 프로그램을 테스트 해보자 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #include #include #include void main(void) { unsigned char led = 0x00; DDRB = 0xff; PORTB = 0x00; while(1) { delay_ms(1000); led++; PORTB = ~led; if(led==15) led=0x00; } } cs 0에서 15, 15에서 0으로 반복하여 led로 표시 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #include #include #include void main(void) { unsigned char le..
1초 생성기 12345678910111213141516171819202122232425262728293031323334353637383940414243library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity sec_gen is port( nRst : in std_logic; clk : in std_logic; sec_sig : out std_logic );end sec_gen; architecture BEH of sec_gen is signal cnt : std_logic_vector(31 downto 0); signal sig : std_logic; begin..
계층 구조(Hierarchy structure) 전체 시스템의 설계를 하나의 디자인이 아닌 기능별로 구분된 최소 모듈(블록)단위로 설계하고 이를 Top-Down 구조로 연결하거나, 협업/분업 설계(Bottom-Up)설계하여 완성시키는 방식 COMPONENT(AND GATE) 1234567891011121314151617library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity and_gate is port( A : in std_logic; B : in std_logic; Y : out std_logic );end and_gate; architecture BEH o..
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816..
- Total
- Today
- Yesterday
- alpine.js
- SQLite
- nosql
- hoisting
- vue
- Azure
- REACT
- node.js
- Remix
- MySQL
- Gatsby.js
- oracle
- Quasar
- RDBMS
- vue.js
- aws
- DevOps
- Next.js
- nuxt.js
- svelte
- gcp
- 이진탐색 #중복
- PostgreSQL
- Cloud
- JavaScript
- Angular
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |