How to solve ERROR Xst:528 in ISE?
You are assigning the cnt_## signals in more than one always block. This is not allowed and results in a multiple driver error.

The code in question

always @(posedge clk)                   
    if(rst) begin               
        state = S0;         
        cnt_12 = 5'd20;         
        cnt_23 = 3'd5;          
        cnt_34 = 5'd25;         
        cnt_40 = 3'd5;          
    end else                
        state = state_n;            

always @(negedge clk) 


Always put begin and end around things - even if strictly not necessary. It makes things far clearer and stops mistakes like this. 

always @(posedge clk) begin                 
    if(rst) begin               
        state = S0;         
        cnt_12 = 5'd20;         
        cnt_23 = 3'd5;          
        cnt_34 = 5'd25;         
        cnt_40 = 3'd5;          
    end else begin              
        state = state_n;            
    end
end

always @(negedge clk) begin
...
        cnt_12 = 5'd20;
...
end


Notice how the variable exists in two always blocks? This is never allowed.

You are also not allowed to clock a register with both a negative edge and a positive edge. Dual-Edge flip-flops do not exist is most FPGAs.