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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/25/05 18:17
Read: times


 
#93903 - decoding code 39 with 89s52
Hi gentlemen !
I’m trying to experiment with barcode decoding it goes like this : read a portion of barcode(code 39) with an 89s52 and send it via uart to be received by another 89s52 driving an lcd ,as long as I replace code1 with #0000xxxxb
I got correct result on the other end in decimal on lcd otherwise it returns a 0 decimal.the following is my code please point out my errors and give me some hints.Thanks a lot
Vu Nhu Khanh

;================================================================
; out put of ir reader to code_in p3.2 when card_in p3.5 and eye_on p3.4 set
;=================================================================
read_code:
mov r0,#08h
jnb card_in,read_code ;wait for card
clr eye_on ;turn on power to ir led and ir diode pair
lcall delayhs ;skip the white part
read1:
jnb code_in,add_one
jb code_in,add_zero
lcall skip_read ;4 milisec delay loop
dec r0
cjne r0,#00h,read1 ;read 8 bit
mov a,bar_code ;read the result
mov code1,a ;prepare to send
setb eye_on
ret

send_code:
mov a,code1
lcall bin2dec
lcall phat

ret

phat:
clr ti
mov sbuf,a
jnb ti,$
ret

thu:
jnb ri,$
mov a,sbuf
clr ri
ret


;===================================================
add_one:
mov a,bar_code
rl a
add a,#1b
mov bar_code,a
lcall skip_read
ret

add_zero:
mov a,bar_code
rl a
add a,#0b
mov bar_code,a
lcall skip_read
ret

;

start:
mov a,#00000000b
mov code1,a
lcall init_baud
tiep:
lcall read_code
lcall send_code
lcall delayhs
ajmp tiep
ret
end




List of 6 messages in thread
TopicAuthorDate
decoding code 39 with 89s52            01/01/70 00:00      
   Some hints!            01/01/70 00:00      
       do I still have to setb card_in            01/01/70 00:00      
         Oop ! i goofed off            01/01/70 00:00      
         8051 inputs            01/01/70 00:00      
            thanks i saw the point            01/01/70 00:00      

Back to Subject List