How to build a look up table in Atmel 89c51?

Status
Not open for further replies.

mamhosney

Junior Member level 1
Joined
Jan 4, 2005
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
137
retlw const data

i want a topic or site explain how to build a look up table in atmel 89c51 pls reply me fast
 

Re: look up table (LUT)

in what language?
C, Assembler, ...

And when you have questions about microcontrollers, please post them in the Microcontrollers section!

lookuptables can be made like this in C (one of many possible ways)
Code:
const unsigned int MyLookupTable[] = { 0x0022, 0x8844, 0x8982, 0x8d94 }
MyLookupTable[1] will give you 0x8844

but please check where the compiler puts the const data (it can be in rom or in ram). Also check the size of an int for your compiler (most uC have a 16 bit integer but it can also be 32 bit like most PC's)

Antharax
 

look up table (LUT)

you can create an data array, which can make your program speed. This is a convenient method.
 

Re: look up table (LUT)

mamhosney said:
i want a topic or site explain how to build a look up table in atmel 89c51 pls reply me fast


lookup table can be easily built using array declaration.

you may need to consider a few more things such as: in ROM or RAM (i.e. is it updateable?), at which address (the address in some cases can help you access the table conveniently.)? ...
 

Re: look up table (LUT)

First you should tell us the function of your look-up table.
Then other will be easiear to help u.
 

Re: look up table (LUT)

thanks for all ,i have designed my LUT and it worked well
 

Re: look up table (LUT)

I don't know the site, but i suggest you learn instructions about :

1. label
2. movc a,@a+dptr
3. memory locations

It is usefull to built LUT.
 

Re: look up table (LUT)

If you want to make a LUT you can use Assembly language like the following :
assume you want to do LUT for sine wave generation , then you will call a subroutine that takes the required value of sine and moves it to the program counter register PCL then it will jump to certain address that corresponds to the called value then returns with literal value stored in the Working register ...

like that :
label :
..... ; here you will transfer the input value that you need to get its sin
movfw input
call sin
....

sin :
movwf PCL
retlw .1 ; scaled value of the sin output ...
retlw .2
retlw .3
retlw .4
.....

I hope that Helped you ...
If you needed anything else or didn't understand what i said .. please PM me ..
 

Re: look up table (LUT)

It is not 89c51 assembly language.
 

Re: look up table (LUT)

Badaruddin said:
It is not 89c51 assembly language.
i think it is PIC code, in assembly.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…