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 06:56
Read: times


 
#133103 - Look for the start sentinel
Responding to: ???'s previous message

You need to look at the bits you are reading. Unfortunately, your code can't cope with any leading bits that are wrong, thus when you output the data, it is wrong.

There's a couple of ways of coping with this - usually you have to look for the start sentinel sequence - then you know you've got the start, then you are sync'ed. To this end, you can just read bits into memory then look for the start sentinel and decode from there, or have your interrupt routine a bit smarter and it looks for the start sentinel. I did this many (>10) years ago on a '2051, but I cannot recall the exact method I used. I might have the code hidden away, so I'll check at some later stage.

The start sentinel is there for a reason, also with a little more code you can read the card in both directions by looking for the start and end sentinels. Again ,I cannot recall if I implemented this. You can't expect just to read bits from the card reader and expecting it to be synchronised.

I'd probably use a window detector method - shift the bits into a byte, mask and test for the start sentinel or the end sentinel in reverse for each bit until you find a sentinel. Then use a finite state machine to control the sequence.

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