VB script to parse recived data from general serial device

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
wallebalboa
Senior Member
Posts: 111
Joined: Wed Aug 11, 2004 6:52 pm
Location: Sweden

VB script to parse recived data from general serial device

Post by wallebalboa »

Hello folks.

I am trying to "split apart" and assign a serial message from serial device to different properties. however some problems/questions arise..



- alot of disk activity - is the script engine reading the script from disk every time it uses the script? if that s the case, is it possible to load it more permanent?



- some times the script stays in running mode for some time and then the whole housebot crashes. this is typically when reciving alot of messages.

is it any skeleton/example for vb scripts parsing serial recive? (I might miss some setup or exit routines if needed...) If someone have done this with sucess pls publish your code as a example.



(the timeout is now set to 10ms)



pls help...



kind regs
tenorman
Member
Posts: 6
Joined: Mon Dec 20, 2004 5:41 pm
Location: Minnesota

Try a continuous loop

Post by tenorman »

I have a VB script to parse and break apart my serial received data. I have not seen any issues with disk activity or crashes.



My script polls the received data every X ms and is always in the running state. It sounds like you are running your script every time you receive new serial data. In my experience, it seems that HB compiles the VB script every time the script devices state is changed from stopped to running. If you are running the script with each new batch of serial it will constantly have to re-read the script from disk and spend time interpreting the script.



You could also be running into a case of multiple copies of the script being run.



While polling is usually not the best solution I think that it may help you to reduce disk activity and crashes.
-Scott
ScottBot
Site Admin
Posts: 2790
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post by ScottBot »

HouseBot does read and parse the script each time it is set to the Running state. Generally this should be quite fast, since the file should be loaded into the OS memory cache after the first load (I don't even see any disk activity when loading a small script). Check to make sure you have the tracing/logging disabled for the script Device. That could cause disk activity.



Either polling or non-polling should work fine. If you are seeing a crash, could you please send me ([email protected]) the latest dump file (found in the \HouseBot\Dump directory)?
Scott
Post Reply