At 12:18 1998-03-12 GMT, you wrote: > I sent the following message a few days ago and didn't receive >any replies. I am not sure if this is because everyone ignored it, or >I am not getting all the replies or it never reached you. >Could someone please reply to this message - if only to say that you >received it. Could you please reply directly at: - >men5dp@electeng.leeds.ac.uk > >Thanks >Dav > > ------- Forwarded Message Follows ------- > >From: Self >To: PICLIST@mitvma.mit.edu >Subject: Beginner's Questions >Date sent: Sat, 7 Mar 1998 17:14:26 GMT > >Hello, > >I am just beginning to start programming with the PIC16C71. I have >heard about a problem associated with PAGES and CALLs. Could someone >please explain exactly how PAGEs work? Does the assembler place the >code that I write in different PAGEs as it sees fit? I do not >understand how the problem with CALLs works - I have read that >sometimes if you CAll a subroutine or data table, the RETLW command >may not return you to the correct Return Address, because of this >problem with PAGEs. How come? And how do I know if Iwill be effected >by this problem? > I am currently writing code to control two stepper motors as part >of a one cubic inch microrobot. I have a couple of subroutines, >and several lookup tables. How do I ensure that when I CALL these I will >always return to the correct address? In other words, how do I >know while writing code that I will have to swap between PAGEs? >At a guess I think I'll have a couple of hundred lines of code (including >ables, equates, etc). I don't understand how I can know what will be placed >in which page. > >Also, as I have never actually used PIC chips before and I have no >idea of how to hook them up. I am not doing any AD conversion so will >I still require a crystal oscillator or RC network? Do you think I'll >be able to use transistors between the PIC and the motors? Any idea >how to hook these up? > >Can someone please help me. >Thanks in advance. > >Dav > I foud it in my trash bag... The problem is that the adress range covered by goto and call do not cover the whole program area. Therefor you have to first set bits in PCLATH to complete a full adress. The range of goto and call is called a page (2K area). There is no other physical limit; the program area is continuous. So you have to make sure you tell the assembler (using org command) to locate your program, and then ypu have to write code to change PCLATH when appropriate. You only have to change PCLATH if you jump to another page, and dont forget to change back when return!! Reading tables using retlw you jump using "addwf PCL" to set the low 8 bits of PC, and you have to make sure to set/have the whole PCLATH to form the upper adress first. Download a .pdf file from microchip Then use Acrobat reader find command to look for "page" or "tables", or PCLATH, or... /Morgan / Morgan Olsson, MORGANS REGLERTEKNIK, SE-277 35 KIVIK, Sweden \ \ mrt@iname.com, ph: +46 (0)414 70741; fax +46 (0)414 70331 /