1. 설계 목표- ATmega128보드를 이용해 인터럽트, Switch, LED, UART를 제어하여 슬롯머신을 구상한다.2. 설계 요구 사항1. The press and release of a button will be the “pulling the arm of the One-Armed Bandit”.2. The duration of the press and the release can be used to generate a pseudo-random number to create three columns of figures.3. A flashing light is used to indicate the machine is “moving”.4. There are four kinds of figures that can appear in a column:A. BAR B. BELL C. LEMON D. CHERRY E. DIAMOND5. The payout of the machine has the following rules:A. Three of a kind pays a Nickel (5 cents).B. A Cherry anywhere pays a Dime (10 cents).C. A pair of Cherry and Lemon anywhere pays a Quarter (25 cents).D. Three Diamonds are a Jackpot. (100 dollar) E. Everything else loses.3. 설계 수행 내용사용 모듈Atmega128LEDUARTSWITCHUART- 초기화면( 기본 Slot machine 게임 룰 및 도움말 )- 예금액 지정( 초기 제공 금액 : 100)- 배팅액 지정(1 BET 당 10cent)- Slot machine rullet 설정-rullet설정으로 인한 배팅금액 초기화 , CREDIT금액 +--리셋시킴으로써 다시 초기화면 출력LED- switch0을 누름으로써 인터럽트가 일어나고 slot machine reullet이 설정되면서 LED가 점멸됫다가 꺼진다.Switch- switch0slot machine 돌리기- switch1배팅 금액 올리기 1씩(credit-=10)- switch2배팅 최대 금액으로 전환4. 설계 수행 결과 (화면 캡쳐▶uart 초기화면- slot machine 이라는걸 보여주고 rull에 대해서 설명을 해준다그리고 현재 예금액과 배팅액을 보여준다.▶switch1을 눌렀을 때-배팅금액이 올라가며 BET 1=CREDIT 10cent.▶switch0을 눌러 배팅금액을 설정해줌으로써 slot machine을 돌릴수 있다.배팅금액을 설정해주지 않고 switch0을 누르면 ‘please betting'을 출력한다배팅금액을 설정해주면 machine 이 실행되어 table1,table2,table3에 slot들이 나타나게 된다.▶switch0을 눌러 rullet이 돌아가 랜덤으로 table이 정해질 때 rullet이 돌아가고 있다는 걸 눈으로 보여 주기 위해 LED점멸(0xAA)A. 소스 code/*Micro proccesor Mini Project #1담당 교수 : 유 준혁 교수님팀 : 1조팀원 : 윤 아름 (21231925)최 호준 (21034562)*/#include //avr입출력 헤더파일#include //delay헤더파일#include //인터럽트 헤더파일#include //난수를 이용하기 위한 헤더파일#include //c언어 이용하기 위한 헤더파일SIGNAL(SIG_INTERRUPT0);//INT0의 INTRRUPT서비스 루틴 선언SIGNAL(SIG_INTERRUPT1);//INT1의 INTRRUPT서비스 루틴 선언SIGNAL(SIG_INTERRUPT2);//INT2의 INTRRUPT서비스 루틴 선언SIGNAL(SIG_INTERRUPT3);//INT3의 INTRRUPT서비스 루틴 선언unsigned char Help[]="Welcome Slot Machine";//머리말unsigned char Rull1[]="Three of a kind pays a Nickel (5 cents)";//룰설명unsigned char Rull2[]="A Cherry anywhere pays a Dime (10 cents)";//룰설명unsigned char Rull3[]="A pair of Cherry and Lemon anywhere pays a Quarter (25 cents)";//룰설명unsigned char Rull4[]="Three Diamonds are a Jackpot. (100 dollar)";//룰설명unsigned char Rull5[]="Everything else loses";//룰설명unsigned char stop=0;//음수가 아닌 양수 인 char형 stop 변수 선언unsigned char start=0;//음수가 아닌 양수 인 char형 start 변수 선언unsigned char CREDIT=100;//음수가 아닌 양수 인 char형 CREDIT 를 100으로 선언unsigned char BET=0;//음수가 아닌 양수 인 char형 BET 를 0으로 선언unsigned char getpaid;//음수가 아닌 양수 인 char형 getpaid 변수 선언unsigned char info=0;//음수가 아닌 양수 인 char형 info 를 100으로 선언unsigned char state=0;//음수가 아닌 양수 인 char형 state 를 0으로 선언unsigned char LED_Data=0x00;//음수가 아닌 양수 인 char형 LED_Data 선언unsigned char i=0;//음수가 아닌 양수 인 char형 i를 0 으로 선언unsigned int seed =0;//음수가 아닌 양수 인 int 형 seed선언 ,난수를 계산하기 위하여 사용하는 변수unsigned char slots[5][8] = {"BAR", "BELL", "LEMON", "CHERRY", "DIAMOND"};//슬롯안에 들어가는 종류 들의 배열char *Table1, *Table2, *Table3;//각각의 포인터변수 선언, 각 종류들의 주소/*void JACKPOT_LED(void)//jackpot 터졌을때 LED{PORTA=0xFF;for(i=0;i