![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
when they say a table can't cross the 256 boundry, does that mean the 256th line in the program? and would that be the same as the address 256 in the program counter. i'm haveing trouble understanding the pclath
|
|
|
|
|
|
|
(permalink) | ||
|
I am assuming you are talking about PIC micros here.
Quote:
Quote:
__________________
--- The days of the digital watch are numbered. --- |
|||
|
|
|
|
|
(permalink) |
|
so the program counter can hold more than 256, its just that you can only write to the lower 8 bits. so the pic can write to all of the bits? how does useing pclath make it posible to cross the page boundry. pommie did it for me but i don't understand what it does.
|
|
|
|
|
|
|
(permalink) |
|
PCLATH has two slightly different uses.
First, whenever a write to PCL occurs then PCLATH is copied to the high byte of the program counter. An example may help, Code:
movlw 0x01 movwf PCLATH movlw 0x23 movwf PCL When it comes to tables then the normal way to use them is to place the table on a page boundary (0xnn00) and load PCLATH with the high byte of the address (0xnn). The limitation of this method is that the table has to be in the one block of 256 bytes. An alternate method that gets around this limitation is to calculate PCLATH as well as PCL. Such as, Code:
movlw high(table) movwf PCLATH movwf low(table) addwf Pointer,W btfsc STATUS,C incf PCLATH,F movwf PCL table retlw 00 The second use for PCLATH is when doing a jump or call. These instructions only provide 11 bits for the address and so the other bits come from the top 5 bits of PCLATH. So, to jump to location 0x876 you would do, Code:
movlw 0x08 movwf PCLATH goto 0x076 HTH Mike. |
|
|
|
|
|
|
(permalink) |
|
i think i'm begining to see. so basically the uper five bits of the program counter determines what 256 page your on?
|
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Need some help with a code provided by ATMEL | ikalogic | Micro Controllers | 1 | 23rd January 2007 02:45 PM |
| PIC: Table lookup across page boundary | eblc1388 | Micro Controllers | 11 | 16th August 2005 02:42 PM |
| compiling with MPLAB | evandude | Micro Controllers | 4 | 9th April 2005 08:08 AM |
| Elektor Web Page | Sarac | General Electronics Chat | 1 | 8th November 2004 08:12 AM |
| Half page loads | DirtyLude | Feedback/Comments | 7 | 14th May 2004 11:29 PM |