This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

interacting with a k6x8008 ram chip

hello everyone, I am reading some code on a system that connect the 8051 with an external ram chip but I have no idea what is going on with the code, I have been struggling on this for quite some time now, just want to see if anyone can point me to the right direction.

the first part i dun understand is how the ram is use

void k6x8008_writebyte (unsigned char hadd,unsigned char madd,unsigned char ladd,unsigned char indat)
{ RD = 1; WR = 1; k6x8008_laddress(ladd); k6x8008_maddress(madd); k6x8008_din(indat); k6x8008_din(indat); k6x8008_haddress(hadd); WR = 0; WR = 0; WR = 1; k6x8008_haddress(0x00); P0 = 0; WR = 1;
}

i don't understand what those ladd, madd or hadd means at all

on the main code this is the part that requires writing data to the ram...

iphadd=((subaddress&HADDBITS)/0x00010000);
ipmadd=((subaddress&MADDBITS)/0x00000100);
ipladd=((subaddress&LADDBITS)/0x00000001); k6x8008_writebyte(iphadd,ipmadd,ipladd+0x00,0xff);
k6x8008_writebyte(iphadd,ipmadd,ipladd+0x01,0xff);
k6x8008_writebyte(iphadd,ipmadd,ipladd+0x02,0xff);

why does the coder uses binary division?? and this might be abstract but im also not sure why he is writing 0xff to the ram in the part above

Parents
  • "when accessing a ram is it necessary to have the low, medium and high address?"

    A RAM chip - any RAM chip - requires a complete address. In your case, it appears that it takes 24 bits to make a complete address.

    Now, an 8051 is an 8-bit processor, isn't it?
    That means that it can only handle 8 bits at a time.

    Therefore, to handle anything bigger that 8 bits, it is going to have to do it one byte (8 bits) at a time.

    Obviously, a 24-bit address takes 3 bytes - which can conveniently be called "low", "medium" (or "middle"), and "high".

    "why did the previous developer set WR = 0 for two lines then set it back to 1?"

    In the RAM Datasheet, you should find some Timing Diagrams; these show how the various signals need to behave with respect to time - there you should be able to see how the various lines are required to go up & down...

Reply
  • "when accessing a ram is it necessary to have the low, medium and high address?"

    A RAM chip - any RAM chip - requires a complete address. In your case, it appears that it takes 24 bits to make a complete address.

    Now, an 8051 is an 8-bit processor, isn't it?
    That means that it can only handle 8 bits at a time.

    Therefore, to handle anything bigger that 8 bits, it is going to have to do it one byte (8 bits) at a time.

    Obviously, a 24-bit address takes 3 bytes - which can conveniently be called "low", "medium" (or "middle"), and "high".

    "why did the previous developer set WR = 0 for two lines then set it back to 1?"

    In the RAM Datasheet, you should find some Timing Diagrams; these show how the various signals need to behave with respect to time - there you should be able to see how the various lines are required to go up & down...

Children
No data