Hi all,

I'm writing a short script to capture the output of RFID reader. It dumps a=
n=20
ASCII string for each RFID tags which is near enough.

I want to put a box with 12 RFID tags and gets their unique marks. The scri=
pt=20
dumps how many tags are passed near the reader, so I detect if there are=20
defective ones into the box under test!

The script is below. To simulate the reader and the capture machine I use t=
wo=20
PC with Windows. One runs the "script", the other one is used to type mark =
by=20
hands. I open Serial Port with:

serial-port: open/lines/direct/no-wait serial://port1/9600/8/none/1

After I type something like this line:

insert serial-port rejoin [["01 M00CD7DD2 N 23" newline "01 M00CD7DD2 N 24"=
=20
newline "01 M00CD7D D2 N 25" "" newline]

What I get on the other PC is something like this:

Lettura Tag RFID
Number of Tags (current test) 1
Number of Tags (total) 1
["01 M00CD"]
Number of Tags (current test) 4
Number of Tags (total) 5
["7DD2 N 23" "01 M00CD7DD2 N 24" "01 M00CD7D D2 N 25" ""]

May you help me to understand why I get so bed output?

Thank you in advance.

/* Full Script */

REBOL []

either exists? %ztools.r [
=09=09do %ztools.r
=09][
=09=09do load-thru http://utenti.multimania.it/zlab/pub/rebol/ztools/ztools=
.r
]
=09

; +-------------+
; | Serial Port |
; +-------------+
my-serial-port: "com1"
my-serial-port: to-word my-serial-port
insert system/ports/serial my-serial-port
serial-port: open/lines/direct/no-wait serial://port1/9600/8/none/1
;serial-port: open/lines/no-wait serial://port1/9600/8/none/1

; +-----------+
; | File Init |
; +-----------+
infilename: %TagReport_FULL_DB.txt
ofilename: %Test_Hyperterminal.TXT

; +---------------+
; | Emulator Init |
; +---------------+
emulation: FALSE
emulatedtags: copy [
=09=09=09=09=09"=0201 M00CD7DD2 N 22=03"
=09=09=09=09=09"=0201 M00CF00B6 N 51=03"
=09=09=09=09=09"=0201 M10101010 Y 20=03"
=09=09=09=09=09"=0201 M00CF4414 N 20=03"
]

; +-----------+
; | Main Init |
; +-----------+
print "Lettura Tag RFID"
tagscounter: 0
if exists? ofilename [delete ofilename]

; +--------------+
; | Reading loop |
; +--------------+
forever [
=09if TRUE =3D emulation [serial-port: copy emulatedtags ]
=09tags: copy serial-port
=09either none =3D tags [
=09=09=09ntags: 0
=09=09][
=09=09=09ntags: length? tags
=09]
=09if 0 < ntags [
=09=09tagscounter: tagscounter + ntags
=09=09print ["Number of Tags (current test)" ntags newline "Number of Tags=
=20
(total)" tagscounter]
=09=09foreach tag tags [
=09=09=09write/append ofilename rejoin [tag newline]
=09=09]
=09=09probe tags
=09=09wait 5
=09]
]

; Exit
;close serial-port
print "Ready."
halt



-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to