Need help adapting code written for ATMega32

I am running into a problem when I try to verify and compile this program. I am fairly new to the Arduino but I can kind of tell what is going on. I also know why I am getting this error, but I'm not sure how to fix it.

You can find the entire program here: http://sites.google.com/site/onewheeledselfbalancing/Home/links-to-other-self-balancing-projects/self-balancing-software

Sorry for the link, but it is a very large program.

The problematic Section is in the very beginning when Ports are declared. It uses 4 ports but the Arduino only has 3.

void InitPorts(void)

{

PORTC=0x00; //Port C pullups set to low (no output voltage) to begin with

DDRC=0xFF; //Port C pins all set as output via the port C direction register

DDRA=0x00; //all port A pins set as input

PORTA=0x00; //Port A input pullups set to low pullups

DDRD=0xFF; //Configure all port D pins as output as prerequisite for OCR1A (PinD5) and OCR1B (Pin D4)
//working properly

PORTB=0x00; //Port B pullups set to low (no output voltage) to begin with

DDRB=0xFF; //All port B pins set to output

}

/* IO:

I am using ATMega32 16MHz with external crystal clock. New planned pin arrangement to OSMC motor controller

PD5/OC1A ALI -> OSMC pin 6

PD4/OC1B BLI -> OSMC pin 8

PC1 Disable -> OSMC pin 4

PC2 BHI -> OSMC pin 7
PC3 AHI -> OSMC pin 5
PB2 Pulse to socket for connection to oscilloscope, one pulse per cycle of program

Inputs:

PA0/ADC0 accelerometer

PA1/ADC1 pitch rate gyro
PA2/ADC2 overallgain (via cutout switch) PA2
PA3/ADC3 Position lever pulled back position PA3
PA4/ADC4 "Throttle Pedal" control knob - controls how fast it accelerates when deliberately tipped
by rider PA4
PA5/ADC5 Position lever pushed forwards position PA5

*/

What do I need to do to fix this here and throughout the program? I will take any and every suggestion. Just please help.

There is a lot of low level code in that link so the port will not be easy. Why not have a search for similar segway type projects that are written using arduino code, I recall seeing a number of cool things that have been done along those lines that were reported on these forums.

Ok, I guess I'll have to figure out how to implement parts of this code in my own program. Wonderful. I'll still take suggestions as to how I can at least use ports to control the inputs and outputs, or how to revise the program to make it work. Anything helps.

There are a number if challenges in trying to port that code. You will need to understand how the hardware IO and timer ports are implemented on arduino (it does have the three digital ports but not all pins are available) The datasheet for the Arduino controller chip (ATmega328) has information you will need although you can find a brief overview of the ports here: Arduino Reference - Arduino Reference