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

conversion of ARDUINO code to C code to be used in P89v51rd2

byte ReadRAM(int address)
{

  digitalWrite(Rdpin,HIGH);

  digitalWrite(ALE,LOW);
  digitalWrite(ALE,HIGH);

  DDRC=0xFF;
  DDRA=0xFF;
  PORTC=highByte(address);


  PORTA=lowByte(address);

  delayMicroseconds(5);

  digitalWrite(ALE,LOW);

  delayMicroseconds(5);

  DDRA  = 0x00;
  PORTA = 0xFF;

  digitalWrite(Rdpin,LOW);

  delayMicroseconds(5);

  z = PINA ;
  PORTA = 0x00;  //High-Z

  digitalWrite(Rdpin,HIGH);
  DDRC=0xFF;
  DDRA = 0xFF;
  return(z);
} // End of READ routine

This is a read routine which works well for arduino .Now i want to use it with P89v51rd2 controller.Plz help me with DDR ,PORT AND PIN FUNCTIONS.
I AM NOT ABLE TO FIND alternatives for them.
thankyou