Alpine M-Bus interface
PFloyd36069
Posts: 135
Hello all,
Im having a little bit trouble figuring out how to actually read the data coming from the radio. The signal is held high (around 10v) inside the radio. Then the signal grounds for certain amounts of time to transmit a 1(~.6ms) or a 0(~1.8ms). I hooked up a scope to my radio and i can definately see that signal. The part im having trouble with is how to program the prop to read it accurately. I tried modifying the sony ir decoder object (using the bs2 commands, mainly pulsin_us). i can get some readings that look right but there are a bunch of other ones that arent even close like ~.010ms or ~2.5ms. After i get this working, i hope to modify the circuit and code a bit so i can transmit data to the radio to simulate a cd changer.
here's a link to the page i got most of the info about the m-bus from: http://www.hohensohn.info/mbus/index.htm
Thanks,
Bryan
Im having a little bit trouble figuring out how to actually read the data coming from the radio. The signal is held high (around 10v) inside the radio. Then the signal grounds for certain amounts of time to transmit a 1(~.6ms) or a 0(~1.8ms). I hooked up a scope to my radio and i can definately see that signal. The part im having trouble with is how to program the prop to read it accurately. I tried modifying the sony ir decoder object (using the bs2 commands, mainly pulsin_us). i can get some readings that look right but there are a bunch of other ones that arent even close like ~.010ms or ~2.5ms. After i get this working, i hope to modify the circuit and code a bit so i can transmit data to the radio to simulate a cd changer.
here's a link to the page i got most of the info about the m-bus from: http://www.hohensohn.info/mbus/index.htm
Thanks,
Bryan
Comments
Relatively simple to do using CNT and WAITPEQ/WAITPNE.
Hmm.. looking at the "spec" I'm not sure that WAITPNE/WAITPEQ is the best way to go. That gets you the first bit fine, but detecting the end of the packet becomes tricker as you can't break out of the WAITPNE.
I'd recommend using a counter in !A mode, then set up some kind of polling logic which would check PHSA to see if it has changed and if the count is > 1.5ms (1 bit).
At that slow a data rate it would be very easy to use a PASM counting loop to detect ones and zeros as well as the end of packet condition.