On 10 Dec 2008, at 20:53 , Sebastien LELONG wrote: > Hi guys, > > I'm currently re-implementing some of my libs in my SirBot project. > One aspect > is the communication between a PIC and a PC, over serial link. > During this > dialog, several "things" can be exchanged: > > * a request can be sent to a PIC, expecting a response > * a response can be sent by the PIC to the PC, after having > received a > request
I have done all that, with PICs as humble as the 16F819. It has been working on some locations for years. http://picnets.wiki.xs4all.nl/index.php?title=Main_Page http://sourceforge.net/projects/picnet > * a message can be sent from the PIC to the PC, on its own, > without any > request from the PC I did not enable that, afraid of chatter and crosstalk. > > The lib in the PIC is able to digest a request (for now, just read > a char), > send a request or a response. While sending them, the PIC can build > a frame > with Start Of Frame and End Of Frame chars (SOF/EOF), a type, the > length, the > content. > > On the PC, the whole is parsed to extract back responses and > messages, through > the serial com. It's implemented using Twisted, a asynchronous lib > using > deferreds (no threads). That my last work: reimplement using Twisted > (http://twistedmatrix.com/trac/), which provides an amazingly powerful > framework when it comes to deal with network issues and event- > driven app. > Once the response/messages are received, events can be triggered, > and all > data (depending how low/high you are: chars, requests, responses, > messages, > events, errors) can be sent via different gateways, through a > socket (there's > also a ssh connection to access the server and take control of the > robot, > hum, the PIC by sending request to it, via a python CLI). > > For now, I'm building a Flash GUI using Flex > (http://www.adobe.com/fr/products/flex/), so every piece of data is > sent > through the gateway and collected by the Flash app (Action Script > XMLSocket). > This way, you can monitor, in real time, what your PIC is doing, > building > graphs, etc... Just open your browser, and observe what's going on... > Currently, first benchmarks shows the whole app (PIC + twisted > server + > flash/flex app) is able to handle ~1000 events / secs (ping/ping > between > PIC/PC), with not so much processing though), still quite > surprising when > consedering the number involved layers :) > > Why bother you with that ? Well, I was thinking about sharing my > PIC's lib to > jallib (even if most of the value isn't in the PIC, but on the PC > side). The > problem is I don't know if it's worth it, how to do this, what to > share, how > users would use it, etc... This is probably more a matter of > applications, > than libraries. I've found also interesting things with the Arduino > project, > like a Firmata lib (http://www.arduino.cc/playground/Interfacing/ > Firmata): > it's supposed to be a standard protocol to talk to a PIC, handling > things > like moving servo, etc... I didn't want to implement this protocol, > because > it doesn't deal with frames' length, types, etc... > > My questions are: > > * do you know any standard protocol/way of talking to a PIC <=> PC ? no > * how do you deal with that ? (do you deal with that ?) I made one up, with the intention of keeping node cost (including connectors and wire) below €2 > * do you know Firmata and what's your opinion ? no, none > * do you think it's valuable to add such a lib (PIC side) to jallib ? YES. > As an extra: a screenshot showing part of my extra minimalist and > prototypic > Flex GUI, with some requests, responses and messages. It's > connected to the > twisted server via AS XMLSocket, collect and log the data. > > > Cheers, > Seb > -- > Sébastien LELONG > http://www.sirloon.net > http://sirbot.org > > > > <flash_gateway.png> --- ir EE van Andel [email protected] http://www.fiwihex.nl Fiwihex B.V. Wierdensestraat 74, NL7604BK Almelo, Netherlands tel+31-546-491106 fax+31-546-491107 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jallib?hl=en -~----------~----~----~----~------~----~------~--~---
