??? 05/21/08 00:21 Read: times |
#154991 - Some suggestions Responding to: ???'s previous message |
Your code is defective as it assumes you get a command byte first - this may not happen in real life! I would suggest you implement a finite state machine like this:
[PRE] switch(state) { case 0: //wait for command if SBUF = MIDI_NOTE_ON { state = 1; } break; case 1: //got note on command, expect note value note = SBUF; state = 2; break; case 2: //expect note on velocity value vel = SBUF; //store note and velocity state = 0; break; } [/PRE] Please don't tell me you don't understand C language! The above is simply pseudocode and translates nearly one to one into assembler. The switch construct can be implemented with a string of CJNE. As for the issue with the indirect operations, I'd suggest you use a simulator to step through your code and the problem should be obvious to you. |
Topic | Author | Date |
Indirect addressing trouble (with midi) | 01/01/70 00:00 | |
Not sure I understand | 01/01/70 00:00 | |
Midi | 01/01/70 00:00 | |
CJNE | 01/01/70 00:00 | |
90H is Midi Note ON command | 01/01/70 00:00 | |
Yes, appears bad | 01/01/70 00:00 | |
Very Strange!!! | 01/01/70 00:00 | |
Not strange | 01/01/70 00:00 | |
But is indirect address!? | 01/01/70 00:00 | |
You are right | 01/01/70 00:00 | |
It seems that 8052 is bad! | 01/01/70 00:00 | |
Some suggestions | 01/01/70 00:00 | |
Excuse me! But I dont agree | 01/01/70 00:00 | |
Don't blame the processor! | 01/01/70 00:00 | |
From time to time it happens... | 01/01/70 00:00 | |
check value of r0 | 01/01/70 00:00 | |
Problem Solved! | 01/01/70 00:00 | |
full 'name' please![]() | 01/01/70 00:00 |