Vous êtes sur la page 1sur 39

Electronic Voting Machine

BJP=5 BSP=7 NDA=8 CONGRESS=6 JD=9

UP

Reset Switch

EN T DW N

Buzzer

12V AC Input from Transformer

Microcontroller Based Electronic Voting Machine


Description
Microcontroller Based Electronic Voting Machine is design for five contenders. To prevent unauthorised ccess of this machine a system password is provided Without entering te password the machine will not start. Further you can chage the password as per your desire the lenght of password if 4 digit.

Enter 0 Password
Let Password is 1234, press up button and release display shows

Enter 1 Password
Press Entre button display shows(You have entered first digit of password) and display shows second digit as 0

Enter 10 Password
press up button and release two times display shows

Enter 12 Password
Press Entre button display shows(You have entered seconf digit of password) and display shows third digit as 0

Enter 120 Password

press up button and release display shows until display shows

Enter 123 Password


Press Entre button display shows(You have entered third digit of password) and display shows fourth digit as 0

Enter 1230 Password


press up button and release until display shows

Enter 1234 Password


Press Entre button display shows if password is correct LCD shows with a pass buzzer sound

Password Proceed Correct


If password is wrong LCD shows with a fail buzzer sound

Password Fails
If password is wrong LCD shows

Enter Password

If passwod is correct LCD shows

Do you want to Change Password

Followed by

Press UP for Yes ENTER/DWN for NO


IF UP button is pressed

New 0 Password
Feed 4 digit password one by one with the help of UP and ENTER button

Enter code for voting BJP=05 BSP=07 NDA=08 CONGRESS=06 JP=09 Press UP button to vote the desired candidate or press ENTER button to see the total votes let us press
Enter button

Reading Votes BJP XXXXX Press ENTER button to see next total for CONGRESS Reading Votes CONGRESS XXXXX
Press ENTER button to see next total for BSP

Press ENTER button to see next total for BSP

Reading Votes BSP XXXXX


Press ENTER button to see next total for NDA

Reading Votes NDA XXXXX


Press ENTER button to see next total for JP

Reading Votes JP XXXXX Want to Erase Data Press UP for ENTER/DWN for Yes NO
Press UP button to erase votes store

Enter 0 Password
Use UP and Enter button to feed the password

Enter 0 Password
If feeded password is correct the all votes will erased otherwise data remains preserved

Working of EVM is very straight forward During initiallization it initiallize LCD to work in 8 bit mode. The ask user for password , it continously check port pin 15,16 and 17 to reterive the password after getting four digit it check the password with its value if it is correct then it proceed to next step other wise it ask for password again with a buzzer sound. If password was correct it ask you to change the password? If you want then it will change it otherwise you can proceed to voting mode. In voting mode there are five contender shown on 16X2 LCD display. For voting them you nedd to enter the appropriate code to vote them further you can see the total vote for each contender as well as vote reset option with the same passwod. Data stored is in flash memeory since PIC microcontroller has the ability to write its owm flash program memeory. Evet\ry thing is in code.

LCD
LCDs can add a lot to your application in terms of providing a useful interface for the user, debugging an application, or just giving it a professional look. The most common type of LCD controller is the Hitachi 44780, which provides a relatively simple interface between a processor and an LCD. Using this interface is often not attempted by new designers and programmers because it is difficult to find good documentation on the interface, initializing the interface can be a problem, and the displays themselves are expensive. I have worked with Hitachi 44780-based LCDs for a while now and I don't believe any of these perceptions. LCDs can be added quite easily to an application and use as few as two digital output pins for control. As for cost, LCDs can be often pulled out of old devices or found in surplus stores for less than a dollar. The purpose of this section is to give a brief tutorial on how to interface with Hitachi

Table 1 2 3 4 5 6 7-14 15 16

Ground Vcc Contrast Rs RW En D0-D14 VA VK

