So what is exactly your problem? Writing a PID controller in general? Or writing a piece of code with CodevisionAVR? A starting point is the attached application note by Atmel (the code can be downloaded on Atmel's site, but I think it is for AVRStudio).