![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| I was reading a discussion in the archives about which is better and when to use each, but Im still confused. Is the PIC able distinguish between a Label and Sub? How? Every sub starts with a label (right?). Can you only use RETURN after a CALL? is this the difference? | |
| |
| | (permalink) | |
| Quote:
A GOTO simply jumps to a new address, the old address isn't saved in any way - so it's a very different affair, you've no way of returning to where it started from. | ||
| |
| | (permalink) | ||
| Quote:
A PIC executes a program encoded as machine code. In machine code, there are no labels. Labels are already removed and translated by the assembler or compiler that processed the source program (the one containing labels) to machine code. That procedure was done in your PC not at the PIC. Without labels in the machine code, the PIC cannot distinguish them. Quote:
If you define a subroutine to be a section of a program that ends with a return, lookup tables are implemented in the PIC using a series of RETLW instructions. You don't have to put a label on each and every one.
__________________ "Having to do with Motion Control" | |||
| |