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.
Just the check that two voters with same cnics are not allowed to vote
 

you just explained that you have duplicated the cnics in sdcard file...does it work fine for my scenario,

- - - Updated - - -

Say you have 10 cnis then you can have another array repeat[10].
For every cnic in the 2D array you can check and maintain this new array repeat. If a vote has been casted for a cnic at index 0 of the 2D array then you can place an integer 1 in the repeat array at index 0.
If this cnic appears again you can look for the array repeat and check if the value at the corresponding index is zero or one. If it is zero then the person can be allowed to cast his vote otherwise the message can be displayed saying that the person has already casted his vote.

does it help?
I hope it will be help full.

- - - Updated - - -

how can i apply the above i tried but i dosen,t work, it just works for first cnic.
 

you just explained that you have duplicated the cnics in sdcard file...does it work fine for my scenario,
I have posted the voter1.txt in one of my previous posts. In that the first cnic is repeated 2 times at the end.

If a vote has been casted for a cnic at index 0 of the 2D array then you can place an integer 1 in the repeat array at index 0.

Let us say, that vote has been casted for XXXXX-XXXXXXX-X at cnics_array[0][16] then you place a 1 at repeat[0]

If this cnic appears again you can look for the array repeat and check if the value at the corresponding index is zero or one.

How do you know that the cnic XXXXX-XXXXXXX-X has repeated? With what are you comparing it?
 
Last edited:

actually its that when some voter enter its cnic and cast vote then if again another voter came to cast vote on using the same cnic then vote is not allowed to cast saying that it is casted before......
 

How do you know that the cnic XXXXX-XXXXXXX-X has repeated? With what are you comparing it?

whenever a cnic repeats then that repeat array or flag must have a check that if (==1) then vote have already been casted else can cast vote. that (==1) happens when a cnic matches with other and glcd display to cast vote

- - - Updated - - -

i have seen your code. that is actually for the cnics to be repeated in the file. i don't wanted to repeat them in file .because if they are duplicated in file then how can we know that the cnic repeated have casted vote before.

as you have done then the first cnic is repeated it will not allow for once for the cnic to cast vote
 

Finally you are checking your previously scanned cnic(s) with the currently scanned cnic and if matched to say cnic 3 in previously scanned cnics array then you are making repeat[2] as 1. Am I right?
 

ok I get it. you are trying to explain that if i keep copy of all cnic in my file and if the match occurs for once then it will allow to cast vote but if it occurs again then repeated..

Is that so.......

- - - Updated - - -

yes you it right.but I can turn it your way if you explain me a little more what your code is doing
 

I don't know about how cnics are stored in the file. You said earlier that it reads from SD card. Now you are saying that it reads from barcode scanner. If you are reading cnic from barcode scanner. Then every time a cnic is scanned it will be stored in a 2d array and the currently being scanned cnic will be matched with all the previously scanned cnics. If there is a match it will say "cnic already used" "Can't cast vote". If it doesn't match with any of the previously scanned cnic then it will allow to cast vote by giving the message "Can cast vote". That's it. It is that simple.

According to what you asked I wrote the code. In that cnics are read into cnic[] array and then it is copied to 2d array cnics_array[10][16] and then each row of cnics_array[10][16] is copied to tmp2[] one at a time and then tmp2[] is compared with txt[] and if it doesn't match it says "Can't cast vote" "txt[] doesn't match with tmp2[]" If it matches i.e., if txt[] matches with tmp2[] then it is checked with previously scanned cnics stored in matched_cnics[][] 2d array. Only those cnics which match with txt[] is stored in matched_cnics[][] array. If a match accurs between tmp2[] and any of the cnics in matched_cnics[][] array then it gives the message "Can't cast vote" "cnic already used". If there is no match between tmp2[] and any previously scanned cinics which matches with txt[] then it gives message "Can cast vote" "cnic not used"
 
Last edited:
is there any major difference between pic18f452 and the one you use expect for ram

- - - Updated - - -

the point is i have some cnics saved in my file in sdcard. I read those and saved in 2d array. the cnic scaned from barcode scanner is saved in 1 d array. i wanted to put a check that if same cnic is scanned twice from barcode then display already vote casted.......txt[] 1 d array is just used in place of barcode 1 d array as raw data for stimulation on proteus
 

I don't know. Check the datasheet. It is also available in DIP package. First decide what your code should do. First decide the right program. It too many arrays are not used then your code becomes small and it might fit into PIC18F452.

So you are not comparing cnics from barcode with cnics in sd card. right? Then you can store the cnics scanned by barcode into a 2d array and a 1d array. and the id array is compared with every row of 2d array. If there is a match, it says "Can't cast vote" "cnic already used". If there is no match it will say "cnic not used" "Can cast vote"
 

doesn't a flag bit of 0 or 1 make this work?

(sdcard) cnics_array[][] == (barcode) barcode[]

now if barcode[] have the cnic repeating how to place check vote is not casted on that repeating one....
 

I will check the datasheet. why is their any need of barcode data to be saved in 2d array. if its already saved in 1 d array.Every time cinc is scanned from barcode scanner it is compared with 2 d array of sdcard. if matches can cast vote or vice versa.

I m trying to place a check that if the cnic scanned is new one its ok. but if the scanned cnic is the one that have been scanned earlier then warning...........

- - - Updated - - -

i m reading cnics from sdcard in cnics_array and then comparing it with barcode
 

You said that sd card data and barcode data is different. Be clear. What does sd card data do?
i m reading cnics from sdcard in cnics_array and then comparing it with barcode
Then you don't even need cnics_array[][]. Read cnics from sd card and match it with barcode data. If there is a match then the message "Can't cast vote" "cnic already used". If no match then message "Can cast vote" "cnic not used"
 

can you please upload the code you have explained earlier

- - - Updated - - -

my code with comparing and duplication with pic18f452 just complete.i m attaching file......now i m going to test it on hardware

- - - Updated - - -

final control unit
 

Attachments

  • final final.rar
    531.6 KB · Views: 81
  • final final.rar
    531.6 KB · Views: 72

can you please upload the code you have explained earlier

Do you want the code for this explanation?

Then you don't even need cnics_array[][]. Read cnics from sd card and match it with barcode data. If there is a match then the message "Can't cast vote" "cnic already used". If no match then message "Can cast vote" "cnic not used"

Explain clearly. Do you want to compare barcode[] with cnics in sd card or do you want to store cnics read from barcode to a 2d array and compare cncis read from barcode to the previously read cnics.
 
Last edited:

thankx alot but i have done my work for duplication
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top