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

Parents
  • Most Arduinos use Atmel (now Microchip) AVR microcontrollers.

    You haven't mentioned what particular Arduino model you are using - so you will have to verify this for yourself.

    Then you will need to study the AVR documentation to understand what these AVR features do.

    Once you understand what these AVR features do, you can then program your P89v51rd2 to do the equivalent things.

    This is known as Porting.

    You will, of course, also need a good understanding of the P89v51rd2 ...

Reply
  • Most Arduinos use Atmel (now Microchip) AVR microcontrollers.

    You haven't mentioned what particular Arduino model you are using - so you will have to verify this for yourself.

    Then you will need to study the AVR documentation to understand what these AVR features do.

    Once you understand what these AVR features do, you can then program your P89v51rd2 to do the equivalent things.

    This is known as Porting.

    You will, of course, also need a good understanding of the P89v51rd2 ...

Children