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
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 ...
ARDUINO MEGA2560
So the specific AVR documentation you require is here:
www.microchip.com/.../ATmega2560
See also:
www.arduino.cc/.../arduinoBoardMega2560