Set c u r s o r move d i r e c t i o n : ID I n c r e m e n t t h e c u r s o r a f t e each b y t e w r i t t e n t o d i s p l a y i f s r et S S h i f t d i s p l a y when b y t e w r i t t ntodisplay e Enable d i s p l a y l c u r s o r D Turn d i s p l a y o n ( l ) / o f f C Turn (O) c u r s o r o n ( l ) I o f f BC ( O )u r s o r b l i n k o n ( l ) / o f f Move (O) cursorlshiftdisplay SC D i s p l a y s h i f t o n ( l ) / o f f RL ) (ODirectionofshiftright(l)l eft(O) l Set i n t e r f a c e l e n g t h DL Set d a t a i n t e r f a c e l e n g t h 8 1 ( )/4(0) N Number o f d i s p l a y l i n e s 1 2(1 ( 0 ) /) FCharacterfont5x10(1)/5 7 ~(0) P o l l t h e busy f l a g BF T h i s b i t i s s e t w h i l e t h e LCD s i processing Move c u r s o r t o CGRAMldisplay A Address R e a d l w r i t e ASCII t o t h e d i s p l y a H Data

44780-based LCDs. I have tried to provide all of the data necessary for successfully adding LCDs to your application. In the book, I use Hitachi 44780-based LCDs for a number of different projects. The most common connector used for the 44780-based LCDs is 14 pins in a row, with pin centers 0.100" apart. The pins are wired as in Table. As you would probably guess from this description, the interface is a parallel bus, allowing simple and fast

15 VA LC D

VC 16

D7D6D5D3 1 4 1 2 13 6 5 4 3 2 1 11

D 4 D 2 D 1 D 0 R/ W 1 4 1 2 131 1

E n V C C V SS S R

VLC

2k

. 1 uf

11
40 39 3 8 3 53 7 3633 3 4 28 29 2 7

32

2.2k 1

RST

22pf

13

PIC16f8777A

14 22pf 12 31

15 16 17

2.2k 2.2k 2.2k

UP

ENT DWN

TXFR1 7805

D2
230 V A. C. 1N4 007 X4

D1

12 .1uf .1uf

D3 D4

TXFR2 Fig. 3 : Circuit diagram of Microcontroller Based Electronic Voting Machine

1. Wait more t h a n 15 ms a f t e r power isapplied. 2. W r i t e 0x030 t o LCD and w a i t ms 5 fortheinstructiontocom lete. p 3 . W r i t e 0x030 t o LCD and w a i t usecs f o r i n s t r u c t i o n t o c o m p l 160 ete. 4. W r i t e 0x030 A G A I N t o LCD wa and i t 160 usecs o r P o l l t h e Busy F a l g. 5 . Set t h e O p e r a t i n g C h a r a c t r ei s t i c s o f t h e LCD.r i t e "Set I n t e r f a c e - W -Writ Length" e 0x010 t o p r e v e n t s h i f t i n gaftercharacterwrit -. e W r i t e 0x001 t o C l e a r t h e D i s p a l y - W r i t e "Set C u r s o r Move D i r e c t i n"SettingCursorBehavio o B r its - W r i t e "Enable D i s p l a y l C u r s o " r & e n a b l e D i s p l a y and O p t i o a nlCursor reading/writing of data to and from the LCD. Write an ASCII byte out to the LCD's screen. The ASCII code to be displayed is eight bits long and is sent to the LCD either four or eight bits at a time. If four-bit mode is used, two nybbles of data (sent high four bits and then low four bits with an E clock pulse with each nybble) are sent to make up a full eight-bit transfer. The E clock is used to initiate the data transfer within the LCD. Sending parallel data as either four or eight bits are the two primary modes of operation. Although there are secondary considerations and modes, deciding how to send the data to the LCD is the most crucial decision to be made for an LCD interface application. Eight-bit mode is best used when speed is required in an application and 10 110 pins are available. Four-bit mode requires six bits. To wire a microcontroller to

an LCD in four-bit mode, just the top four bits (DB4-7) are written to. The RJS bit is used to select whether data or an instruction is being transferred between the microcontroller and the LCD. If the bit is set, then the byte at the current LCD cursor position can be read or written. When the bit is reset, either an instruction is being sent to the LCD or the execution status of the last instruction is read back (whether or not it has completed). The bit descriptions for the different commands are: Reading data back is best used in applications that require data to be moved back and forth on the LCD (such as in applications that scroll data between lines). The busy flag can be polled to determine when the last instruction that has been sent has completed processing. For most applications, there really is no reason to read from the LCD. I usually tie RIW to ground and just wait the maximum amount of time for each instruction (4.1 ms for clearing the display or moving the cursor/display to the home position, 160 ps for all other commands). As well as making my application software simpler, it also frees up a microcontroller pin for other uses. Different LCDs execute instructions at different rates and to avoid problems later on (such as if the LCD is changed to a slower unit), I recommend just using the maximum delays listed here. In terms of options, I have never seen a 5x10 pixel character LCD display. This means that the F bit in the set interface instruction should always be reset (equal to 0). Before you can send commands or data to the LCD module, the module must be initialized. For eight-bit mode, this is done using the following series of operations

Microcontrller
Generally PIC architecture increases in complexity and power, so does the size, intricacy, and cost of the devices. For many purposes an 80-pin PIC with 64Kbytes of program memory, 1K EERPOM, 70 I/O ports, 16 A/D

Program Address

Data Address

Program Memory Space


Instruction Bus

PIC CPU
Data Bus

Data Memory

channels, is more complex than necessary. In fact, some high-end PICs appear to be closer to microprocessors than to microcontrollers. Furthermore, the programming complexity of these high-end PICs is also much greater than their mid-range counterparts because their instruction set has double the number of instructions and the assembly language itself is more difficult to learn and follow. Finally, the circuits in which we typically find the high-end devices are more advanced and elaborate and their design requires greater engineering skills. For these reasons, and for the natural space limitations of a single volume, we do not discuss the high-performance family or 8-bit PICs nor any of the 16-bit products. It can be argued that the baseline PICs do find extensive use and are quite practical for many applications. Although this is true, the baseline PICs are quite similar in architecture and programming to their mid-range relatives. In most cases the difference between a baseline and mid-range device is that the low-end one lacks some features or has less program space or storage. So someone familiar with the mid-range devices can easily port their knowledge to any of the simpler baseline Products. Our conclusion has been to limit the coverage to the mid-range family of PICs. Within this family we have concentrated our attention on the two most used, documented, and popular PICs: the 16F84 (also 16F84A) and the 16F877A. The F84 sets the lower limit of complexity and sophistications and the F877 the higher limit. Processor Architecture and Design PIC microcontrollers are unique in many ways.We start by mentioning several general characteristics of the PIC: Harvard architecture, RISC processor design, single-word instructions, machine and data memory configuration, and characteristic instruction Formats. Harvard Architecture The PIC microcontrollers do not use the conventional von Neumann architecture but a different hardware design often referred to as Harvard architecture. Originally, Harvard architecture referred to a computer design in which data and instruction used different signal paths and storage areas. In other words, data and instructions are not located in the same memory area but in separate ones. One consequence of the traditional von Neumann architecture is that the processor can either read or write instructions or data but cannot do both at the same time, since both instructions and data use the same signal lines. In a machine with a Harvard architecture, on the other hand, the processor can read and write instructions and data to and from memory at the same time. This results in a faster, albeit more The most recent arguments in favor of the Harvard architecture are based on the access speed to main memory. Making a CPU faster while memory accesses remain at the same speed represents little total gain, especially if many memory accesses

are required. This situation is often referred to as the von Neumann bottleneck and machines that suffer from it are said to be memory bound.complex, machine. Several generations of microcontrollers, including the Microchip PICs, have been based on the Harvard architecture. These processors have separate storage for program and data and a reduced instruction set. The midrange PICs, in particular, have 8-bit data words but either 12-, 14, or 16-bit program instructions. Since the instruction size is much wider than the data size, an instruction can contain a full-size data Constant. RISC CPU Design (Complete Instruction Set Computer) design is The CISC based on each low-level instruction performing several operations. For example, one Intel 80x86 opcode can decrement a counter register, determine the state of a processor flag, and execute a jump instruction if the flag is set or cleared. Another CISC instruction moves a number of bytes of data contained in a counter register from an area pointed at by a source register, into another area pointed at by a destination register. Any popular Intel CISC CPU contains about 120 primitive operations in its instruction set. The original design idea of the CISC architecture was to provide high-level instructions in order to facilitate the implementation of highlevel languages. Supposedly, this would be achieved through complex instruction sets, multiple addressing modes, and primitive operations that performed multiple functions. However, some argued that the CISC architecture did not result in better performance. Furthermore, the more complex the instruction set resulted in greater decoding time. At the same time, implementing large instruction sets required more silicon space and considerably more design effort. Some CISC processors developed in the 1960s and 70s are the IBM System/360, the PDP-11, the Motorola 68000 family, and Intel 80x86 CPUs. In contrast, a RISC (Reduced Instruction Set Computer) machine contains fewer instructions and each instruction performs more elementary operations. Consequences of this are a smaller silicon area, faster execution, and reduced program size with fewer accesses to main memory. The PIC designers have followed the RISC route. Other CPUs with design RISC are the MIPS, the IBM Power PC, and the Alpha. DEC Single-word Instructions One of the consequences of the PICs Harvard architecture is that the instructions can be wider than the 8-bit data size. Since the device has separate buses for instructions and data, it is possible for instructions to be sized differently than data items. Being able to vary the number of bits in each instruction opcode makes possible the optimization of program memory and the use of singleword instructions that can be fetched in one bus cycle. In the mid-range PICs each instruction is 14-bits wide and every fetch operation brings into the execution unit one

complete operation code. Since each instruction takes up one 14-bit word, the number of words of program memory in a device exactly equals the number of program instructions that can be stored. In a von Neumann machine, instruction storage and fetching becomes a much more complicated issue. Since von Neumann instructions can span multiple bytes, there is no assurance that each program memory location contains the first opcode of a multi-byte instruction. As in conventional processors, the PIC architecture has a two-stage instruction pipeline; however, since the fetch of the current instruction and the execution of the previous one can overlap in time, one complete instruction is fetched and executed at every machine cycle. This is known as instruction pipelining. Since each instruction is 14-bits wide and the program memory bus is also 14-bits wide, each instruction contains all the necessary information, so it can be executed without any additional fetching. The one exception is when an instruction modifies the contents of the Program Counter. In this case, a new instruction must be fetched, requiring an additional machine cycle. The PIC clocking system is designed so that an instruction is fetched, decoded, and executed every four clock cycles. In this manner, a PIC equipped with a 4MHz oscillator clock beats at a rate of 0.25 s. Since each instruction executes at every four clock cycles, each instruction takes 1 s.. Oscillator Mid-range PICs require an external device to produce the clock cycles required for its operation. The PIC executes an instruction every four clock cycles, so the oscillator speed determines the device performance.

Mid-range PICs support up to eight different oscillator modes. For example, in the 16F877, any of the eight modes can be used, while in the 16F84 only four oscillator modes are available. The oscillator mode is selected at device programming time and cannot be changed at runtime. The configuration bits, which are non-volatile flags set during device programming, determine which oscillator mode is used by the program, among the following: 1. LP Low Frequency Crystal 2. XT Crystal Resonator 3. HS High Speed Crystal Resonator 4. RC External Resistor/Capacitor 5. EXTRC External Resistor/Capacitor 6. EXTRC External Resistor/Capacitor with 7. INTRC CLKOUT Internal 4 MHz Resistor/Capacitor 8. INTRC Internal 4 MHz Resistor/Capacitor with The resistor/capacitor oscillator option is the least CLKOUT expensive to implement, but also the least accurate one. This option is used only in systems where clock accuracy and consistency are not issues. The low-power frequency crystal option is the one with lowest power consumption and can be used in systems where the power consumption element is important. The first three oscillator modes (LP, XT, and HS) allow selecting different frequency ranges. The HS option has the highest frequency range and consumes the most power. The XT option is based on a standard crystal resonator and has a mid-range power consumption. The LP option has low gain and consumes the least power of the three crystal modes. The general rule is to use the oscillator with the lowest possible gain that still meets the circuit require ments. The RC mode with EXTRC and CLKOUT features has the same functionality as the straight RC oscillator Option. The XT option (crystal resonator) can be purchased in a ceramic package. This device, called a ceramic resonator, contains three pins. The ones on the extremes are connected to the corresponding oscillator input lines on the PIC, labeled OSC1 and The reset OSC2. mechanism places the PIC in a known condition. The reset mechanism is used to gain control of a runaway or hung-up program, as a forced interrupt in program execution, or to make the device ready at program load time. The processors !MCLR pin produces the reset action when it reads logic zero. The exclamation sign preceding

the pins name (or a line over it) indicates that the action is active-low. To prevent accidental resets the !MCLR pin must be connected to the positive voltage supply through a 5K or 10K resistor. When a resistor serves to place a logic one on a line it is called a pull-up resistor. The mid-range PICs are capable of several reset actions: 1. Reset during power on (POR). 2. !MCLR reset during normal operation. 3. Reset during SLEEP 4. Watchdog timer reset (WDT). mode. 5. Brown-out reset (BOR). 6. Parity error reset. The first two reset sources in the preceding list are the most common. POR reset serves to bring all PIC registers to an initial state, including the program counter register. The second source of reset action takes place when the !MCLR line is intentionally brought down, usually by the action of a push-button reset switch. This switch is useful during program development since it provides a way of forcefully restarting execution. Figure shows a typical wiring of the !MCLR line to provide a reset action The second one is a product of purposefully bringing-in a logical zero to the MCLR pin during normal operation of the microcontroller. This second one is often used in program development. User RAM memory is not affected by a reset. The GPRs (general purpose register) are in an unknown state during power-up and are not changed by reset. SFR registers, on the other hand, are reset to an initial state. The initialization conditions for each of the SFRs are found in the device data sheet. The most important of these is the program count (PC) which is reset to zero. This action directs execution to the first instruction and effectively restarts the program. During power-up the processor itself initiates a reset and the power supply voltage increases from 1.2 to 1.8V. Several bits in various registers are related to the reset action, but these are not available in all mid-range devices. For example, some high-end devices in the mid-range group, such as the 16F87x, contain two resetrelated bits in the PCON register. One of them (named !POR) determines the power-on reset status...

Start

Initialization Process (I/O port setting Option Register setting LCD Initiallization Time out Flag setting

Pressed Digit3 No

Yes Display LCD Enter Password

Pressed Digit4 No Pressed Digit1 No Yes

Yes

Read Stored Password

Pressed Digit2 No Password Matched

Yes

No

Yes Step2

Step2

Step3 No

Change Password

Yes

No

Pressed New Passwoword Digit1

No

Pressed New Passwoword Digit3

Yes

Yes

No

Pressed New Passwoword Digit2

No

Pressed New Passwoword Digit4

Yes

Yes

Step3

Display Election Party Names

No

Want to Vote? Press UP

Want to See Total Vote? Press ENT/UP

No

Yes Step4 Step5

Yes

Step5

Display Total Votes of Contender1

Display Total Votes of Contender3

IS Dwn Button Pressed No

IS Dwn Button Pressed No

Yes Display Total Votes of Contender2

Yes Display Total Votes of Contender4

IS Dwn Button Pressed No

IS Dwn Button Pressed No

Yes

Yes

Step6

Step6

Want to erase Votes

No

IS Dwn Button Pressed

No

IS Dwn Button Pressed

Yes

Yes

Goto Step3

Earse &Goto Step3

Step4

Count=5 No No IS Dwn UP Button Yes Count=6

Yes

Vote To Contender1

No

Increment Count Yes

Vote To Contender2

No

Count=8

Yes Count=7

Vote To Contender4

No

Count=9

No

Yes

Vote To Contender3 Yes

Vote To Contender5

Step 3

#include<pic.h> #define bitset(var,bitno) ((var) |=(1 << (bitno))) #define bitclr(var,bitno) ((var) &=~(1 << (bitno))) void Electronicvotingmacine22(unsigned int h ); void Electronicvotingmacine24(void); void Electronicvotingmacine23(void); void Electronicvotingmacine1(unsigned int); void Electronicvotingmacine2(unsigned char *); void Electronicvotingmacine21(void); void Electronicvotingmacine7(unsigned short); void Electronicvotingmacine3(unsigned long); void Electronicvotingmacine4(unsigned short); void Electronicvotingmacine5(unsigned short); void Electronicvotingmacine6(unsigned short); unsigned char Electronicvotingmacine9(void); unsigned char Electronicvotingmacine8(unsigned char); void Electronicvotingmacine10(void); void Electronicvotingmacine11(void); unsigned int Electronicvotingmacine12(unsigned char, unsigned char); void Electronicvotingmacine13(void); void Electronicvotingmacine14(void); void Electronicvotingmacine15(void); void Electronicvotingmacine16(void); void Electronicvotingmacine17(void); void Electronicvotingmacine18(void); void Electronicvotingmacine19(void); void Electronicvotingmacine20(void); void main() { unsigned char i,vote,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a1 5,a16; unsigned char Electronicvotingmacine131,Electronicvotingmacine132,Ele ctronicvotingmacine141,Electronicvotingmacine142,Electro nicvotingmacine151,Electronicvotingmacine152,Electronic votingmacine161,Electronicvotingmacine162,Electronicvoti ngmacine171,Electronicvotingmacine172; unsigned char oldpassword,kl1,kl2,kl3,kl4,rd1,rd2,rd3,rd4,highcount,lowc ount; unsigned int finalcount; ADCON1=0x86; INTCON=0 TRISB=0x00; ; TRISC=0x07; TRISD=0x00; RD4=0; RD5=0; RD6=0; RD7=0; Electronicvotingmacine1(0x38); Electronicvotingmacine1(0x0C); Electronicvotingmacine1(0x06); Electronicvotingmacine1(0x01); Electronicvotingmacine1(0x80); startagain: RD7=0;

Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x4e); Electronicvotingmacine4(0x54); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0xA0); rd1=EEPROM_READ(0) Electronicvotingmacine22(100); ; rd2=EEPROM_READ(1) Electronicvotingmacine22(100); ; rd3=EEPROM_READ(2) Electronicvotingmacine22(100); ; rd4=EEPROM_READ(3) Electronicvotingmacine22(100); ; rd1=rd1%10; rd2=rd2%10; rd3=rd3%10; rd4=rd4%10; Electronicvotingmacine4(0x50); Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x57); Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x44); kl1=Electronicvotingmacine8(0); kl2=Electronicvotingmacine8(1); kl3=Electronicvotingmacine8(2); kl4=Electronicvotingmacine8(3); if(kl1==rd1) { Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x50); Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x57); Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x44); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x43); Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x43); Electronicvotingmacine4(0x54); Electronicvotingmacine1(0XC0); Electronicvotingmacine4(0x50); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0x43); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x44); for(i=0;i<20;i++){RD7=1;Electronicvotingmacine22(100);R D7=0;Electronicvotingmacine22(100);} Electronicvotingmacine1(0x01);

