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
8051 vs PIC
Jun 04, 2007
16 Replies
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
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
An even better choice is to translate the algorithm to 'C' and use an AVR.
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
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
can any one tell me how to build took up tables in 8051s?
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.
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
see: MOVC
Best regards, Spehro Pefhany
-- "it's the network..." "The Journey is the reward" snipped-for-privacy@interlog.com Info for manufacturers:
formatting link
Embedded software/hardware/analog Info for designers:
formatting link
What is a "took up table"?
cbfalconer at maineline dot net
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.
I was perfectly serious. It was not obvious from the context.
cbfalconer at maineline dot net
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.
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.
not obvious that he meant "look up table" ??
What did you think he meant, "Toke up table" ?
Purposely top-posted to piss you off.
microBlaze wrote: *** and top-posted - fixed ***
And all the other posters who observe reality.
cbfalconer at maineline dot net
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required