/*Ampelsteuerung
mit Feldvariablen
Ampel04.ccp
*/
#include
<stdio.h>
#include
<reg517.h>
void
wait1ms(unsigned int time); //Prototyp Wartezeit
void main(void) //Anfang
Hauptprogramm
{
unsigned int
phase[10]={0xa4,0xb4,0x8c,0x94,0xa4,0x64,0x66,0x61,0xa1,0xa2};
unsigned int
timer[10]={5000,1000,5000,1500,3000,2000,1000,4000,1000,1500};
int i;
while(1)
{
for(i=0;i<10;i++)
{
P1=phase[i];
wait1ms(timer[i]);
}
}
}
void
wait1ms(unsigned int time) //Funktion Wartezeit
{
int k,i;
for(k=0;k<time;k++)
//Schleife Anzahl ms
{
for(i=0;i<480;i++); //Schleife läuft 1ms
}
}