if (pirVal = 1023); <<<<<<<< the ; should not be there as that effectively closes the IF statement,.
some remarks:
- Please use CTRL-T before posting code, this reformats your code a bit for readability
Keeping your code readable will give you more feedback as it makes - use [ code ] tags => # button above the smileys (you can modify your exiting post)