Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/16/07 10:12
Read: times


 
#133115 - Start and end sentinel !
Responding to: ???'s previous message
I've changed the ISR. i'm looking for start and stop.
if the character read it's not start i erase the location(of my_byte)
if it's start i increment the location
if it's stop i stop the interrupts (EA=0)



void intr (void) interrupt 2
{
port1=(~P1)&0x01;
my_byte[i]=my_byte[i]<<1;
my_byte[i]=my_byte[i]+port1; //writing bit in byte
nrb++; //increment number of bits
if (nrb==5){
if (have_start==0)//we don't have a START yet
{ if (my_byte[i]==0x1A) //have we found a start?
{
if (i<14)
{ i++; } //found start so increment i
have_start=1;
}
else //we don't have a start yet and this is not a start!
{

my_byte[i]=0x0; //we clear my byte
}
}
else //we read a start in the past
{
if (my_byte[i]==0x1F) //byte read not end sentinel
{
have_stop=1;
EA=0;
}
else{
if (i<14) {
i++; }
}
}
nrb=0; //set number of bits to 0
}
}

the results are sent to the PC with this:
while1:
c = _getkey ();

for(j=0;j<=i;j++)
{
putchar ( my_byte[j]+48);
my_byte[j]=0x0;
}

have_start=0;
have_stop=0;
nrb=0;
i=0;
EA=1; //start again the global intterupt service

goto while1;

the result is this
i = number of bytes ( locations in my_byte[])
(first 3 readings with a card, then with another card)
J is start sentinel and o is end sentinel
i can't explain what happend with readings 2,4,6,8

i:4 J1@=O
i:0 0
i:4 J1@=O
i:0 1
i:4 J112O
i:0 1
i:4 J112O
i:0 1

List of 24 messages in thread
TopicAuthorDate
Reading a ISO7811 card with AT89c2051            01/01/70 00:00      
   You need to clear my_byte[]!            01/01/70 00:00      
      i\'m already doing that            01/01/70 00:00      
         Clearer?            01/01/70 00:00      
            done that; same thing + the code            01/01/70 00:00      
               Difference between right and wrong..            01/01/70 00:00      
                  rigth and wrong            01/01/70 00:00      
                     Are those the actual results?            01/01/70 00:00      
                        here are the actual values            01/01/70 00:00      
                           Did you do as Russell suggested?            01/01/70 00:00      
                              I clear my_byte            01/01/70 00:00      
                                 I am Confused...            01/01/70 00:00      
                                    byte_meu is my_byte            01/01/70 00:00      
                           Look for the start sentinel            01/01/70 00:00      
                              Start and end sentinel !            01/01/70 00:00      
                                 Masking            01/01/70 00:00      
                                    incorrect readings when changing cards            01/01/70 00:00      
                                       Dont count bits until you have the sentinel!            01/01/70 00:00      
                                          Not necessarily garbage either....            01/01/70 00:00      
                                          THANKS !!!!! It works!!            01/01/70 00:00      
   Credit Card Reader Using a PIC12C509            01/01/70 00:00      
      How does your code work?            01/01/70 00:00      
         a bug ! and another problem            01/01/70 00:00      
      Credit Card Hex PIC12F629            01/01/70 00:00      

Back to Subject List