Hast du dieInitialisierung gemacht?

$regfile = "8515def.dat"
$crystal = 3690000

Bei mir klappt dein Programm, LED4 -LED7 leuchten.