- This topic has 3 replies, 4 voices, and was last updated 9 years, 8 months ago by
Megha J V.
Viewing 4 posts - 1 through 4 (of 4 total)
-
AuthorPosts
-
April 8, 2014 at 1:58 am #3026
shahsi kiran
Participantneed of ideas or projects on nuvoton arm cortex m0 microcontroller
April 11, 2014 at 9:44 am #11528AJISH ALFRED
Participantmore details please !
April 20, 2014 at 11:40 am #11597SHAH DISHANT H.
ParticipantHi,
For Cortex series controllers, boot LINUX on that and with that you cn develop more innovative things on that…!!
But while posting, please mention your query in brief so that you can get a proper reply.
June 9, 2015 at 5:31 am #12970Megha J V
ParticipantCould u plz help me in code of voting machine whr the code has to be done with some modifications.
the control according to the code is taking many votes at a time but in voting the control shud go back to the entry state where it takes only one input
Code is :
#include<stdint.h>#include<stdio.h>#include "scankey.h"#include "NUC1xx.h"#include "DriverDrvSYS.h"#include "NUC1xx-LB_002LCD_Driver.h"int32_t main (void){int8_t arr[4];int8_t vote_amt[3],j;int8_t vote1,vote2,vote3,vote4;int8_t i;char T[1]=":";int8_t carry;int8_t max=0;char p1[50]=":";char p2[50]="::";int8_t candidate;int8_t number8;char t1[50]="a";char t2[50]=": ";char TEXT0[50]="Press 8 to vote ";char TEXT1[50]="WELCOME! VOTE P1 P2 P3 P4";vote1 = vote2 = vote3 = vote4 = 0;UNLOCKREG();DrvSYS_Open(48000000); // set MCU to run at 48MHzLOCKREG();Initial_panel();clr_all_panel();OpenKeyPad(); // initialize 3×3 keypadprint_lcd(0,TEXT0); // print titlewhile(1){number8=Scankey();//number9=Scankey();while(number8 =={Initial_panel();clr_all_panel();print_lcd(0,TEXT1);DrvSYS_Delay(5000000);Initial_panel();clr_all_panel();while(1){candidate=Scankey();sprintf(t2,"%d",candidate);print_lcd(2,t2);DrvSYS_Delay(5000000);//functionwhile(candidate==1){Initial_panel();clr_all_panel();sprintf(p1,"%d",candidate);print_lcd(2,p1);DrvSYS_Delay(5000000);while(candidate==1){Initial_panel();clr_all_panel();print_lcd(0,"Candidate1");vote1 = vote1 + 1;sprintf(p2,"%d",vote1);print_lcd(2,p2);DrvSYS_Delay(5000000);break;}break;}while(candidate==2){Initial_panel();clr_all_panel();sprintf(p1,"%d",candidate);print_lcd(2,p1);DrvSYS_Delay(5000000);while(candidate==2){Initial_panel();clr_all_panel();print_lcd(0,"Candidate2");vote2 = vote2 + 1;sprintf(p2,"%d",vote2);print_lcd(2,p2);DrvSYS_Delay(5000000);break;}break;}while(candidate=)
{Initial_panel();clr_all_panel();sprintf(p1,"%d",candidate);print_lcd(2,p1);DrvSYS_Delay(5000000);while(candidate=)
{Initial_panel();clr_all_panel();print_lcd(0,"Candidate3");vote3 = vote3 + 1;sprintf(p2,"%d",vote3);print_lcd(2,p2);DrvSYS_Delay(5000000);break;}break;}while(candidate==4){Initial_panel();clr_all_panel();sprintf(p1,"%d",candidate);print_lcd(2,p1);DrvSYS_Delay(5000000);while(candidate==4){Initial_panel();clr_all_panel();print_lcd(0,"Candidate4");vote4 = vote4 + 1;sprintf(p2,"%d",vote4);print_lcd(2,p2);DrvSYS_Delay(5000000);break;}break;}if(candidate==9)break;}while(candidate==9){while(1){Initial_panel();clr_all_panel();print_lcd(0,"RESULTS ARE OUT");print_lcd(1,"P1 P2 P3 P4");sprintf(T,"%d %d %d %d",vote1,vote2,vote3,vote4);print_lcd(2,T);DrvSYS_Delay(90000000);//delay(300); arr[0] = vote1;arr[1] = vote2;arr[2] = vote3;arr[3] = vote4;for( i=0; i<4; i++){if(arr>=max)max = arr;}while(1){if ( (vote1 == max) && ( vote2 != max) && (vote3 != max)&& (vote4 != max) ){carry = 1;Initial_panel();clr_all_panel();print_lcd(2,"P1 WON!");DrvSYS_Delay(300000000);}if ( (vote1 != max) && ( vote2 == max) && (vote3 != max)&& (vote4 != max) ){carry = 1;Initial_panel();clr_all_panel();print_lcd(2,"P2 WON!");DrvSYS_Delay(300000000);}if ( (vote1 != max) && ( vote2 != max) && (vote3 == max)&& (vote4 != max) ){carry = 1;Initial_panel();clr_all_panel();print_lcd(2,"P3 WON!");DrvSYS_Delay(300000000);}if ( (vote1 != max) && ( vote2 != max) && (vote3 != max)&& (vote4 == max) ){carry = 1;Initial_panel();clr_all_panel();print_lcd(2,"P4 WON!");DrvSYS_Delay(300000000);}}}}}}} -
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.