I’m having some problems with a subroutine in the small program I’ve been working on mikroBasic for the Honda Music Link stuffs I’ve been doing.
Could any of you help me?
To start, here’s a copy of the program in a text file: hml_mikrobasic_help.txt
Here’s the project itself, zipped up: hml_mikrobasic_help.zip
The IDE / compiler itself, mikroBasic, is available here.
(I’m just using the demo version, and the limit is only on code size, so feel free to install it. I don’t come anywhere near the code limit, and when one does it’s rather obvious, as the compiler just refuses to compile it.
The problem I’m having is with sendCommand(), and specifically the variable iPodCommand, which is the first one passed to it. What I expect to happen is that whatever is passed as the first argument to sendCommand() will be set and available within the procedure. Instead, I seem to be getting something else.
As the program is currently listed, I would expect the output sendCommand(powerOn, 0) to be 0xFF 0x55 0x04 0x00 0x00 0x00 0x04 0xF8. However, the output I receive is 0xFF 0x55 0x02 0xFE 0xB9 0x47.
The expected packet is broken down as follows:
0xFF – Header 1
0x55 – Header 2
0x04 – Data Length
0x00 – Data 1
0x00 – Data 2
0x00 – Data 3
0x04 – Data 4
0x08 – Checksum (0x100 – Data Length – All Data Packets)
The received packet breaks down this way:
0xFF – Expected Header 1
0x55 – Expected Header 2
0x02 – Length appropriate if the constant referenced by iPodCommand were two bites in length.
0xFE – Data 1 (Not sure where this comes from.)
0xB9 – Data 2 (This one neither…)
0x47 – Checksum, calculated properly off of unexpected Data bytes.
When I run things through the hardware debugger I’m not seeing the variable iPodCommand as an array, and I’m not sure why or how (it just shows a value of 0xDF). That, though, and it’s not working as expected, is leading me to believe that I’m doing something wrong in setting up sendCommand().
So, could any of you please help me? I just don’t know what I’m doing wrong.
Thanks!