The first instruction to be executed (goto start) makes the chip goto ( jump) to the part of the program labelled start, and thus the PIC microcontroller will begin running the program from where you have written start.' The whole org routine does seem stupid to me too but I don't really know what to do about it. Writing the program memory address by the instructions shows how it works: org 1FF 01FF goto start org 0 Subroutines: 0000 Init clrf porta 0001 clrf portb etc. However, subsequent instructions must start counting from 0, so the following command is org 0. In the template, org is used to place instruction goto start at 1FFh, making it the first to be executed. What instructions are needless? I'm trying to do the best I can and follow the program the way that it is explained in the book.įrom The Pic Microcontroller - Your Personal Introductory Course, 3rd Ed by John Morton: 'We want the PIC microcontroller to begin at the place in the program which we have labelled start, so we make sure the instruction at 1FFh is goto start. Man, that stupid apostrophe!!! I know it won't blink yet, that is the next step:) I don't understand what is weird about my execution order. The other ports are initialized in the same manner. From the datasheet: This code example illustrates initializing the PORTA register. The 16F1827 has a few extra commands in the data sheet for initializing the port A register via banksel that I don't quite get. Does anybody know what I'm doing wrong? I'm having trouble with some of the instructions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |