Processor: 16F1829
Language: MPASM
I am revising a major part of the code that formed the basis for my last question about "reading RA2," specifically the portion that receives 2 bytes of data with the EUSART RX . I could use GOTO/BRA's, but that complicates calibration and zeroing that use part, but not all of the section that is used for receipt of useful data. A call with various returns can also work; however, since three of the returns would be on errors, I would need to set flags and handle such returns appropriately from the calling spot.
A third option I have been playing with is to simply cancel the return address in the stack upon an error and use a GOTO/BRA instruction.
Here is what I trying to describe from my test sandbox:
Is that acceptable coding practice?
What if I just don't mess with TOSL/H and simply watch my calls and returns so I don't overflow the stack? (NB: No interrupts in the program)
John
Language: MPASM
I am revising a major part of the code that formed the basis for my last question about "reading RA2," specifically the portion that receives 2 bytes of data with the EUSART RX . I could use GOTO/BRA's, but that complicates calibration and zeroing that use part, but not all of the section that is used for receipt of useful data. A call with various returns can also work; however, since three of the returns would be on errors, I would need to set flags and handle such returns appropriately from the calling spot.
A third option I have been playing with is to simply cancel the return address in the stack upon an error and use a GOTO/BRA instruction.
Here is what I trying to describe from my test sandbox:
Code:
Called Address
OnError
Banksel TOSL ;|B31
clrf TOSL ;|B31
clrf TOSH ;|B31
GOTO SomewhereElse
Is that acceptable coding practice?
What if I just don't mess with TOSL/H and simply watch my calls and returns so I don't overflow the stack? (NB: No interrupts in the program)
John