Help with Traffic light project (Xfer from HC11)

Well, i kind of need help with a small project of mine which i pretty much making 2 traffic lights. I have the hard ware setup already, and my code was initially for M68HC11 controller. It worked fine. Now for extra credit, my teacher asked me to try and move the same hardware to another controller. However, it seems some syntax is quite different so i need some help setting up properly. Im using a a 74Ls273 shift register to control the lights via a clock, and a single out put. Here is the code , edited to what i thought would work.

I hope someone could help , thanks. its due weds

the lights are setup as active high, in the order of Red Yellow Green, Red Yellow Green

int ledPin = 13;// LED connected to digital pin 13
int clkPin = 12; //Clock of shift register
int Sigout = 11; // Signal to D1 of register
unsigned char SO;

void setup()
{
  pinMode(ledPin, OUTPUT);   // sets the digital pin as output
  pinMode(clkPin, OUTPUT);   // sets the digital pin as output   
  pinMode(Sigout, OUTPUT);   // sets the digital pin as output
}

void loop()
{
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(1000);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(1000);  // waits for a second
 
         SO = 0x0C; 
      OutPutlight(SO);
      delay(5000);
             
             
      SO=0x0A;
      OutPutlight(SO);
      delay(2000);
                          
      SO = 0x21;
      OutPutlight(SO);
      delay(7000);       
             
      SO = 0x11;
      OutPutlight(SO);
      delay(2000);  
}

void OutPutlight(){
   int i;
   for(i=0; i<6; i++){
     x = SO;
     x = x<<4;
     x = x&0x10;
     if( x==0x10) {
       digitalWrite(Sigout, HIGH);
     }else{
       digitalWrite(Sigout, LOW);
     }
     
     SO = SO>>1;
     
     digitalWrite(clkPin, LOW);
     digitalWrite(clkPin, HIGH);
     digitalWrite(clkPin, LOW);
   }
}

Here is my Original working HC11 code

#include <hc11.h>
#include <stdio.h>
#define BIT6 0x40
#define HALFONESECCNT 122
#define FIFTY_NINE 59
#define TWENTY_THREE 23

int intrcnt, halfsecond, second;
int prev_second;
unsigned char SO; // signal out for reg. 00RY | GRYG
                                                       //MS bit LS bit
#pragma interrupt_handler rtisr

void rtisr(){
      intrcnt++;
      if (intrcnt>=HALFONESECCNT)
            {
            
            intrcnt=0;
            if(halfsecond==0)
                  {
                  halfsecond=1;
                  PORTD=PORTD|0x08;
                  }
                  
            else
                  {
                  halfsecond=0;
                  PORTD=PORTD&0xF7;
                  second++;
                  if(second>FIFTY_NINE)
                  {
                  second=0;
                  }
            }
      }
      TFLG2=0x40;
      }
      
      
void initialization(){
      *(unsigned char *)0xeb=0x7e;
      *(void(**)())0xec=rtisr;
      intrcnt=second=halfsecond=0;
      prev_second=0;
      
      TMSK2|=BIT6;
      asm("cli\n");
      DDRD = 0x08;
      }
      
      
void wait_1_second()
      {
      while(second==prev_second)
            {
            }
      prev_second=second;
      }      


void wait_M_sec(x1){
      int j;
      for(j= 0; j<x1; j++){
      
            wait_1_second();
      }
}



void OutPutlight(){
      int x, i;
      for (i = 0; i<6; i++){
            
            x=SO;
            x= x<<4;
            x= x&0x10;
            PORTA = PORTA&0xEF;
            PORTA = PORTA|x;
                  
            SO = SO>>1;
            
            PORTA = PORTA & 0xDF;
            PORTA = PORTA | 0x20;
            PORTA = PORTA & 0xDF;
            
                  
      
      }


}            

void main(){
      while(1){
             initialization();
             
             SO = 0x0C;
             OutPutlight(SO);
             wait_M_sec(5);
             
             if((PORTE&0x04)==0x00){
             wait_M_sec(7);
             }
             
             SO=0x0A;
             OutPutlight(SO);
             wait_M_sec(2);
                          
             SO = 0x21;
             OutPutlight(SO);
             wait_M_sec(7);
             
             if((PORTE&0x08)==0x00){
             wait_M_sec(7);
             }
             
             SO = 0x11;
             OutPutlight(SO);
             wait_M_sec(2);
             
                 
      }            
            
}

I got it to work, i jsut dont know how to make a concurrent led blinker for every second. normally i would just make a second infinite loop, but even if i make a new function with while(1) it wont work.