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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/15/03 14:06
Read: times


 
#58772 - RE: Bit Bang Question
Responding to: ???'s previous message
Hi,
...data packet on P2.0. The begining of the data has a sync pattern of (158H)with no start or stop bit
Could I ask: if it has no start condition (a bit or an external signal) and there is no additional pin used as clock input, so how do you read a data in the whole? In this case, it is not possible to make the sync of bit stream because your program will not be able to recognize which bit has been read - first, second, any other...
Anyway, if you know about start condition and just did not mentione it in the original post, here is the suggestion:
take value 0x158 as 101011000 bit stream
then read bit-by-bit and check is it correct.
For example, high bit is the first received and you already have a routine which reads a bit and put its value into the Carry flag. Then do:
; here is the routine
; which waits till correct pattern sequence
; has been received and then quits.

make_sync:
   call read_bit
start_again:
   jnc make_sync       ; first bit must be = 1
   call read_bit
   jc start_again      ; second one must be = 0
   call read_bit
   jnc start_again     ; 3rd is not 1
   call read_bit
   jc start_again      ; 4th is not 0 
   call read_bit
   jnc start_again     ; 5th is not 1 
   call read_bit
   jnc start_again     ; 6th is not 1 
   call read_bit
   jc start_again      ; 7th is not 0 
   call read_bit
   jc start_again      ; 8th is not 0 
   call read_bit
   jc wait_again       ; 9th is not 0 
; if a program is here then
; it means that pattern
; has been passed sucessful.
; So just quit
   ret
Good day!

List of 12 messages in thread
TopicAuthorDate
Bit Bang Question            01/01/70 00:00      
   Algorithm...            01/01/70 00:00      
   RE: >8 bits            01/01/70 00:00      
      9 bits            01/01/70 00:00      
   RE: Bit Bang Question            01/01/70 00:00      
   RE: Thank you            01/01/70 00:00      
      RE: Thank you            01/01/70 00:00      
         RE: Thank you            01/01/70 00:00      
            RE: Thank you            01/01/70 00:00      
               RE: Thank you            01/01/70 00:00      
                  RE: Thank you            01/01/70 00:00      
                  RE: Thank you            01/01/70 00:00      

Back to Subject List