Electronicvotingmacine4(0x44); Electronicvotingmacine4(0x4f); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x59); Electronicvotingmacine4(0x4f); Electronicvotingmacine4(0x55); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x57); Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x4e); Electronicvotingmacine4(0x54); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x54); Electronicvotingmacine4(0x4f); Electronicvotingmacine1(0xc0); Electronicvotingmacine4(0x43); Electronicvotingmacine4(0x48); Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x4E); Electronicvotingmacine4(0x47); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x50); Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x57); Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x44); Electronicvotingmacine4(0xa0); Electronicvotingmacine22(2000); Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x50); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x55); Electronicvotingmacine4(0x50); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x46); Electronicvotingmacine4(0x4f); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x59); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x53); Electronicvotingmacine1(0xc0); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x4e); Electronicvotingmacine4(0x54); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x2f); Electronicvotingmacine4(0x44); Electronicvotingmacine4(0x57); Electronicvotingmacine4(0x4e); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x46);

Electronicvotingmacine4(0x4f); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x4e); Electronicvotingmacine4(0x4f); while(1){ if(RC0==0){Electronicvotingmacine19();Electronicvotingma cine10();break;} else if(RC1==0){Electronicvotingmacine19();break;} else if(RC2==0){Electronicvotingmacine19();break;} } } else { Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x50); Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x57); Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x44); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x46); Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x49); Electronicvotingmacine4(0x4C); Electronicvotingmacine4(0x53); RD7=1; Electronicvotingmacine22(4000); goto startagain; } while(1) { whileloop: Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x4e); Electronicvotingmacine4(0x54); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x43); Electronicvotingmacine4(0x4f); Electronicvotingmacine4(0x44); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x46); Electronicvotingmacine4(0x4f); Electronicvotingmacine4(0x52); Electronicvotingmacine1(0xc0); Electronicvotingmacine4(0x56); Electronicvotingmacine4(0x4f); Electronicvotingmacine4(0x54); Electronicvotingmacine4(0x49); Electronicvotingmacine4(0x4e);

