FYI - BS2 to CM11A source code ( X10 )
GICU812
Posts: 289
Not a question or even really a conversation, just documenting my work for posterity. When I searched, I couldnt find anything, so maybe this will help someone.
You can use the XOUT command in the BS2 to talk to a PL513 or the like easily. However I found it very difficult to read commands off the PL513 (actually I couldnt do it at all). So,·I got the slightly more expensive CM11a, which will actually buffer up to 4 codes for you, has a line that can be·polled to check for·RTS·as well as host macros, and a PC interface, and uses standard serial I/O. IMO, there is no competition, unless you need the PS513 for a specific reason, the CM11a is the far more logical choice.
Anyway, there is good documentation for the communication standards for the CM11a, but I found it lacking, I need an example to be able to really understand something. So, attatched is my working code to communicate with the CM11a.
One note, you cannot transmit to the CM11a if it has buffered codes, so my code, when·you transmit (talker) it checks, and if the response is 0x90 (attention) then it runs the recieving code (reader), then returns to run the transmit code.
Also, the CM11a pulls pin 9 of the serial line high (RI) when it wants to transmit, so you could use that as a interupt with Pollin, or just check it periodically, or just serin with a short timeout looking for 0x90, I didnt bother, its a demo.
Here is a link to the protocol documentation: http://www.x10pro.com/pro/pdf/cm11a_protocol.txt
Again, in hindsight,·the documentation was·well written, I just needed to see it work to understand it.·My code isnt really usefull for anything, other than proof of concept. Also, note it was written for a BS2p40, so you may need to correct the baud rate for your stamp. There are many more glamorous ways of coding this, I just wanted to share it as a demo.
Post Edited (GICU812) : 11/10/2008 10:45:54 PM GMT
You can use the XOUT command in the BS2 to talk to a PL513 or the like easily. However I found it very difficult to read commands off the PL513 (actually I couldnt do it at all). So,·I got the slightly more expensive CM11a, which will actually buffer up to 4 codes for you, has a line that can be·polled to check for·RTS·as well as host macros, and a PC interface, and uses standard serial I/O. IMO, there is no competition, unless you need the PS513 for a specific reason, the CM11a is the far more logical choice.
Anyway, there is good documentation for the communication standards for the CM11a, but I found it lacking, I need an example to be able to really understand something. So, attatched is my working code to communicate with the CM11a.
One note, you cannot transmit to the CM11a if it has buffered codes, so my code, when·you transmit (talker) it checks, and if the response is 0x90 (attention) then it runs the recieving code (reader), then returns to run the transmit code.
Also, the CM11a pulls pin 9 of the serial line high (RI) when it wants to transmit, so you could use that as a interupt with Pollin, or just check it periodically, or just serin with a short timeout looking for 0x90, I didnt bother, its a demo.
Here is a link to the protocol documentation: http://www.x10pro.com/pro/pdf/cm11a_protocol.txt
Again, in hindsight,·the documentation was·well written, I just needed to see it work to understand it.·My code isnt really usefull for anything, other than proof of concept. Also, note it was written for a BS2p40, so you may need to correct the baud rate for your stamp. There are many more glamorous ways of coding this, I just wanted to share it as a demo.
Post Edited (GICU812) : 11/10/2008 10:45:54 PM GMT
bsp
4K
Comments
Did you need a MAX232 driver between the BS2 and the CM11a at all?
One thing, you will need to initialize the interface by hooking it up to a computer. I havent figured that part out, though it does act like the documentation states after a power up, polling for macros. The biggest hangup is that the software hard crashes my computer 9 out of 10 times, so its really hard to figure out what is going on, or really even what im doing to get it running again. Usually if I test comms, it just says comms failure, then for no reason, it succeedes after about 10-15 minutes (and 5 or 6 reboots)
But enough ranting, once you get the interface intialized, it works well with the stamp, and im working on some code in C I'll post too.
One other thing, there does seem to be a TON of noise on the interface line, a very distinct 60hz signal. It might be worth looking into filtering, I havent gotten that far yet, I have no comms problems, but I dont imagine its good to be sinking all that noise into my circuit ground.