From C to arduino


Arduino uses C (or C++ anyway). Can you rephrase your requirements?

I would recommend you look at the Reference page (right up there in the green nav bar).

There you will find references to all the fundamental operations, telling you what they do.

You would know what sort of things those statements in 8051 mean (I sure don't. That all looks like assembler with C-ish syntax to me). It should be fairly easy for anyone familiar enough with 8051 code to translate to C/C++.

Most operations have been abstracted to fit well with C/C++. For example, to write a bit to a port pin, you would use the Arduino pin number (not the CPU pin number), set it to OUTPUT, and write to it this way...

const int relayPin = 3;  // lets you use the name instead of a number

    pinMode relayPin(OUTPUT);  // choices are OUTPUT, INPUT, and INPUT_PULLUP
    digitalWrite(relayPin, HIGH);  /// or 1, because HIGH is defines as 1 in the headers

Welcome to the Arduino world! I think you'll like it.

Looks like 1) fiddle with the watchdog timer. An Arduino has a watchdog timer, but it is disabled by default, so you may not need this. 2) initialize the timer. An Arduino has three timers, one of which is pre-configured to provide the millis() and delay() functions, and all of which are used to generate PWM outputs on the 6 pins capable of doing "analogWrite()" Depending on what you use the timer for, you may not need to do any configuration on Arduino. 3) PORT IO init. Looks like it configures pin direction and such. In the Arduino environment, you normally deal with individual pins rather than full ports. See pinMode(). I don't know whether that will match your requirements. Note that this looks like it configures three ports worth of pins, and and Arduino doesn't HAVE that many pins. 4) Interrupts init. I dunno; probably for the timer? In which case, see (2) - may not be necessary. Arduino also initializes the serial port for you, using an interrupt-based scheme. So if this were for serial port support, it might not be needed either...