Electronicvotingmacine4(0x47); Electronicvotingmacine22(1000); } for(;;) { Electronicvotingmacine11(); if(RC0==0) { Electronicvotingmacine19(); Electronicvotingmacine1(0x01); vote=Electronicvotingmacine8(0); if(vote==5) { RD7=1; Electronicvotingmacine13(); Electronicvotingmacine22(5000); RD7=0; } else if(vote==6) { RD7=1; Electronicvotingmacine14(); Electronicvotingmacine22(5000); RD7=0; } else if(vote==7) { RD7=1; Electronicvotingmacine15(); Electronicvotingmacine22(5000); RD7=0; } else if(vote==8) { RD7=1; Electronicvotingmacine16(); Electronicvotingmacine22(5000); RD7=0; } else if(vote==9) { RD7=1; Electronicvotingmacine17(); Electronicvotingmacine22(5000); RD7=0; } } if(RC1==0) { Electronicvotingmacine19(); Electronicvotingmacine18(); goto whileloop; } } void Electronicvotingmacine19(void) { unsigned char i; for(i=0;i<2;i++) { RD7=1; Electronicvotingmacine22(25); RD7=0; Electronicvotingmacine22(25); }//end of for(i=0;i<5;i++) }

unsigned char Electronicvotingmacine8(unsigned char sd) { unsigned char a,xx,i; a=0; while(1) { Electronicvotingmacine1((0xC0+sd)); Electronicvotingmacine5(a); } return(xx); } void Electronicvotingmacine10(void) { unsigned char newpassword1,newpassword2,newpassword3,newpasswo rd4; unsigned char fg1,fg2,fg3,fg4; Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x4E); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x57); Electronicvotingmacine4(0xA0); Electronicvotingmacine4(0x50); Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x57); Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x44);

newpassword1=Electronicvotingmacine8(0); newpassword2=Electronicvotingmacine8(1); newpassword3=Electronicvotingmacine8(2); newpassword4=Electronicvotingmacine8(3); EEPROM_WRITE(0,newpassword1) E ; lectronicvotingmacine22(100); EEPROM_WRITE(1,newpassword2) E ; lectronicvotingmacine22(100); EEPROM_WRITE(2,newpassword3) ;

