be based on 51 Eight way responder of single chip microcomputer Proteus Simulation design
Simulation diagram proteus 8.6
Program compiler :keil 4/keil 5
programing language :C language
Knowledge points involved : Key scan , timer , Digital tube , Buzzer .
Sell simulation diagram and source code .
Taking single chip microcomputer as the core , Design a 8 Bit contest Responder : At the same time 8 A player or 8 Three teams play , Separately 8 Buttons S0~S7 express .
Set a system clear and answer control switch S, The switch is controlled by the host .
The responder has the function of latch and display . The player presses the button , Latch the corresponding number , And the number of the first responder is kept until the host clears the system .
The responder has the function of timing responder , And a rush to answer the time set by the host ( as 30 second ).
The answering machine has the function of preventing answering , If there is a player pressing the “ start ” Answer before key , The number of the responder will be displayed , At the same time, the end of the answer .
When the host starts “ start ” After key , The timer counts down , At the same time, the loudspeaker makes a brief sound , The duration of the sound is 0.5s about .
The contestants rush to answer within the set time , The answer is effective , The timer stops working , The number of the contestants and the time of rush answer are displayed on the display , And keep it until the host clears the system .
If the time is up , No answer , This rush answer is invalid , System alarm and no rush answer , Display on timing display 00.
Display function :
/*------------------------------------------------ Display function , Digital tube for dynamic scanning input parameter
FirstBit Indicates the first digit to be displayed , Such as assignment 2 Indicates that the display starts from the third nixie tube If input 0 Indicates that from the first display .
Num Indicates the number of digits to be displayed , Display if necessary 99 Two digit values are entered 2
------------------------------------------------*/ void Display(unsigned char
FirstBit,unsigned char Num) { unsigned char i; for(i=0;i<Num;i++) { DataPort=0;
// wipe data , Prevent alternate ghosting DUAN=1; // Segment lock DUAN=0; DataPort=dofly_WeiMa[i+FirstBit]; // Location code
WEI=1; // Bit latch WEI=0; DataPort=TempData[i]; // Access display data , Segment code DUAN=1; // Segment lock DUAN=0;
DelayMs(2); // Scanning gap delay , Too long will flash , Too short can cause double shadows } }
Interrupt handling
void restart() interrupt 0// Key interrupt handling function A new round { m = 0; num = 0; TR0 = 0; flag = 0;
time= 20; TempData[0] = 0; TempData[1] = 0; TempData[2] = 0; TempData[3] = 0; }
Need source code and simulation can be private chat QQ2142686503
Technology