/****************************************************************/
/*								*/
/* Testprogramm für GAL-Brenner					*/
/*								*/
/* Soft- and Hardware  copyright (c)1991			*/
/*	 by Christian Habermann					*/
/*	    Asamstr. 17						*/
/*	    8050 Freising (W-Germany)				*/
/*								*/
/*  cc GALerTest.c						*/
/*  as -n -c -d port.asm					*/
/*  ln GALerTest.o port.o -lc					*/
/*								*/
/****************************************************************/


#define		GAL16V8		1
#define		GAL20V8		2
#define		IC1		3
#define		IC3		0
#define		IC4		1
#define		IC5		2
#define		IC6		0
#define		IC7		1
#define		ON		1
#define		OFF		0


main()
{


 InitGALer();
 printf("Testprogramm für GAL-Brenner\n\n");
 printf("Bitte messen Sie alle angegebnen Spannung an der Textool-Fassung\n");
 printf("(die Fassung, in die Sie später die zu programmierenden GALs einsetzen) nach.\n");
 printf("In dieser Fassung darf sich jetzt noch KEIN GAL befinden!!!\n\n");

 printf("Jetzt darf an keinem Pin der Textool-Fassung eine Spannung anliegen.\n");
 printf("Außerdem soll die LED aus sein.\n");
 printf("WEITER MIT LINKER MAUSTASTE !!!\n\n");
 EnableOutput();
 WriteByte(0x00,IC3);
 WriteByte(0x00,IC4);
 WriteByte(0x00,IC5);
 WaitMouse();


 Delay(25L);
 printf("Jetzt soll die LED blinken\n");
 printf("WEITER MIT LINKER MAUSTASTE !!!\n\n");
#asm
loopuntilmouse:
#endasm
   LED(ON);
   Delay(10L);
#asm
 btst	#6,$bfe001
 beq.s	endofloop
#endasm
   LED(OFF);
   Delay(10L);
#asm
 btst	#6,$bfe001
 beq.s	endofloop
 bra loopuntilmouse
endofloop:
#endasm


 Delay(25L);
 printf("An Pin 24 sollten jetzt ca. +5V anliegen\n");
 printf("WEITER MIT LINKER MAUSTASTE !!!\n\n");
 SetGAL(GAL20V8);
 EnableVcc();
 WaitMouse();


 Delay(25L);
 printf("An Pin 22 sollten jetzt ebenfalls ca. +5V anliegen\n");
 printf("WEITER MIT LINKER MAUSTASTE !!!\n\n");
 DisableVcc();
 SetGAL(GAL16V8);
 EnableVcc();
 WaitMouse();


 Delay(25L);
 printf("Die +5V sollten wieder weg sein und dafür\n");
 printf("an Pin 2 +16.5V anliegen. (mit Spindeltrimmer auf 16.5 V einstellen)\n");
 printf("WEITER MIT LINKER MAUSTASTE !!!\n\n");
 DisableVcc();
 SetGAL(GAL20V8);
 VeditOn();
 EnableVEdit();
 WaitMouse();


 Delay(25L);
 printf("An Pin 2 sollten die +16.5V wieder weg sein und dafür\n");
 printf("an Pin 4 anliegen.\n");
 printf("WEITER MIT LINKER MAUSTASTE !!!\n\n");
 DisableVEdit();
 SetGAL(GAL16V8);
 EnableVEdit();
 WaitMouse();


 Delay(25L);
 printf("Jetzt sollte an allen Pins ca. +5V anliegen, außer an Pin 12\n");
 printf("WEITER MIT LINKER MAUSTASTE !!!\n\n");
 InitGALer();
 EnableOutput();
 WriteByte(0xff,IC3);
 WriteByte(0xff,IC4);
 WriteByte(0xff,IC5);
 WaitMouse();


 Delay(25L);
 printf("Jetzt sollten ab Pin 1 abwechselnd +5V,0V,+5V,0V usw. anliegen (ohne Pin 12)\n");
 printf("WEITER MIT LINKER MAUSTASTE !!!\n\n");
 SetGAL(GAL20V8);
 EnableVcc();
 WriteByte(0x55,IC3);
 WriteByte(0x55,IC4);
 WriteByte(0x55,IC5);
 WaitMouse();


 Delay(25L);
 printf("Jetzt das ganze invertiert (ohne Pin 12)\n");
 printf("WEITER MIT LINKER MAUSTASTE !!!\n\n");
 DisableVcc();
 WriteByte(0xaa,IC3);
 WriteByte(0xaa,IC4);
 WriteByte(0xaa,IC5);

 WaitMouse();
 DisableVcc();
 DisableOutput(); 
 printf("Wenn alle Spannung korrekt waren und Sie die Programmierspannung\n");
 printf("von 16.5V eingestellt haben (mit Spindeltrimmer R16) dann\n");
 printf("funktioniert die Hardware sehr wahrscheinlich fehlerfrei.\n");
 printf("Letzte Gewißheit bekommen Sie, wenn Sie probeweise einige GALs\n");
 printf("programmieren und anschließend austesten.\n");
}



WaitMouse()
{
#asm
loop	btst.b	#6,$bfe001
	bne.s	loop
#endasm
}




WaitForTimer()			/*dummy für port.asm*/
{
}


