Page 1 of 3

RS232.. anyone? - RFID Application

PostPosted: Wed Sep 01, 2004 9:56 am
by domino
I already have a PUB that can accept barcode input and process the scanned info...  

However what I would like to be able to do is to use data from an RFID tag and process this in the same way.

I have made a little setup to play with and this works with software from Texas Instruments but it sends the data in hex format to that utility.

Is it possible to input serial RS232 data (as an ascii string) to a focused text entry box into a NeoBook Pub.  ...

I seem to remember some time ago someone had done some work in this area.. but can't find any reference in the forum.

Cheers
Dave

RS232.. anyone?

PostPosted: Wed Sep 01, 2004 11:59 am
by Sam Cox
As GKCS pointed out earlier this year (2/29/04), "you can use ALL OS reserved devices for Input/Output via FileWrite or FileRead." So, for example, you could

   FileRead "COM1:" "1" "[variable]"

I have not tried this because I don't have a way of generating ASCII input on a COM (RS232) port.

Alternatively, you could purchase or otherwise obtain an "RS232 Wedge" which basically transfers characters recevied on the RS232 port into the keyboard stream as if you typed them. Here is one such gizmo.

   http://www.microridge.com/wedgelink.htm

RS232.. anyone?

PostPosted: Wed Sep 01, 2004 12:54 pm
by djold1
It's been a while since I have been involved in machine control but If I am not wrong I think the main problem in doing:

While....
FileRead "COM1:" "1" "[variable]"
 If "[Variable]" "=" "[Something]"
    Gosub "Somewhere"
 Else
 EndIf
End While.....

The problem with a serial port input is that you must continuously poll the port with a loop of some kind every few milliseconds to acquire the ASCII character input. ASCII commands often are in character sets not just single characters.

This is always a problem with any language but it is even more critical when using an interpreted language like NeoBook.  You can easily use up all the available resources simply in polling and responding. This means that it becomes very difficult to do anything else useful while polling.

Note that in the code snippet above that if a Gosub is activated, the While/EndWhile FileRead loop must keep on reading and handling any incoming characters. It is entirely possible that a new command could be received and have to processed every few milliseconds. Not an easy thing to do without an interrupt-type handler.

Ideally the RS-232 input should be captured in a background thread and an interrupt-like structure activated when a valid command set is received.  The interrupt is evaluated with a Case or If statement set to determine what response should be made.

Doing "FileWrite"  is not critical and should work because it is assumed that the receiving device has a way to capture, poll and parse the transmitted character set.

There is a definite need for a well done machine-code plug-in that can handle incoming RS232 for NeoBook. But the future says that it will be just as important to be able to handle USB 2.x and 1394 Firewire as well, since these are all advanced serial device handlers that will at some point take over much of the RS232 work.  


(Edited by djold1 at 12:01 am on Sep. 2, 2004)

RS232.. anyone?

PostPosted: Wed Sep 01, 2004 1:15 pm
by Alberto Meyer
Do you know the baud rate, stop bits and flowcontrol?

RS232.. anyone?

PostPosted: Wed Sep 01, 2004 2:23 pm
by djold1
Alberto,

You just illustrated another problem with handling RS232 inputs:  

It is one thing to produce a custom package that is tailored to the particular device. But the real solution would be to produce a plug-in that is user configurable as to the Baud, stop bits and the flow. Custom packages work sometimes, but then the device changes and the configuration that was hard-coded in is useless.

RS232.. anyone?

PostPosted: Wed Sep 01, 2004 2:50 pm
by Alberto Meyer
Yes. You are right, but takes much time and I don´t know about the time frame of Dave.

RS232.. anyone?

PostPosted: Wed Sep 01, 2004 3:28 pm
by domino
Thanks everyone....

I need to do a bit more homework and consider the responses thus far...

For info if anyone is interested I`m using the Texas Instruments LF Micro evaluation kit R1-K3A-001A.

This is supplied with a test software application (written in Delphi I think judging by the icon).. available at
http://www.ti.com/tiris/docs/products/tools.shtml

... S2_UTIL_VI-20.zip     (S2-Util.exe)

This gives plenty of options (none of which make much sense yet (if ever!)...  But the Baud Rat, stop bits etc are all adjustable throughout the range... the default is

9600 -   8 -  1

I`ve no idea what would be involved in producing a plugin to handle this sort of application - but the potential to handle these sorts of applications would appear to be quite exciting...

It`s late now.. but will be back on the case tomorrow.

Thanks again for the input..

Dave

RS232.. anyone?

PostPosted: Wed Sep 01, 2004 3:48 pm
by Alberto Meyer
Ok. let´s see what can we do together to help.

RS232.. anyone?

PostPosted: Thu Sep 02, 2004 4:27 am
by domino
For info I am starting to make some useful progress with the help of a utility COMtoX (http://www.dte.de/) ..

unregisteredðáéùversion  so far :-)

This solves the polling problem and allows RFID input to a focused text entry box in my NB PUB-

(BTW...Hyperterminal was good for reading the tags,)

Still plenty more to do though...

Cheers
Dave

(PS the FileRead COM1 just gave an access denied error)

RS232.. anyone?

PostPosted: Thu Sep 02, 2004 8:37 am
by Alberto Meyer
You don´t need help anymore?
Cheers

RS232.. anyone?

PostPosted: Thu Sep 02, 2004 8:49 am
by domino
Er.. yes please if you don`t mind.

So far I have proved I can get some tag info to the text entry box, but it's still not in the correct format and there are other bits like carriage returns etc to build in...

Really all I`ve achieved so far is a way to handle the polling problem...

Dave

RS232.. anyone?

PostPosted: Thu Sep 02, 2004 9:41 am
by domino
When I scan the tag into my text entry box here are examples of the returned characters -

+Î}š
Ï8;Î
ðáéù

What is this format or character set please? - and is there any way in NB to intercept this and to convert it to a number or letters for example.....

I am currently working on a way to do this but any advice would be helpful...

Dave

RS232.. anyone?

PostPosted: Thu Sep 02, 2004 10:11 am
by Alberto Meyer
Please wait 1 1/2 hour.

RS232.. anyone?

PostPosted: Thu Sep 02, 2004 10:29 am
by Alberto Meyer
Dave,
The data is delimited for what char ? 13 ? 0?

RS232.. anyone?

PostPosted: Thu Sep 02, 2004 10:43 am
by domino
Quote: from Alberto Meyer on 1:29 pm on Sep. 2, 2004
Dave,
The data is delimited for what char ? 13 ? 0?


Sorry Alberto... I don`t understand the question - what does the 13 refer to..