??? 03/06/07 05:13 Read: times |
#134339 - A call to a subroutine that ends in a jump Responding to: ???'s previous message |
Erik pointed out that you call a subroutine (ETC_IAT) that appears to end in a jump rather than a return.
If this is the case, (and I am not sure that it is) then by calling but not returning, you are incrementing the stack by 2 every time. This unbalanced operation will eventually cause your stack to wrap around and overwrite registers with data in them. Or worse, the stack will be overwritten by data, and the next time you return, the processor will crash. Your code needs a lot more comments, especially if you go to a forum for help. Ideally, every line is commented, and there are blocks of comments with every subroutine or functional block of code. Not only do the comments help others help you, they are very good for helping you to organize your own thoughts. Here is a piece of your code, as provided ECT: ; write ect to pot mov a,r5 clr cs acall txsend mov a,#pota acall txsend ; acall delay setb cs retAnd here it is with documentation ;--------------------------------------- ; ; ECT Subroutine - write ect value to external pot A ; ECT: mov a, r5 ; Fetch pot0 data clr cs ; Bring /CS low acall txsend ; Send code to digipot mov a, #pota ; Code for selecting pota acall txsend ; Send Code to digipot ; acall delay ; Write delay setb cs ; Restore /CS ret ; ReturnNow, these comments may not be correct, and I may not be understanding what you are trying to do. Still, I think you will agree that it is easier to read. And that means it is much more likely to bring you meaningful help. |
Topic | Author | Date |
trouble w/ my bit banging code i2c, spi | 01/01/70 00:00 | |
calls and jumps | 01/01/70 00:00 | |
Sorry | 01/01/70 00:00 | |
Reformatted your code. | 01/01/70 00:00 | |
seen enough | 01/01/70 00:00 | |
thanks erik | 01/01/70 00:00 | |
A call to a subroutine that ends in a jump | 01/01/70 00:00 | |
Thanks All | 01/01/70 00:00 | |
don't take it personaly | 01/01/70 00:00 | |
what I am implying![]() | 01/01/70 00:00 | |
criticism and such... | 01/01/70 00:00 | |
well, if you do not want advice, but cuddling | 01/01/70 00:00 | |
what purpose? | 01/01/70 00:00 |