M
maha384
Guest
Ovaj Kodeks ne radi KADA mogu omogućiti WDT.I JA NE ZNAJU PROBLEM ILI KAKO Watchdog timer: RAD.# define AC PORTA.F1
# define VENTIL PORTA.F2
# define STARTER PORTA.F3
# define INPUT PORTB.F3
# define ALARM PORTB.F7
# define RESET PORTB.F6
# define odlaganja 1000
# define startup_prd 5
# define wait_prd 10
# define noload_prd 20
void main (void)
(
unsigned char n, x;
TMR0 = 0x00;
OPTION_REG = 0x0f;
TRISA = 0X02;
TRISB = 0x48;
VENTIL = 0;
STARTER = 0;
ALARM = 0;
čekanja:
ASM CLRWDT ();
VENTIL = 0;
STARTER = 0;
delay_ms (delay);
if (INPUT == 1) (Goto stanju
else (goto početak
početak:
ALARM = 0;
delay_ms (delay);
for (n = 0; n <3; n )
(
delay_ms (delay);
if (INPUT == 1) goto stanju;
VENTIL = 1;
STARTER = 1;
for (x = 0, x <startup_prd; x )
(
DELAY_MS (delay);
/ / ASM CLRWDT ();
if (INPUT == 1) goto stanju;
if (AC == 0) (STARTER = 0; goto normal
ASM CLRWDT) ();
VENTIL = 0;
STARTER = 0;
if (n == 2) (ALARM = 1; Goto alarm
delay_ms (delay);
if (INPUT == 1) goto stanju;
for (x = 0, x <wait_prd; x )
(
delay_ms (delay);
ASM CLRWDT ();
)
if (INPUT == 1) goto stanju;
)
normalna:
ASM CLRWDT ();
if (AC == 1) (ALARM = 1; VENTIL = 0; goto alarm
delay_ms (delay);
if (INPUT == 0) goto normal;
if (INPUT == 1) goto noload;
goto normal;
Alarm:
ASM CLRWDT ();
delay_ms (delay);
if (RESET == 0) (ALARM = 0; goto stanju
goto alarm;
noload:
for (n = 0; n <noload_prd; n )
(
delay_ms (delay);
ASM (CLRWDT;
)
if (INPUT == 0) goto normal;
VENTIL = 0;
goto stanju;
)
# define VENTIL PORTA.F2
# define STARTER PORTA.F3
# define INPUT PORTB.F3
# define ALARM PORTB.F7
# define RESET PORTB.F6
# define odlaganja 1000
# define startup_prd 5
# define wait_prd 10
# define noload_prd 20
void main (void)
(
unsigned char n, x;
TMR0 = 0x00;
OPTION_REG = 0x0f;
TRISA = 0X02;
TRISB = 0x48;
VENTIL = 0;
STARTER = 0;
ALARM = 0;
čekanja:
ASM CLRWDT ();
VENTIL = 0;
STARTER = 0;
delay_ms (delay);
if (INPUT == 1) (Goto stanju
else (goto početak
početak:
ALARM = 0;
delay_ms (delay);
for (n = 0; n <3; n )
(
delay_ms (delay);
if (INPUT == 1) goto stanju;
VENTIL = 1;
STARTER = 1;
for (x = 0, x <startup_prd; x )
(
DELAY_MS (delay);
/ / ASM CLRWDT ();
if (INPUT == 1) goto stanju;
if (AC == 0) (STARTER = 0; goto normal
ASM CLRWDT) ();
VENTIL = 0;
STARTER = 0;
if (n == 2) (ALARM = 1; Goto alarm
delay_ms (delay);
if (INPUT == 1) goto stanju;
for (x = 0, x <wait_prd; x )
(
delay_ms (delay);
ASM CLRWDT ();
)
if (INPUT == 1) goto stanju;
)
normalna:
ASM CLRWDT ();
if (AC == 1) (ALARM = 1; VENTIL = 0; goto alarm
delay_ms (delay);
if (INPUT == 0) goto normal;
if (INPUT == 1) goto noload;
goto normal;
Alarm:
ASM CLRWDT ();
delay_ms (delay);
if (RESET == 0) (ALARM = 0; goto stanju
goto alarm;
noload:
for (n = 0; n <noload_prd; n )
(
delay_ms (delay);
ASM (CLRWDT;
)
if (INPUT == 0) goto normal;
VENTIL = 0;
goto stanju;
)