??? 01/31/06 07:56 Read: times |
#108794 - Maybe this will help you Responding to: ???'s previous message |
Stanley Lio said:
When I join it with the servo motion code, the MPU just hang somewhere in the middle (I don't know where).
Debuggin these control code are really time-consumptive... I have recently made a successful debugging on one my very long program, consisting of about 8000 lines, producing cca 12 kb long code. The problem was that sometimes, if it was overflooded with data, it got stuck somewhere. It was of course very important to find out where. First thing I noticed was that it was not reset by the WDT, it meant that the WDT counter got reset command regularly. I came to the idea to switch WDT off, and do a replace in the Editor: all places of reset WDT were replaced by word DEBUG. Then I defined the following macro DEBUG MACRO JB Port.Pin,$+6 CALL SENDME ENDM. The routine SENDME was something like this SENDME: MOV R1,#80H POP A ; Higher MOV @R1,A POP A ; Lower INC R1 MOV @R1,A DEC R1 INC SP INC SP CALL ASCHEX ; Transform the value to 2 chars and send INC R1 CALL ASCHEX mov sbuf,#' ' jnb ti,$ clr ti RETSo, I soldered a taster on a free Port.Pin, and when it got stuck again, I got the address on the screen ! (By connecting it to a port pin and not to, say, external interrupt, you need not think whether and which interrupts are enabled). Of course, you can easily modify the routine and make it send something else: DPTR, some register or memory contents ... And no problem to place DEBUG somewhere else in the located part of the program ! I really appreciate your great work ! Good luck ! Slobodan |
Topic | Author | Date |
Servomotor head version III | 01/01/70 00:00 | |
Nice Work | 01/01/70 00:00 | |
Manageing code and debugging | 01/01/70 00:00 | |
Divide into modules | 01/01/70 00:00 | |
multi tasking | 01/01/70 00:00 | |
IRRC routine are much longer | 01/01/70 00:00 | |
No waiting for IR | 01/01/70 00:00 | |
two mcu | 01/01/70 00:00 | |
Maybe this will help you | 01/01/70 00:00 | |
this is not IRQ save | 01/01/70 00:00 | |
RS232 | 01/01/70 00:00 | |
Design First | 01/01/70 00:00 | |
Design | 01/01/70 00:00 | |
Pardon![]() | 01/01/70 00:00 | |
Well done! | 01/01/70 00:00 | |
The "3.0" | 01/01/70 00:00 | |
Smart! | 01/01/70 00:00 | |
hardware | 01/01/70 00:00 | |
Mainland China | 01/01/70 00:00 | |
And Well done Kai! | 01/01/70 00:00 | |
My experinece | 01/01/70 00:00 | |
very impressive | 01/01/70 00:00 | |
Program and Code Structure | 01/01/70 00:00 | |
Spaghetti anyone ? | 01/01/70 00:00 | |
manually interpret machine code? | 01/01/70 00:00 | |
hand coded mechine language | 01/01/70 00:00 | |
Keep up the good work | 01/01/70 00:00 |