8051 vs PIC

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 an PCH 2. what does HIGH(label1) do in the following code and what can i do i 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

Reply to
fazt
Loading thread data ...

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 to
Donald

code memory in 8051 isn't paged. is a straight 64K, usually you don't have to worry about it

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

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 to
mmm

An even better choice is to translate the algorithm to 'C' and use an AVR.

--
John B
Reply to
John B

The 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 to
Thad Smith

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
 Click to see the full signature
Reply to
Spehro Pefhany

can any one tell me how to build took up tables in 8051s?

Reply to
fazt

I 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 to
Neil

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

formatting link

which explains more than you deserve !!

Michael Kellett

Reply to
MK

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
 Click to see the full signature
Reply to
Spehro Pefhany

What is a "took up table"?

--
 
 
 Click to see the full signature
Reply to
CBFalconer

Oh come now, has it really come to this? It's obvious what the chap means. If you really want to improve spelling on the group then start a campaign against misuse of you're and your and there, their and they're.

A simple typo like that does not warrant posting a message which wastes the very bandwidth and storage space you are trying to preserve in your other crusade.

Reply to
Tom Lucas

I was perfectly serious. It was not obvious from the context.

--
 
 
 Click to see the full signature
Reply to
CBFalconer

Perhaps it would have been more helpful to have drawn his attention to his/her lack of context even if, in this case, the context is not relevant. As you often say, each post must be able to stand by itself and the OP's does - it is just spelled incorrectly.

Reply to
Tom Lucas

HIGH refers to the high byte of the address. LOW refers to the low byte of an address.

The PIC is amazing value for money but it is an odd beast. I have used them since the mid 80's.

Reply to
Marra

not obvious that he meant "look up table" ??

What did you think he meant, "Toke up table" ?

Purposely top-posted to piss you off.

Reply to
microBlaze

microBlaze wrote: *** and top-posted - fixed ***

And all the other posters who observe reality.

--
 
 
 Click to see the full signature
Reply to
CBFalconer

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.