분류 전체보기246 Flask, HTML,CSS,Javascript 활용하기 위와 같이 폴더 구성 안의 파일은 tree 에서 보이는 것 같이 배치 index.py 실행 별로 안이쁜데 ;; 2021. 8. 12. ch3 -1 어셈블리 명령어 해석 명령어 해석 .386 는 80x86 cpu 의 명령어 뿐만 아니라 다른 상위버전 명령어도 받을수 있도록 해준다. .MODEL FLAT : flat 메모리 방식을 사용한다고 알려준다. ExitProcess 함수를 정의 한다. (ExitProcess 는 시스템에 저장되어 있는함수이다.) PROTO 명령어는 c 언어에서 함수 선언 부분이라고 알려주는 부분이다. PROTO 명령어로 함수의 틀을 먼저 정해 놓으면 ExitProcess 함수를 나중에 구현하더라도 코드에서 에러가 발생하지 않는다. EQU 명령어는 상수값을 정하는 것과 같다 .cr 은 0x0d 를 의미하고 lf 0x0a 를 의미한다. _start: 엔트리 포인트를 정한다. INVOKE ExitProcess , 0 : ExitProcess 함수를 부른다.. 2021. 8. 12. ch3 . element of assembly language MASM : Microsoft Macro Assembler . 1. Assembly Language Statements directive ssembler directives are directions to the assembler to take some action or change a setting. Assembler directives do not represent instructions, and are not translated into machine code. directive 는 어셈블러 의 셋팅을 조절하는 방식이라 생각하면 된다. ('#', '.' 등으로 시작한다.) ex) .text – The .text directive tells the assembler that the informatio.. 2021. 8. 12. Flask 이용해서 웹서버 구축 및 이용 from flask import Flask app = Flask(__name__) @app.route("/") def helloworld(): return "Hello World" if __name__ == "__main__": // import 된게 아니라 main 으로 실행될때 app.run(host="0.0.0.0") cf) __name__ 속성은 각 파일이 들고 있는데 각 파일이 import 되지 않고 main(진입점) 으로 시작 된다면 __name__ 은 __main__ 값을 갖는다. 즉 if 문은 파일이 main 으로 실행 되었을때 실행 되는 코드이다. web 주소에 ip 주소를 치면 라즈베리 파이로 만든 웹 서버로 접속 가능하다. 포트 번호는 기본적으로 5000 번이다. web 서버를 통한 .. 2021. 8. 12. 80x86 cpu register chapt 2 플레그 레지스터 2021. 8. 12. PWM 제어 26 pin 을 사용해서 LED 의 PWN 을 제어해 본다. #!/usr/bin/python #-*- coding:utf-8 -*- import RPi.GPIO as GPIO import time PWM_pin = 26 # 불필요한 warning 제거 GPIO.setwarnings(False) # GPIO핀의 번호 모드 설정 GPIO.setmode(GPIO.BCM) GPIO.setup(PWM_pin, GPIO.OUT) p = GPIO.PWM(PWM_pin,50) p.start(0) # 듀티비 0 try: while 1: for dc in range(0,101,5): p.ChangeDutyCycle(dc) time.sleep(0.1) for dc in range(100,-1,5): p.ChangeDutyC.. 2021. 8. 12. 라즈베리 파이 polling , 이벤트 방식 전압 감지 3.3 v 가 15번 핀으로 들어오면 출력 회로도 Polling import RPi.GPIO as GPIO import time button_pin = 15 # 불필요한 warning 제거 GPIO.setwarnings(False) # GPIO핀의 번호 모드 설정 GPIO.setmode(GPIO.BCM) GPIO.setup(button_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) while 1: if GPIO.input(button_pin) == GPIO.HIGH: print("Button Pushed!") time.sleep(0.1) push 버튼 누르면 위와 같이 출력된다. 이벤트 button_callback 함수를 이벤트에 연결해준다. #!/usr/bin/python .. 2021. 8. 11. 라즈베리 파이 하드웨어 기본 26 번 핀으로 LED 깜빡이는 코드 작성 #!/usr/bin/python #-*- coding:utf-8 -*- import RPi.GPIO as GPIO import time led_pin = 26 GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(led_pin,GPIO.OUT) for i in range(10): GPIO.output(led_pin,1) time.sleep(1) GPIO.output(led_pin,0) time.sleep(1) GPIO.cleanup() GPIO 를 조절한다. gpio readall : 핀의 번호랑 상태를 알려준다. sudo cat /sys/kernel/debug/gpio pin 의 상황을 가지고 있는 파일이다. .. 2021. 8. 11. atmel studio 에서 printf, scanf 사용 uart 통신을 통한 putty 에 printf scanf 사용하기 atmel studio 에서 동작 #include #include #include #define F_CPU 16000000 #include #define UART_REG 0xC0 #define RXC 0x80 #define TXC 0x40 #define UDRE 0x20 enum { DATA_5BIT, DATA_6BIT, DATA_7BIT, DATA_8BIT }; #define CHAR_SZ_SHIFT 1 #define BAUD_2400 2400 #define BAUD_4800 4800 #define BAUD_9600 9600 #define BAUD_14400 14400 #define BAUD_19200 19200 #define BAUD.. 2021. 8. 11. 이전 1 ··· 10 11 12 13 14 15 16 ··· 28 다음