i am doing my final year project based on the 80c51 processor I am forced to convert a code written for a pic16f87x to a p89c51rd2. 1.i am having a hard time converting the paging in the pic and understanding registers related to paging like Pclath and PCL and PCH 2. what does HIGH(label1) do in the following code and what can i do in 8051 label1 movlw HIGH(label1) ;***pre-load PCLATH*** movwf PCLATH movf Index2, W; index2 is a byte addwf PCL, F dt "Set System Time %" ;% indicates end of table 3.what can i do with these kind of instruction BTFSS status,z bcf bit1; bit1 is a bit definition
8051 vs PIC
Started by ●June 4, 2007
Reply by ●June 4, 20072007-06-04
fazt wrote:> i am doing my final year project based on the 80c51 processor > I am forced to convert a code written for a pic16f87x to a p89c51rd2. > 1.i am having a hard time converting the paging in the pic and > understanding registers related to paging like Pclath and PCL and > PCH > 2. what does HIGH(label1) do in the following code and what can i do in > 8051 > label1 > movlw HIGH(label1) ;***pre-load PCLATH*** > movwf PCLATH > movf Index2, W; index2 is a byte > addwf PCL, F > dt "Set System Time %" ;% indicates end of table > 3.what can i do with these kind of instruction > BTFSS status,z > bcf bit1; bit1 is a bit definition > >You need to understand WHY paging is necessary in the PIC and not in the 8051. Then you will have a good final year project. donald
Reply by ●June 4, 20072007-06-04
fazt wrote:> i am doing my final year project based on the 80c51 processor > I am forced to convert a code written for a pic16f87x to a p89c51rd2. > 1.i am having a hard time converting the paging in the pic and > understanding registers related to paging like Pclath and PCL and > PCHcode memory in 8051 isn't paged. is a straight 64K, usually you don't have to worry about it> 2. what does HIGH(label1) do in the following code and what can i do in > 8051 > label1 > movlw HIGH(label1) ;***pre-load PCLATH*** > movwf PCLATH > movf Index2, W; index2 is a byte > addwf PCL, F > dt "Set System Time %" ;% indicates end of tableHIGH(label) should return the high byte of a 16 bit quantity, LOW(label) return le low byte of a 16 bit quantity, they are assembler directive again is not usefull in this context for 8051 code, PCLATH have no direct equivalent in 8051 the code memory is accessed trough special opcode in 8051: movc a,@a+dptr> 3.what can i do with these kind of instruction > BTFSS status,z > bcf bit1; bit1 is a bit definition > >as a final note: I think is not a good choice try a one-to-one conversion from pic assembler to 8051 a better choice is to convert the 'algorithm' only
Reply by ●June 4, 20072007-06-04
On 04/06/2007 mmm wrote:> fazt wrote: > > i am doing my final year project based on the 80c51 processor > > I am forced to convert a code written for a pic16f87x to a > > p89c51rd2. 1.i am having a hard time converting the paging in > > the pic and understanding registers related to paging like > > Pclath and PCL and PCH > > code memory in 8051 isn't paged. is a straight 64K, usually you don't > have to worry about it > > > 2. what does HIGH(label1) do in the following code and what can i > > do in 8051 label1 > > movlw HIGH(label1) ;***pre-load PCLATH*** > > movwf PCLATH > > movf Index2, W; index2 is a byte > > addwf PCL, F dt "Set System Time %" ;% indicates end of table > > HIGH(label) should return the high byte of a 16 bit quantity, > LOW(label) return le low byte of a 16 bit quantity, they are > assembler directive > > again is not usefull in this context for 8051 code, PCLATH have no > direct equivalent in 8051 the code memory is accessed trough special > opcode in 8051: movc a,@a+dptr > > > > 3.what can i do with these kind of instruction > > BTFSS status,z > > bcf bit1; bit1 is a bit definition > > > > > > as a final note: I think is not a good choice try a one-to-one > conversion from pic assembler to 8051 a better choice is to convert > the 'algorithm' onlyAn even better choice is to translate the algorithm to 'C' and use an AVR. -- John B
Reply by ●June 4, 20072007-06-04
fazt wrote:> i am doing my final year project based on the 80c51 processor > I am forced to convert a code written for a pic16f87x to a p89c51rd2. > 1.i am having a hard time converting the paging in the pic and > understanding registers related to paging like Pclath and PCL and > PCH > 2. what does HIGH(label1) do in the following code and what can i do in > 8051 > label1 > movlw HIGH(label1) ;***pre-load PCLATH*** > movwf PCLATH > movf Index2, W; index2 is a byte > addwf PCL, F > dt "Set System Time %" ;% indicates end of tableThe dt pseudo-op apparently generates a table of retlw instructions. The end result is returning the selected character from the string, based on Index2. -- Thad
Reply by ●June 4, 20072007-06-04
On 04 Jun 2007 21:50:48 GMT, the renowned "John B" <spamj_baraclough@blockerzetnet.co.uk> wrote:>On 04/06/2007 mmm wrote: > >> fazt wrote: >> > i am doing my final year project based on the 80c51 processor >> > I am forced to convert a code written for a pic16f87x to a >> > p89c51rd2. 1.i am having a hard time converting the paging in >> > the pic and understanding registers related to paging like >> > Pclath and PCL and PCH >> >> code memory in 8051 isn't paged. is a straight 64K, usually you don't >> have to worry about it >> >> > 2. what does HIGH(label1) do in the following code and what can i >> > do in 8051 label1 >> > movlw HIGH(label1) ;***pre-load PCLATH*** >> > movwf PCLATH >> > movf Index2, W; index2 is a byte >> > addwf PCL, F dt "Set System Time %" ;% indicates end of table >> >> HIGH(label) should return the high byte of a 16 bit quantity, >> LOW(label) return le low byte of a 16 bit quantity, they are >> assembler directive >> >> again is not usefull in this context for 8051 code, PCLATH have no >> direct equivalent in 8051 the code memory is accessed trough special >> opcode in 8051: movc a,@a+dptr >> >> >> > 3.what can i do with these kind of instruction >> > BTFSS status,z >> > bcf bit1; bit1 is a bit definition >> > >> > >> >> as a final note: I think is not a good choice try a one-to-one >> conversion from pic assembler to 8051 a better choice is to convert >> the 'algorithm' only > >An even better choice is to translate the algorithm to 'C' and use an >AVR.Table lookup in low/midrange PICs is a dog's breakfast. You don't want to translate that steaming heap of code, you want to implement it differently for the 8051. Best regards, Spehro Pefhany -- "it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com
Reply by ●June 5, 20072007-06-05
Reply by ●June 5, 20072007-06-05
mmm wrote:> fazt wrote: >> i am doing my final year project based on the 80c51 processor >> I am forced to convert a code written for a pic16f87x to a p89c51rd2. >> 1.i am having a hard time converting the paging in the pic and >> understanding registers related to paging like Pclath and PCL and >> PCH > > code memory in 8051 isn't paged. is a straight 64K, usually you don't > have to worry about it > >> 2. what does HIGH(label1) do in the following code and what can i >> do in >> 8051 label1 >> movlw HIGH(label1) ;***pre-load PCLATH*** >> movwf PCLATH >> movf Index2, W; index2 is a byte >> addwf PCL, F dt "Set System Time %" ;% indicates end >> of table > > HIGH(label) should return the high byte of a 16 bit quantity, LOW(label) > return le low byte of a 16 bit quantity, they are assembler directive > > again is not usefull in this context for 8051 code, PCLATH have no > direct equivalent in 8051 > the code memory is accessed trough special opcode in 8051: > movc a,@a+dptr > > >> 3.what can i do with these kind of instruction >> BTFSS status,z >> bcf bit1; bit1 is a bit definition >> >> > > as a final note: I think is not a good choice try a one-to-one > conversion from pic assembler to 8051 a better choice is to convert the > 'algorithm' onlyI hope the comments are good. Read them and tranclate the ideas. CPU to CPU ASM translations are always hard. many cores are very different. Some concepts do not apply to both.
Reply by ●June 5, 20072007-06-05
"fazt" <fasilchan@gmail.com> wrote in message news:996dnZ_5_7TkZfnbnZ2dnUVZ_sWdnZ2d@giganews.com...> can any one tell me how to build took up tables in 8051s?If you are only doing your final year project Google may be too hard for you. Try Alta Vista using look up table 8051 I found http://www.8052.com/faq.phtml?FAQ=77 which explains more than you deserve !! Michael Kellett
Reply by ●June 5, 20072007-06-05
On Tue, 05 Jun 2007 00:45:29 -0500, the renowned "fazt" <fasilchan@gmail.com> wrote:>can any one tell me how to build took up tables in 8051s?see: MOVC Best regards, Spehro Pefhany -- "it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com