> Van: adrian aslett > Aan: PICLIST@MITVMA.MIT.EDU > Onderwerp: PCLATH Questions > Datum: dinsdag 28 april 1998 14:30 > > I am having a problem with understanding the use of PCLATH on a PIC 16c74. > > When I use the prosessor in the lower 2K program area it appears > PCLATH<0.2> are updated automatically but when I try to use it in the upper > 2K page boundary I am experiencing a problem. I set PCLATH<3> as per the > instructions. Do a call within the area and then find that PCLATH<0,2> are > not updated. > > Can anyone help me with this and point me in the right direction. Yes, I can help you :-) I'm sorry to say (for you), but the only one who will update the PCLATH -register is _you_ ! If you CALL or GOTO bits <3,4> in PCLATH represent the upper two bits of the Call/GOTO adres (11 bits are coded into the CALL/GOTO command, 2 bits are prepended from PCLATH<3,4> , and voila, you have got an address-range of 13 bits ! (That seems to be the maximum amount of on-chip code-memory for the PIC's) If you update the PCL register manualy (by moving, adding, etc. to) you have only got 8 bits to work with. The PIC will prepend bits PCLATH<0,4> to the 8 bits of PCL so you again have got an 13 bits address. > I need to use the full 4K and do not want to have calculate where code > resides to set the bits required. Too bad, the PIC won't do it. So, you will have to do it yourself ... (Maybe you could write a Macro to set those bits for you. I've seen some examples in this list !) > Thanks > > EMAIL adrian@ttsltd.force9.co.uk Greetz, Rudy Wieser P.s. I saw that the explanation of the PCL/PCLATH registers was somewhat absent with the 16C74. Try reading the docs of the 16C84 regarding those registers. It'll clarify the matter I think.