Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

FIFO RAM data 8051 in C keil ?

Status
Not open for further replies.

bianchi77

Advanced Member level 4
Joined
Jun 11, 2009
Messages
1,313
Helped
21
Reputation
44
Reaction score
20
Trophy points
1,318
Location
California
Activity points
9,442
Guys,

I have a variable like this :

unsigned char idata pat7[8] = {0xFF,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,};//T
unsigned char idata pat8[8] = {0xC0,0x00,0xC0,0xC0,0xC0,0xC1,0xFE,0x3C,};//j
unsigned char idata pat9[8] = {0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,};//i
unsigned char idata pat10[8] = {0x83,0x43,0x23,0x13,0x0F,0x13,0x23,0xC3,};//K

How can I do FIFO into RAM, so I can save memory for reusing ?

Thanks
 

Guys,

I have a variable like this :

unsigned char idata pat7[8] = {0xFF,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,};//T
unsigned char idata pat8[8] = {0xC0,0x00,0xC0,0xC0,0xC0,0xC1,0xFE,0x3C,};//j
unsigned char idata pat9[8] = {0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,};//i
unsigned char idata pat10[8] = {0x83,0x43,0x23,0x13,0x0F,0x13,0x23,0xC3,};//K

How can I do FIFO into RAM, so I can save memory for reusing ?

Thanks

Have a pointer pointed at the last location i.e. 8.
now u can access any of the data, copy it in a location and decrement the counter.
have a different pointer for each one of the array
 

Have a pointer pointed at the last location i.e. 8.
now u can access any of the data, copy it in a location and decrement the counter.
have a different pointer for each one of the array

Can you give me one example of pointer ?

For example I have :
unsigned char idata pat10[8] = {0x83,0x43,0x23,0x13,0x0F,0x13,0x23,0xC3,};//K

And then ?
unsigned char idata pat10[8] = {0x83,0x43,0x23,0x13,0x0F,0x13,0x23,0xC3,};//K ??
i[1] = pat10[0,8] ??
x = i[1];
for (x=8;x=0;x--);
 
Last edited:

Can you give me one example of pointer ?

For example I have :


And then ?
unsigned char idata pat10[8] = {0x83,0x43,0x23,0x13,0x0F,0x13,0x23,0xC3,};//K ??
i[1] = pat10[0,8] ??
x = i[1];
for (x=8;x=0;x--);

unsigned char idata pat10[8] = {0x83,0x43,0x23,0x13,0x0F,0x13,0x23,0xC3,};//this is correct

now imagine u want to take out 2 bytes of data at every instance an place it in 2 different variables 'a' and 'b' to use them somewhere.

x=8;
a=pat10[x]; // a gets the data 0xC3 and pointer is at 8th location
//now if u want to put remove data from 7th location,
x--; // pointer pointing at 7th location
b=pat10[x];


if you need to do it again and again for a specific function you can use the for loop in a desired manner decrementing or incrementing x as and when you take data or put in data

Hope you have understood
 

unsigned char idata pat10[8] = {0x83,0x43,0x23,0x13,0x0F,0x13,0x23,0xC3,};//this is correct

now imagine u want to take out 2 bytes of data at every instance an place it in 2 different variables 'a' and 'b' to use them somewhere.

x=8;
a=pat10[x]; // a gets the data 0xC3 and pointer is at 8th location
//now if u want to put remove data from 7th location,
x--; // pointer pointing at 7th location
b=pat10[x];


if you need to do it again and again for a specific function you can use the for loop in a desired manner decrementing or incrementing x as and when you take data or put in data

Hope you have understood
for(x=8;x=0;x--)
{
a=pat10[x]; // a gets the data 0xC3 and pointer is at 8th location
}

how can I put 'b' variable in that loop ?
a will be =
a = pat10[8] until....a = pat10[1], right ?

Thanks
 

for(x=8;x=0;x--)
{
a=pat10[x]; // a gets the data 0xC3 and pointer is at 8th location
}

how can I put 'b' variable in that loop ?
a will be =
a = pat10[8] until....a = pat10[1], right ?

Thanks
to put the b variable u can do this
for(x=8;x=0;x--)
{
a=pat10[x]; // a gets the data 0xC3 and pointer is at 8th location
x--;
b=pat10[x];// b gets the data of the 7th location,and in the next round a will get the data of the 6th location.
}
 

to put the b variable u can do this
for(x=8;x=0;x--)
{
a=pat10[x]; // a gets the data 0xC3 and pointer is at 8th location
x--;
b=pat10[x];// b gets the data of the 7th location,and in the next round a will get the data of the 6th location.
}

I see, that does the trick doesn't it :)
Thanks

---------- Post added at 23:26 ---------- Previous post was at 23:16 ----------

if I have pat0 until pat25 ?
for example :
.
.
unsigned char idata pat7[8] = {0xFF,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,};
unsigned char idata pat8[8] = {0xC0,0x00,0xC0,0xC0,0xC0,0xC1,0xFE,0x3C,};
.
.
How can I do FIFO ? create function and do one by one ?

Thank you my friend
 

i didnt get ur question..
do you want to extract the data from each and every array like..if u want data of 8th position u take all the data together from all arrays???
 

i didnt get ur question..
do you want to extract the data from each and every array like..if u want data of 8th position u take all the data together from all arrays???

I want to save memory RAM, do you know how to save memory with FIFO ?
 

If you can provide me with some more information then I may help you with this

I want to display a pattern in a loop but run out of memory,
unsigned char idata pat7[8] = {0xFF,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,};
unsigned char idata pat8[8] = {0xC0,0x00,0xC0,0xC0,0xC0,0xC1,0xFE,0x3C,};
.
.


void display(unsigned char pattern[])//, int num)
{
unsigned int cnt, col, row; //, num ;


row = 1;
//for (cnt = num*8 ; cnt < (num*8+8) ; cnt ++ ) //display pattern each character
for (cnt = 0 ; cnt < 8 ; cnt ++ ) //display pattern each character
{
P3 = ~pattern[cnt];
P1 = ~row;

delay_ms(30) ; // delay of 1 ms
row = row<<1;


}

row = 0x00;

display(pat7);
.
.
}

how can I use FIFO for this case ?

Thanks
 

I don't see the purpose of a FIFO in the present case. You'll preferably define patx[] arays as constant (ROM) data and supply a ROM (code) pointer to the display function.
 

I don't see the purpose of a FIFO in the present case. You'll preferably define patx[] arays as constant (ROM) data and supply a ROM (code) pointer to the display function.

how can I define those patterns in RAM and do FIFO ?

Thanks
 

An example with the character generator tables in ROM. Of course you can place in idata, if it has to be loaded at run-time. But usually, it won't, I presume.
Code:
unsigned char code pat7[8] = {0xFF,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,};
unsigned char code pat8[8] = {0xC0,0x00,0xC0,0xC0,0xC0,0xC1,0xFE,0x3C,};

unsigned char code *pp;
unsigned char a;

pp = &pat7[7];

for (i=0;i<8;i++)
  a = *pp--;
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top