PR8-B (provided with modified source code)

LED Blinking, Walking with Cytron Servo, Displaying RFID, Multi-function Mobile Robot......

PR8-B (provided with modified source code)

Postby kwlew » Tue Apr 05, 2011 12:17 pm

Hi, i would like to modify the source code of the PR8-B diy project.

Currently the source code i download from cytron is only match the RFID tag and display the name and id.

I have an idea to modify the source code become an attendance system.
for an example:
-there are two RFID card, one RFID card is tagged and the data is store while another one is no tag.
-there are two button in these diy set and i would like to make one of the button, when we press it and it will show the data of
the card that we already tagged. While the other button when we press, it will show the card that are not tag.

Any idea how do that?

Thanks.
kwlew
Newbie
 
Posts: 13
Joined: Thu Feb 24, 2011 11:40 am

Re: PR8-B (how to modified source code)

Postby ober » Thu Apr 07, 2011 9:54 pm

Hi, you will need to take the move first before we can help you. Try to modify the program part by part, and load to the hardware, look at the result, share with us. From there, the other can help by giving you opinion. It is not possible for someone to provide you total solution here.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: PR8-B (how to modified source code)

Postby kwlew » Sat Apr 09, 2011 7:01 pm

Hi, i modified the code and it works.

But when i press the button it not 'stable'.....for an example, there are two id tagged and when i press once it will show the data for the first id. Then when press second time it suppose will show second data of the second id, but i need to press many time only the second data will appear in the lcd.
How to fix the problem?

Thanks.

Here is the code that i modified.
CODE: SELECT_ALL_CODE
unsigned char uart_rec(void)          //receive uart value
{
   unsigned char rec_data;
   while(RCIF==0)                                  //wait for data
   {
      
      if (button1==0&&present[0]==0)
      {
         lcd_clr();
         lcd_goto(0);                            //set lcd cursor to location 0
         send_string("Not Present!");                //display "Not Present "
         lcd_goto(20);                            //set lcd cursor to location 20
         for(i=0;i<10;i+=1)send_char(user_1[i]);       //display user name
         delay(100);
      }
      if (button1==0&&present[1]==0)
      {
         lcd_clr();
         lcd_goto(0);                            //set lcd cursor to location 0
         send_string("Not Present!");                //display "Not Present "
         lcd_goto(20);                            //set lcd cursor to location 20
         for(i=0;i<10;i+=1)send_char(user_2[i]);       //display user name
         delay(100);
      }
      if (button1==0&&present[2]==0)
      {
         lcd_clr();
         lcd_goto(0);                            //set lcd cursor to location 0
         send_string("Not Present!");                //display "Not Present "
         lcd_goto(20);                            //set lcd cursor to location 20
         for(i=0;i<10;i+=1)send_char(user_3[i]);       //display user name
         delay(100);
      }
      if (button1==0&&present[0]==1&&present[1]==1&&present[2]==1)
      {
         lcd_clr();
         lcd_goto(0);                            //set lcd cursor to location 0
         send_string("All Present!");                //display "Alll Present "
         delay(100);
      }
      if (button2==0&&present[0]==1)
      {
         lcd_clr();
         lcd_goto(0);                            //set lcd cursor to location 0
         send_string("ID: ");                      //display "ID: "
         for(i=0;i<10;i+=1)send_char(id_1[i]);          //display tag ID
         lcd_goto(20);                            //set lcd cursor to location 20
         send_string("user: ");                      //display "user: "
         for(i=0;i<10;i+=1)send_char(user_1[i]);       //display user name
         entry+=1;
         delay(100);
      }
      if (button2==0&&present[1]==1)
      {
         lcd_clr();
         lcd_goto(0);                            //set lcd cursor to location 0
         send_string("ID: ");                      //display "ID: "
         for(i=0;i<10;i+=1)send_char(id_2[i]);          //display tag ID
         lcd_goto(20);                            //set lcd cursor to location 20
         send_string("user: ");                      //display "user: "
         for(i=0;i<10;i+=1)send_char(user_2[i]);       //display user name
         entry+=1;
         delay(100);
      }
      if (button2==0&&present[2]==1)
      {
         lcd_clr();
         lcd_goto(0);                            //set lcd cursor to location 0
         send_string("ID: ");                      //display "ID: "
         for(i=0;i<10;i+=1)send_char(id_3[i]);          //display tag ID
         lcd_goto(20);                            //set lcd cursor to location 20
         send_string("user: ");                   //display "user: "
         for(i=0;i<10;i+=1)send_char(user_3[i]);    //display user name
         entry+=1;
         delay(100);
      }   
   }
   rec_data = RCREG;
   return rec_data; //return the data received
}
kwlew
Newbie
 
Posts: 13
Joined: Thu Feb 24, 2011 11:40 am

Re: PR8-B (provided with modified source code)

Postby shiyan » Sun Apr 10, 2011 4:16 pm

well, I din refer to the DIY project that you mentioned, but your source code is very weird. Why is the program to store ID and pressing is in the uart_rec function? Can you explain in detail what is the output? I doubt you can get a correct output using this code.
User avatar
shiyan
Amateur
 
Posts: 189
Joined: Wed Jun 09, 2010 10:59 am

Re: PR8-B (provided with modified source code)

Postby kwlew » Tue Apr 12, 2011 8:19 am

the project is when we tagged the rfid card, it will store the id and name in the pic. after that we can press the button to check the name and id that stored in the pic, the name and id will show in the lcd. so which part will you suggest i should put the pressing program?
Thanks.
kwlew
Newbie
 
Posts: 13
Joined: Thu Feb 24, 2011 11:40 am

Re: PR8-B (provided with modified source code)

Postby sich » Thu May 05, 2011 2:28 pm

Seems like you put ur scan buttons commands in the uart communication subroutine. I don't know how's the rest of your code, i guess you should take it out...and put it somewhere else, eg: main.
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm


Return to DIY Project Set

Who is online

Users browsing this forum: No registered users and 14 guests

cron