Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Intelligent voting machine using sd card with barcode scanner

Status
Not open for further replies.
That is the voter1.txt I am using. I put that voter1.txt in proteus.mmc file. You can see in the image the output I got after reading 10 cnics and comparing it with txt[]
 

voter1.txt file of mine
 

Attachments

  • voter1.txt
    22 bytes · Views: 70

In your voter1.txt there is only 1 cnic. Where are the other cnics? You said that you are changing the value of txt[]. How? Will you assign the barcode data to txt[]?
You have 10 cnics in your voter1.txt and you don't have to use cnics[] array. You can directly write all the 10 cnics to cnics_array[10][16] and compare the cnics with txt[].

Still better is reading each cnic and writing it to cnic[] array and compare it with txt[].
 
the right one
 

Attachments

  • voter1.txt
    643 bytes · Views: 68

What do you want to do with the data in the voter1.txt? What do you want to read? Do you just want to read the 10 cnic's?
 
it is creating problem because i have to keep data other than cnics also

- - - Updated - - -

yes this is what i want to do

- - - Updated - - -

now how can i read all 10 cnics from the file and then save them in array so that they can be compared
 

Read the array till you get ' ' character then skip till you get '\n'. So, after reading the first cnic the other data in that line is skipped till it encounters '\n'.
Then start reading again till you get another ' ' (space character) and again skip till you get '\n'. The same continues.
You can load the read data to a 1d array and compare it with txt[] each time the data is read or you can store all the 10 cnics in a 2d array and then compare it with txt[]. What happened to barcode scanner?

Here is the new proteus2.mmc with the voter1.txt you sent inside. Rename proteus2.mmc.rar to proteus2.mmc
 

Attachments

  • proteus2.mmc.rar
    283 KB · Views: 75
Last edited:

    V

    Points: 2
    Helpful Answer Positive Rating
i did the same work as you described earlier but now the problem comes with comparing.i attached the files

- - - Updated - - -

i attached the files plz check
 

Attachments

  • final final.rar
    269.4 KB · Views: 67

I will check your file after 2 hours.

Check this simulation with proteus2.mmc

In you code there is a statement
Code:
 while(character!='*')
i.e., you are trying to find '*' character in the file which is not present. So your code will be just looping in this
Code:
 while(character!='*') { }
block. It never comes out.
 

Attachments

  • sim ss 11.jpg
    sim ss 11.jpg
    383.6 KB · Views: 81
  • sobia sarwar v11.rar
    164 KB · Views: 69
Last edited:

    V

    Points: 2
    Helpful Answer Positive Rating
i downloaded again winhex 8.15. how can i create image of my voter1.txt file by winhex
 

There is no WinHex 8.5. Current version of WinHex is WinHex 16.7

I think you are referring to WinImage Pro 8.5 which is current version.

Run WinImage Pro 8.5 and choose File>New
In the Format Selection dialog box select option "Select custom image format" in the Imported Section and ckick OK.
In the next dialog box i.e., Edit Fat Image size dialog select FAT12/16 for File system and click OK.
Save As dislog box appears, save your file with some name and .IMA extension
Then Select menu Image>Inject...
Inject dialog box appears. Select the file to be injected and click Open.
It will ask "Do you want to Inject x file(s).........
Click Yes and save your file by clicking save button.
Close WinImage and go to the file created. If your file is filename.IMA rename it to filename.mmc
That's it.
 
Last edited:
sobia sarwar v11.rar
it is working the way i wanted but can you plaese tall me that whenever any of the cnic matches how can i display msg on glcd
"you can vote"
and also how can i apply a check on cnics that if once cnic got macthed and vote is casted then again vote cannot be casted on same cnic again..........
 

Here are the files. I have to modify the code to apply a check on cnics.

You can use another 2D array like matched_cnic[10][16] and store the matched cnics in it. Every time after comparing the tmp2[] with txt[], it will tell matched or not matched. If matched store it in the matched_cnic[][] array. In the next round compare the cnic being read with the cnics stored in the matched_cnics[][] array. If you find any match then skip the whole process and start a new reading of cnic and comparing.

Why are you reading the cnic into cnic[] first and then copying cnic[] to cnics_array[][] and then copying each row of cnics_array[][] to tmp2[] and then comparing it with txt[]? Can't you just read the 10 cnics into cnics_array[][] and then compare each row with txt[] and if any cnic is matched then store that cnic in another array called matched_cnics[][] and displaying the appropriate messages about cnic matching or not. You can use the matched_cnics[][] to compare it with cnics from cnics_array[][] and if they match you can give a message "cnic already used".

Each row of cnics_array[][] has to be matched with all the rows of matched_cnics[][] or until a match is obtained.


I tried to write the code for checking cnic already used or not. I am getting "Not enough RAM" messages. So, you have to change your PIC18F and get another which has more RAM. Can you use PIC18F4685?


I have changed the PIC to PIC18F4685. I have used 1 goto statement. I should have avoided it. I will write a different code when I get some time without using goto statement
 

Attachments

  • sim ss 12.jpg
    sim ss 12.jpg
    456.4 KB · Views: 80
  • sobia sarwarv12.rar
    192.7 KB · Views: 58
  • sobia sarwar v14.rar
    228.4 KB · Views: 60
  • sim ss 15.jpg
    sim ss 15.jpg
    583.7 KB · Views: 73
Last edited:
sobia sarwar v14.rar
in this you have changed the pic and can you tell me the file voter1.txt contains which data.
actually i wanted to put a check that when once a cnic is read from barcode scanner then if again some voter try to use the same cnic then it give warning

- - - Updated - - -

means the proteus3.mmc contains voter1,txt and what data does that file contains.waitng
 

Here is the voter1.txt that is inside proteus3.mmc A cnic is repeated 2 more times in the voter1.txt. If the same cnic is used again it will give the message "cnic already used" in Virtual Terminal. I used a different PIC which has more RAM because the RAM of PIC18F452 was not sufficient.
 

Attachments

  • voter1.txt
    777 bytes · Views: 69

this is thecode without check of matching.the folder have every thing i-e voter1.txt file, proteus3.mmc and schematic
 

Attachments

  • final final.rar
    527.5 KB · Views: 59

actually i wanted that cnic is not duplicated in the file of voter1.txt. actually when the barcode scanner reads cnic then if the scanner reads same cnic twice then it should give warning i-e the case when voters try to vote on using the same cnic twice.

- - - Updated - - -

i-e in the code right now i m using raw data in place of data from barcode scanner that is char txt[]. barcode scanner takes data in char array as well. now i just wanted to do that two voters with same cnics must not be allowed to cast vote.

- - - Updated - - -

i-e in the code right now i m using raw data in place of data from barcode scanner that is char txt[]. barcode scanner takes data in char array as well. now i just wanted to do that two voters with same cnics must not be allowed to cast vote.
 

Then you have to do like this. Read the cnic and store it in a 2D array. Then read another cnic and compare it with the cnic in 2D array. If it matches twice or thrice or any times then it should give warning. If cnic being read by barcode scanner doesn't match with any of the previously read cnic it will give option to vote else it will not allow to vote.

Modify the voter1.txt and repeat some cnics in it and create a new .mmc file with voter1.txt in it and check it with my simulation. Don't forget to change the .mmc file for SD card part in proteus.
 

I tried to do that but it is not working. I have been doing all possible things i can to obtain possible result but all in vain..

- - - Updated - - -

My presentation date is 15th December 2012 and I m struck in this problem.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top