Page 1 of 1

VB script to parse recived data from general serial device

Posted: Wed Dec 22, 2004 5:23 pm
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

Try a continuous loop

Posted: Wed Dec 22, 2004 6:29 pm
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.

Posted: Wed Dec 22, 2004 9:50 pm
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)?