Electronicvotingmacine22(100); EEPROM_WRITE(3,newpassword4) Electronicvotingmacine22(100); ; fg1=EEPROM_READ(0) Electronicvotingmacine22(100); ; fg2=EEPROM_READ(1) Electronicvotingmacine22(100); ; fg3=EEPROM_READ(2) ; Electronicvotingmacine22(100); fg4=EEPROM_READ(3) Electronicvotingmacine22(100); ; fg1=fg1%10; fg2=fg2%10; fg3=fg3%10; fg4=fg4%10; Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x50); Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x57); Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x44); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x49); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0xa0); Electronicvotingmacine5(fg1); Electronicvotingmacine5(fg2); Electronicvotingmacine5(fg3); Electronicvotingmacine5(fg4); Electronicvotingmacine22(2000); } unsigned char Electronicvotingmacine9(void) { unsigned char a,xx; a=0; while(1) { Electronicvotingmacine1(0xC0); Electronicvotingmacine7(a); } return(xx); } void Electronicvotingmacine11(void) { Electronicvotingmacine1(0x80); Electronicvotingmacine4(0x42);// Electronicvotingmacine4(0x4a);// Electronicvotingmacine4(0x50);// Electronicvotingmacine4(0x3d);// Electronicvotingmacine4(0x35);//

Electronicvotingmacine4(0xA0);// Electronicvotingmacine4(0x43);// Electronicvotingmacine4(0x4f);// Electronicvotingmacine4(0x4e);// Electronicvotingmacine4(0x47);// Electronicvotingmacine4(0x52);// Electronicvotingmacine4(0x45);// Electronicvotingmacine4(0x53);// Electronicvotingmacine4(0x53);// Electronicvotingmacine4(0x3d);// Electronicvotingmacine4(0x36);// Electronicvotingmacine1(0xc0); Electronicvotingmacine4(0x42);// Electronicvotingmacine4(0x53);// Electronicvotingmacine4(0x50);// Electronicvotingmacine4(0x3d);// Electronicvotingmacine4(0x37);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x4e);// Electronicvotingmacine4(0x44);// Electronicvotingmacine4(0x41);// Electronicvotingmacine4(0x3d);// Electronicvotingmacine4(0x38);// Electronicvotingmacine4(0xA0);// Electronicvotingmacine4(0x4a);// Electronicvotingmacine4(0x44);// Electronicvotingmacine4(0x3d);// Electronicvotingmacine4(0x39);// } unsigned int Electronicvotingmacine12(unsigned char timerhigh, unsigned char timerlow) { unsigned int total,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15 ,a16; if(timerhigh & 0x80){a16=32768;}else{a16=0;} if(timerhigh & 0x40){a15=16384;}else{a15=0;} if(timerhigh & 0x20){a14=8192;}else{a14=0;} if(timerhigh & 0x10){a13=4096;}else{a13=0;} if(timerhigh & 0x08){a12=2048;}else{a12=0;} if(timerhigh & 0x04){a11=1024;}else{a11=0;} if(timerhigh & 0x02){a10=512;}else{a10=0;} if(timerhigh & 0x01){a9=256;}else{a9=0;} if(timerlow & 0x80){a8=128;}else{a8=0;} if(timerlow & 0x40){a7=64;}else{a7=0;} if(timerlow & 0x20){a6=32;}else{a6=0;} if(timerlow & 0x10){a5=16;}else{a5=0;} if(timerlow & 0x08){a4=8;}else{a4=0;} if(timerlow & 0x04){a3=4;}else{a3=0;} if(timerlow & 0x02){a2=2;}else{a2=0;} if(timerlow & 0x01){a1=1;}else{a1=0;} total=a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13 +a14+a15+a16; return(total); } void Electronicvotingmacine3(unsigned long tt)

{ unsigned short ch,v,b,cc=0x2E; ch=ch+48; Electronicvotingmacine4(ch); } void Electronicvotingmacine7(unsigned short tt) { unsigned short ch,v,b,cc=0x2E; ch=ch+48; Electronicvotingmacine4(ch); ch=ch+48; Electronicvotingmacine4(ch); } void Electronicvotingmacine5(unsigned short tt) { unsigned short ch,v,b,cc=0x2E; ch=ch+48; Electronicvotingmacine4(ch); } void Electronicvotingmacine18(void) { unsigned char Electronicvotingmacine131,Electronicvotingmacine132,Ele ctronicvotingmacine141,Electronicvotingmacine142,Electro nicvotingmacine151,Electronicvotingmacine152,Electronic votingmacine161,Electronicvotingmacine162,Electronicvoti ngmacine171,Electronicvotingmacine172; unsigned int Electronicvotingmacine13counter,Electronicvotingmacine1 4counter,Electronicvotingmacine15counter,Electronicvoting macine16counter,Electronicvotingmacine17counter; Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x52);// Electronicvotingmacine4(0x45);// Electronicvotingmacine4(0x41);// Electronicvotingmacine4(0x44);// Electronicvotingmacine4(0x49);// Electronicvotingmacine4(0x4e);// Electronicvotingmacine4(0x47);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x56);// Electronicvotingmacine4(0x4f);// Electronicvotingmacine4(0x54);// Electronicvotingmacine4(0x45);// Electronicvotingmacine4(0x53);// Electronicvotingmacine131=EEPROM_READ(10); Electronicvotingmacine22(100); Electronicvotingmacine132=EEPROM_READ(11); Electronicvotingmacine22(100); Electronicvotingmacine141=EEPROM_READ(12); Electronicvotingmacine22(100); Electronicvotingmacine142=EEPROM_READ(13); Electronicvotingmacine22(100); Electronicvotingmacine151=EEPROM_READ(14);

Electronicvotingmacine22(100); Electronicvotingmacine152=EEPROM_READ(15); Electronicvotingmacine22(100); Electronicvotingmacine161=EEPROM_READ(16); Electronicvotingmacine22(100); Electronicvotingmacine162=EEPROM_READ(17); Electronicvotingmacine22(100); Electronicvotingmacine171=EEPROM_READ(18); Electronicvotingmacine22(100); Electronicvotingmacine172=EEPROM_READ(19); Electronicvotingmacine22(100); Electronicvotingmacine13counter=Electronicvotingmacine1 2(Electronicvotingmacine131,Electronicvotingmacine132); Electronicvotingmacine14counter=Electronicvotingmacine1 2(Electronicvotingmacine141,Electronicvotingmacine142); Electronicvotingmacine15counter=Electronicvotingmacine1 2(Electronicvotingmacine151,Electronicvotingmacine152); Electronicvotingmacine16counter=Electronicvotingmacine1 2(Electronicvotingmacine161,Electronicvotingmacine162); Electronicvotingmacine17counter=Electronicvotingmacine1 2(Electronicvotingmacine171,Electronicvotingmacine172); Electronicvotingmacine1(0xc0); Electronicvotingmacine4(0x42);// Electronicvotingmacine4(0x4a);// Electronicvotingmacine4(0x50);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine3(Electronicvotingmacine13counter ); Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// while(RC2==1); Electronicvotingmacine19(); Electronicvotingmacine1(0xc0); Electronicvotingmacine4(0x43);// Electronicvotingmacine4(0x4f);// Electronicvotingmacine4(0x4e);// Electronicvotingmacine4(0x47);// Electronicvotingmacine4(0x52);// Electronicvotingmacine4(0x45);// Electronicvotingmacine4(0x53);// Electronicvotingmacine4(0x53);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine3(Electronicvotingmacine14counter ); while(RC2==1); Electronicvotingmacine19(); Electronicvotingmacine1(0xc0); Electronicvotingmacine4(0x42);// Electronicvotingmacine4(0x53);//

Electronicvotingmacine4(0x50);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine3(Electronicvotingmacine15counter ); Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// while(RC2==1); Electronicvotingmacine19(); Electronicvotingmacine1(0xc0); Electronicvotingmacine4(0x4e);// Electronicvotingmacine4(0x44);// Electronicvotingmacine4(0x41);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine3(Electronicvotingmacine16counter ); Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// while(RC2==1); Electronicvotingmacine19(); Electronicvotingmacine1(0xc0); Electronicvotingmacine4(0x4a);// Electronicvotingmacine4(0x44);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine3(Electronicvotingmacine17counter ); Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0xa0);// while(RC2==1); Electronicvotingmacine19();

Electronicvotingmacine4(0x52);// Electronicvotingmacine4(0x41);// Electronicvotingmacine4(0x53);// Electronicvotingmacine4(0x45);// Electronicvotingmacine1(0xc0); Electronicvotingmacine4(0x44);// Electronicvotingmacine4(0x41);// Electronicvotingmacine4(0x54);// Electronicvotingmacine4(0x41);// Electronicvotingmacine22(2000); Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x50);// Electronicvotingmacine4(0x52);// Electronicvotingmacine4(0x45);// Electronicvotingmacine4(0x53);// Electronicvotingmacine4(0x53);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x55);// Electronicvotingmacine4(0x50);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x46);// Electronicvotingmacine4(0x4f);// Electronicvotingmacine4(0x52);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x59);// Electronicvotingmacine4(0x45);// Electronicvotingmacine4(0x53);// Electronicvotingmacine1(0xc0); Electronicvotingmacine4(0x45);// Electronicvotingmacine4(0x4e);// Electronicvotingmacine4(0x54);// Electronicvotingmacine4(0x45);// Electronicvotingmacine4(0x52);// Electronicvotingmacine4(0x2f);// Electronicvotingmacine4(0x44);// Electronicvotingmacine4(0x57);// Electronicvotingmacine4(0x4e);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x46);// Electronicvotingmacine4(0x4f);// Electronicvotingmacine4(0x52);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x4e);// Electronicvotingmacine4(0x4f);//

} Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x57);// Electronicvotingmacine4(0x41);// Electronicvotingmacine4(0x4e);// Electronicvotingmacine4(0x54);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x54);// Electronicvotingmacine4(0x4f);// Electronicvotingmacine4(0xa0);// Electronicvotingmacine4(0x45);// void Electronicvotingmacine4(unsigned short k) { unsigned short b,v; unsigned int ii; Electronicvotingmacine21(); PORTB=k RD4=1; ; RD5=0; RD6=1; for(ii=0;ii<100;ii++)Electronicvotingmacine24();

