336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

http://extremeelectronics.co.in/microchip-pic-tutorials/introduction-to-pic-interrupts-and-their-handling-in-c/


인터럽트의 종류를 크게 나누자면 크게 4종류로 나뉜다.

External Interrupts

TIMER Interrupts

Analog to Digital Converter Interrupts

Data Interrupts



상세히 정리하면 아래와 같다.

External Interrupts

they are namemd INTx (Like INT0, INT1 etc),

they provide a means for External Hardware

to generate Interrupts.

Like if you connect a touchscreen controller

to your PIC MCU.

Then the touchscreens PENINT (pen interrupt = 팬으로 터치하면 인터럽트)

can be connected to INT0.

Then whenever the pen (or stylus) touches the screen

it will interrupt the CPU.

This interrupt will be explained in details in its own tutorial.


TIMER interrupts

They are also very common in MCUs.

Today’s MCUs comes with very sophisticated timers that can do lots of magic for you.

They have they related interrupts.

In most simple situation

they can act like alarm clocks that can interrupt the CPU at predefined intervals.

If you toggle a i/o pin in response to these alarms (interrupts),

what you have is a frequency generator!

(in response to : ~에 대한 응답으로)

For more info on timers on PIC18, read this article.

Analog to Digital Converter Interrupts

A/D Converter takes some time to complete its operation.

So the CPU can either wait for it to complete 

or 

set up an AD conversion complete interrupt.


In the latter case CPU can do other tasks while A/D converter converts the input.

(the latter case : 후자의 경우)

As soon as A/D converter completes its job it will inform CPU to read the value from its buffer. For more info on A/D Converter of PIC18, read this article.


Data Interrupts

MCUs have many different types of data i/o engines, 

like USARTSPII2CParallel etc.

They can also interrupt the CPU 

when data transmission is complete or data arrives from external source.

Like an RFID reader send a packet 

because a user just brought his or her card near the reader. 

Or the GSM module detected an incoming call.


How interrupts are managed?

어떻게 인터럽트들이 다뤄지는가?

In general each interrupt source have following related bits.

Enable Bit

The are suffixed with IE (Interrupt Enable) example 

TMR0IE stands for TIMER0 Interrupt Enable. 

It can be used to enable/disable the related interrupt. 

When set to ’1′ it enables the interrupt.

Flag Bit 

It is set automatically by the related hardware 

when the interrupt condition occurs. 

It is generally suffixed with IF (Interrupt Fag).

When it is set to ’1′ we know that interrupt has occurred.

For example when TMR0IF is set by TIMER0, 

it indicates that TIMER0 has overflowed.

Priority Bit - 

We can leave this for now to keep things simple. 

We won’t be using interrupt priority feature of PIC18.

 

Code.txt



Arduino Interrupt

▼Original Code

Test_program.txt


▼아직은 Error 있음

버튼A(수동모드) 버튼B(자동모드).txt


▼HEX코드

sketch_apr30a.ino.standard.hex




▲위 그림에서 O표시한 "Connect it to Arduino Input" 그림을 주의깊게 봐야한다.

"To verify the Output"라고 표시된 LEDVCC,GND 만 연결해놓은 상태에서 PhotoInterrupt의 중간을 차단하면 눈으로 확인하기 위해서 탈부착으로 연결했다.

이때의 출력용 LED를 제거하면, 그 전류가 "Connect it to Arduino Input"핀으로 흘러간다.

(C:Collector, E:Emitor -- Emitor의 전류가 출력용 LED에 흘러간다.)

그리고 여기 O표시한 핀과 아래그림의 O표시한 핀을 Jumper로 연결하면 된다.


위에 표시된 글을 좀더 크게 적었다.

아까 PhotoInterrupter의 출력을 여기 OO로 표한 핀에 연결하면 된다.

OO사이는 Open되있으므로 따로따로 입력이 들어간다.

두개의 PhotoInterrupt를 사용해서 출입문을 만들면 된다.


Posted by ElectricShock
:
BLOG main image
잡동사니들(지극히 개인취향인...) (다른글에도 댓글 부탁해요♥) You May Leave English Messages on GuestBook. by ElectricShock

공지사항

카테고리

분류 전체보기 (782)
Programming(=프로그래밍) (3)
MiDi (2)
Animation (4)
Blender (3D Graphic Program.. (10)
Blendtuts.com (Series) (1)
Blender 기초 팁들 (2)
Processing (디지털미디어과) (2)
Music (1)
Books in the world (0)
Communication(CAN, UART, et.. (12)
MCU Examples (PIC 기반) (7)
Transistor (1)
Mikro C Pro (11)
Mikro Pascal (1)
Proton IDE (0)
Robot (0)
Swift 3D (1)
Dummies Series (1)
All about Hacking (0)
제2 외국어 (1)
PIC 해외서적들 (3)
AVR (25)
PIC (MikroC) (MPLAB) (4)
Assembly (2)
ARM (3)
Arduino (26)
PSpice (1)
Proteus ISIS (14)
CodeVision (2)
FPGA (15)
MPLAB (24)
PCB (the Procedure) (15)
3D Printer (5)
PICKIT3 (6)
Matlab (11)
RaspBerry PI (15)
BeagleBone (1)
Android Studio (17)
졸업작품 (172)
Korea History (0)
Issue(사회) (73)
Multimeter 리뷰 (1)
Oscilloscope (1)
A (34)
B (19)
J (6)
C (32)
P (12)
T (37)
H (12)
I (12)
M (44)
R (5)
E (5)
F (2)
D (9)
O (2)
L (7)
S (9)
W (2)
V (6)
G (14)
Visual C++ or Visual Studio (2)
Android App Development (0)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백