RD6=0; } void Electronicvotingmacine20(void) { unsigned char kl1,kl2,kl3,kl4,rd1,rd2,rd3,rd4,i; Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x4e); Electronicvotingmacine4(0x54); Electronicvotingmacine4(0x45); rd1=EEPROM_READ(0) Electronicvotingmacine22(100); ; rd2=EEPROM_READ(1) ; Electronicvotingmacine22(100); rd3=EEPROM_READ(2) E ; lectronicvotingmacine22(100); rd4=EEPROM_READ(3) Electronicvotingmacine22(100); ; rd1=rd1%10; rd2=rd2%10; rd3=rd3%10; rd4=rd4%10; Electronicvotingmacine4(0x52); Electronicvotingmacine4(0xA0); Electronicvotingmacine4(0x50); Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x57); Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x44); kl1=Electronicvotingmacine8(0); kl2=Electronicvotingmacine8(1); kl3=Electronicvotingmacine8(2); kl4=Electronicvotingmacine8(3); if(kl1==rd1) { Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x50); Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x57); Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x44); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x43); Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x43); Electronicvotingmacine4(0x54); Electronicvotingmacine1(0XC0); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x41);

Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x49); Electronicvotingmacine4(0x4e); Electronicvotingmacine4(0x47); for(i=0;i<20;i++){RD7=1;Electronicvotingmacine22(100);R D7=0;Electronicvotingmacine22(100);} EEPROM_WRITE(10,0) Electronicvotingmacine22(100); ; EEPROM_WRITE(11,0) Electronicvotingmacine22(100); ; EEPROM_WRITE(12,0) Electronicvotingmacine22(100); ; EEPROM_WRITE(13,0) ; Electronicvotingmacine22(100); EEPROM_WRITE(14,0) Electronicvotingmacine22(100); ; EEPROM_WRITE(15,0) Electronicvotingmacine22(100); ; EEPROM_WRITE(16,0) Electronicvotingmacine22(100); ; EEPROM_WRITE(17,0) Electronicvotingmacine22(100); ; EEPROM_WRITE(18,0) Electronicvotingmacine22(100); ; EEPROM_WRITE(19,0) Electronicvotingmacine22(100); ; } else { Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x50); Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x53); Electronicvotingmacine4(0x57); Electronicvotingmacine4(0x4F); Electronicvotingmacine4(0x52); Electronicvotingmacine4(0x44); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x46); Electronicvotingmacine4(0x41); Electronicvotingmacine4(0x49); Electronicvotingmacine4(0x4C); Electronicvotingmacine4(0x53); RD7=1; Electronicvotingmacine22(4000); RD7=0; } } void Electronicvotingmacine1(unsigned int a) { unsigned int i;

unsigned int b; Electronicvotingmacine21(); TRISB=0x00; PORTB=a RD4=0; ; RD5=0; RD6=1; for(i=0;i<100;i++)Electronicvotingmacine24(); RD6=0; } void Electronicvotingmacine13(void) { unsigned char Electronicvotingmacine131,Electronicvotingmacine132,low count,highcount,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12, a13,a14,a15,a16; unsigned int finalcount; Electronicvotingmacine131=EEPROM_READ(10); Electronicvotingmacine22(200); Electronicvotingmacine132=EEPROM_READ(11); Electronicvotingmacine22(200); finalcount=Electronicvotingmacine12(Electronicvotingmaci ne131,Electronicvotingmacine132); if(finalcount<65535){finalcount=finalcount+1;} if(finalcount & 0x8000){a16=128;}else{a16=0;}//1000 0000 0000 0000 if(finalcount & 0x4000){a15=64;}else{a15=0;}//0100 0000 0000 0000 if(finalcount & 0x2000){a14=32;}else{a14=0;}//0010 0000 0000 0000 if(finalcount & 0x1000){a13=16;}else{a13=0;}//0001 0000 0000 0000 if(finalcount & 0x0800){a12=8;}else{a12=0;}//0000 1000 0000 0000 if(finalcount & 0x0400){a11=4;}else{a11=0;}//0000 0100 0000 0000 if(finalcount & 0x0200){a10=2;}else{a10=0;}//0000 0010 0000 0000 if(finalcount & 0x0100){a9=1;}else{a9=0;}//0000 0001 0000 0000 highcount=a16+a15+a14+a13+a12+a11+a10+a9; if(finalcount & 0x0080){a8=128;}else{a8=0;}//0000 0000 1000 0000 if(finalcount & 0x0040){a7=64;}else{a7=0;}//0000 0000 0100 0000 if(finalcount & 0x0020){a6=32;}else{a6=0;}//0000 0000 0010 0000 if(finalcount & 0x0010){a5=16;}else{a5=0;}//0000 0000 0001 0000 if(finalcount & 0x0008){a4=8;}else{a4=0;}//0000 0000 0000 1000 if(finalcount & 0x0004){a3=4;}else{a3=0;}//0000 0000 0000 0100 if(finalcount & 0x0002){a2=2;}else{a2=0;}//0000 0000 0000 0010 if(finalcount & 0x0001){a1=1;}else{a1=0;}//0000 0000 0000 0001 lowcount=a8+a7+a6+a5+a4+a3+a2+a1; EEPROM_WRITE(10,highcount) ;

Electronicvotingmacine22(100); EEPROM_WRITE(11,lowcount) Electronicvotingmacine22(100); ; Electronicvotingmacine1(0x01); Electronicvotingmacine4(0x56); Electronicvotingmacine4(0x4f); Electronicvotingmacine4(0x54); Electronicvotingmacine4(0x45); Electronicvotingmacine4(0x44); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x54); Electronicvotingmacine4(0x4f); Electronicvotingmacine4(0xa0); Electronicvotingmacine4(0x42); Electronicvotingmacine4(0x4a); Electronicvotingmacine4(0x50); Electronicvotingmacine1(0xc0); Electronicvotingmacine6(Electronicvotingmacine131); Electronicvotingmacine4(0xa0); Electronicvotingmacine6(Electronicvotingmacine132); Electronicvotingmacine4(0xa0); Electronicvotingmacine6(highcount); Electronicvotingmacine4(0xa0); Electronicvotingmacine6(lowcount); Electronicvotingmacine4(0xa0); } void Electronicvotingmacine21(void) { unsigned int i; RD4=0; RD5=1; while(RB7) { RD6=0; for(i=0;i<100;i++)Electronicvotingmacine24(); RD6=1; } } void Electronicvotingmacine14(void) { unsigned char Electronicvotingmacine141,Electronicvotingmacine142,low count,highcount,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12, a13,a14,a15,a16; unsigned int finalcount; Electronicvotingmacine141=EEPROM_READ(12); Electronicvotingmacine22(100); Electronicvotingmacine142=EEPROM_READ(13); Electronicvotingmacine22(100); finalcount=Electronicvotingmacine12(Electronicvotingmaci ne141,Electronicvotingmacine142); if(finalcount<65535){finalcount=finalcount+1;} if(finalcount & 0x8000){a16=128;}else{a16=0;}//1000 0000 0000 0000 if(finalcount & 0x4000){a15=64;}else{a15=0;}//0100 0000 0000 0000

if(finalcount & 0x2000){a14=32;}else{a14=0;}//0010 0000 0000 0000 if(finalcount & 0x1000){a13=16;}else{a13=0;}//0001 0000 0000 0000 if(finalcount & 0x0800){a12=8;}else{a12=0;}//0000 1000 0000 0000 if(finalcount & 0x0400){a11=4;}else{a11=0;}//0000 0100 0000 0000 if(finalcount & 0x0200){a10=2;}else{a10=0;}//0000 0010 0000 0000 if(finalcount & 0x0100){a9=1;}else{a9=0;}//0000 0001 0000 0000 highcount=a16+a15+a14+a13+a12+a11+a10+a9; if(finalcount & 0x0080){a8=128;}else{a8=0;}//0000 0000 1000 0000 if(finalcount & 0x0040){a7=64;}else{a7=0;}//0000 0000 0100 0000 if(finalcount & 0x0020){a6=32;}else{a6=0;}//0000 0000 0010 0000 if(finalcount & 0x0010){a5=16;}else{a5=0;}//0000 0000 0001 0000 if(finalcount & 0x0008){a4=8;}else{a4=0;}//0000 0000 0000 1000 if(finalcount & 0x0004){a3=4;}else{a3=0;}//0000 0000 0000 0100 if(finalcount & 0x0002){a2=2;}else{a2=0;}//0000 0000 0000 0010 if(finalcount & 0x0001){a1=1;}else{a1=0;}//0000 0000 0000 0001 lowcount=a8+a7+a6+a5+a4+a3+a2+a1; EEPROM_WRITE(12,highcount) Electronicvotingmacine22(100); ; EEPROM_WRITE(13,lowcount) ; Electronicvotingmacine22(100); Electronicvotingmacine1(0x01); Electronicvotingmacine6(Electronicvotingmacine141); Electronicvotingmacine4(0xa0); Electronicvotingmacine6(Electronicvotingmacine142); Electronicvotingmacine4(0xa0); Electronicvotingmacine6(highcount); Electronicvotingmacine4(0xa0); Electronicvotingmacine6(lowcount); Electronicvotingmacine4(0xa0); } void Electronicvotingmacine15(void) { unsigned char Electronicvotingmacine151,Electronicvotingmacine152,low count,highcount,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12, a13,a14,a15,a16; unsigned int finalcount; Electronicvotingmacine151=EEPROM_READ(14); Electronicvotingmacine22(100); Electronicvotingmacine152=EEPROM_READ(15); Electronicvotingmacine22(100); finalcount=Electronicvotingmacine12(Electronicvotingmaci ne151,Electronicvotingmacine152); if(finalcount<65535){finalcount=finalcount+1;}

if(finalcount & 0x8000){a16=128;}else{a16=0;}//1000 0000 0000 0000 if(finalcount & 0x4000){a15=64;}else{a15=0;}//0100 0000 0000 0000 if(finalcount & 0x2000){a14=32;}else{a14=0;}//0010 0000 0000 0000 if(finalcount & 0x1000){a13=16;}else{a13=0;}//0001 0000 0000 0000 if(finalcount & 0x0800){a12=8;}else{a12=0;}//0000 1000 0000 0000 if(finalcount & 0x0400){a11=4;}else{a11=0;}//0000 0100 0000 0000 if(finalcount & 0x0200){a10=2;}else{a10=0;}//0000 0010 0000 0000 if(finalcount & 0x0100){a9=1;}else{a9=0;}//0000 0001 0000 0000 highcount=a16+a15+a14+a13+a12+a11+a10+a9; if(finalcount & 0x0080){a8=128;}else{a8=0;}//0000 0000 1000 0000 if(finalcount & 0x0040){a7=64;}else{a7=0;}//0000 0000 0100 0000 if(finalcount & 0x0020){a6=32;}else{a6=0;}//0000 0000 0010 0000 if(finalcount & 0x0010){a5=16;}else{a5=0;}//0000 0000 0001 0000 if(finalcount & 0x0008){a4=8;}else{a4=0;}//0000 0000 0000 1000 if(finalcount & 0x0004){a3=4;}else{a3=0;}//0000 0000 0000 0100 if(finalcount & 0x0002){a2=2;}else{a2=0;}//0000 0000 0000 0010 if(finalcount & 0x0001){a1=1;}else{a1=0;}//0000 0000 0000 0001 lowcount=a8+a7+a6+a5+a4+a3+a2+a1; EEPROM_WRITE(14,highcount) E ; lectronicvotingmacine22(100); EEPROM_WRITE(15,lowcount) Electronicvotingmacine22(100); ; Electronicvotingmacine1(0x01); } void Electronicvotingmacine16(void) { unsigned char Electronicvotingmacine161,Electronicvotingmacine162,low count,highcount,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12, a13,a14,a15,a16; unsigned int finalcount; Electronicvotingmacine161=EEPROM_READ(16); Electronicvotingmacine22(100); Electronicvotingmacine162=EEPROM_READ(17); Electronicvotingmacine22(100); finalcount=Electronicvotingmacine12(Electronicvotingmaci ne161,Electronicvotingmacine162); if(finalcount<65535){finalcount=finalcount+1;} if(finalcount & 0x8000){a16=128;}else{a16=0;}//1000 0000 0000 0000 if(finalcount & 0x4000){a15=64;}else{a15=0;}//0100 0000 0000 0000 if(finalcount & 0x2000){a14=32;}else{a14=0;}//0010 0000

0000 0000 if(finalcount & 0x1000){a13=16;}else{a13=0;}//0001 0000 0000 0000 if(finalcount & 0x0800){a12=8;}else{a12=0;}//0000 1000 0000 0000 if(finalcount & 0x0400){a11=4;}else{a11=0;}//0000 0100 0000 0000 if(finalcount & 0x0200){a10=2;}else{a10=0;}//0000 0010 0000 0000 if(finalcount & 0x0100){a9=1;}else{a9=0;}//0000 0001 0000 0000 highcount=a16+a15+a14+a13+a12+a11+a10+a9; if(finalcount & 0x0080){a8=128;}else{a8=0;}//0000 0000 1000 0000 if(finalcount & 0x0040){a7=64;}else{a7=0;}//0000 0000 0100 0000 if(finalcount & 0x0020){a6=32;}else{a6=0;}//0000 0000 0010 0000 if(finalcount & 0x0010){a5=16;}else{a5=0;}//0000 0000 0001 0000 if(finalcount & 0x0008){a4=8;}else{a4=0;}//0000 0000 0000 1000 if(finalcount & 0x0004){a3=4;}else{a3=0;}//0000 0000 0000 0100 if(finalcount & 0x0002){a2=2;}else{a2=0;}//0000 0000 0000 0010 if(finalcount & 0x0001){a1=1;}else{a1=0;}//0000 0000 0000 0001 lowcount=a8+a7+a6+a5+a4+a3+a2+a1; EEPROM_WRITE(16,highcount) E ; lectronicvotingmacine22(100); EEPROM_WRITE(17,lowcount) E ; lectronicvotingmacine22(100); Electronicvotingmacine1(0x01); } void Electronicvotingmacine17(void) { unsigned char Electronicvotingmacine171,Electronicvotingmacine172,low count,highcount,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12, a13,a14,a15,a16; unsigned int finalcount; Electronicvotingmacine171=EEPROM_READ(18); Electronicvotingmacine22(100); Electronicvotingmacine172=EEPROM_READ(19); Electronicvotingmacine22(100); finalcount=Electronicvotingmacine12(Electronicvotingmaci ne171,Electronicvotingmacine172); if(finalcount<65535){finalcount=finalcount+1;} if(finalcount & 0x8000){a16=128;}else{a16=0;}//1000 0000 0000 0000 if(finalcount & 0x4000){a15=64;}else{a15=0;}//0100 0000 0000 0000 if(finalcount & 0x2000){a14=32;}else{a14=0;}//0010 0000 0000 0000 if(finalcount & 0x1000){a13=16;}else{a13=0;}//0001 0000 0000 0000 if(finalcount & 0x0800){a12=8;}else{a12=0;}//0000 1000

0000 0000 if(finalcount & 0x0400){a11=4;}else{a11=0;}//0000 0100 0000 0000 if(finalcount & 0x0200){a10=2;}else{a10=0;}//0000 0010 0000 0000 if(finalcount & 0x0100){a9=1;}else{a9=0;}//0000 0001 0000 0000 highcount=a16+a15+a14+a13+a12+a11+a10+a9; if(finalcount & 0x0080){a8=128;}else{a8=0;}//0000 0000 1000 0000 if(finalcount & 0x0040){a7=64;}else{a7=0;}//0000 0000 0100 0000 if(finalcount & 0x0020){a6=32;}else{a6=0;}//0000 0000 0010 0000 if(finalcount & 0x0010){a5=16;}else{a5=0;}//0000 0000 0001 0000 if(finalcount & 0x0008){a4=8;}else{a4=0;}//0000 0000 0000 1000 if(finalcount & 0x0004){a3=4;}else{a3=0;}//0000 0000 0000 0100 if(finalcount & 0x0002){a2=2;}else{a2=0;}//0000 0000 0000 0010 if(finalcount & 0x0001){a1=1;}else{a1=0;}//0000 0000 0000 0001 lowcount=a8+a7+a6+a5+a4+a3+a2+a1; EEPROM_WRITE(18,highcount) Electronicvotingmacine22(100); ; EEPROM_WRITE(19,lowcount) Electronicvotingmacine22(100); ; } void Electronicvotingmacine22(unsigned int h ) { unsigned int j; for(j=0;j<h*10;j++){Electronicvotingmacine24();Electronicvo tingmacine24();} }

void Electronicvotingmacine23(void) { unsigned int i; for(i=0;i<6000;i++) Electronicvotingmacine24(); } void Electronicvotingmacine24(void) { ; }

Vous aimerez peut-être aussi