Acionamento de reles sem fio.
Projeto completo feito em picbasic pro e Visual basic 6
@ DEVICE PIC16F628A, BOD_OFF
@ DEVICE pic16F628A, WDT_OFF
@ DEVICE pic16F628A, PWRT_OFF
@ DEVICE pic16F628A, PROTECT_OFF
@ DEVICE pic16F628A, MCLR_OFF
@ DEVICE pic16F628A, XT_OSC
@ DEVICE PIC16F628A, LVP_OFF
DEFINE OSC 4
RELE VAR BYTE
REL VAR BYTE
SYMBOL RX_IN = PORTA.0
SYMBOL TX_OUT = PORTA.1
TRISA = %01111111
PORTA = %01111111
TRISB = %11110000
PORTB = %11110000
RELE = 0
REL = 0
SEROUT2 TX_OUT,84,["PLACA DE RELE OK"]
PAUSE 500
PROG:
SERin2 RX_IN,84,[WAIT("CESAR"),RELE,REL]
IF RELE = "A" THEN RELE1
IF RELE = "B" THEN RELE2
IF RELE = "C" THEN RELE3
IF RELE = "D" THEN RELE4
GOTO PROG
RELE1:
IF REL = 1 THEN LIGAR1
LOW 0
GOTO PROG
LIGAR1:
HIGH 0
GOTO PROG
RELE2:
IF REL = 1 THEN LIGAR2
LOW 1
GOTO PROG
LIGAR2:
HIGH 1
GOTO PROG
RELE3:
IF REL = 1 THEN LIGAR3
LOW 2
GOTO PROG
LIGAR3:
HIGH 2
GOTO PROG
RELE4:
IF REL = 1 THEN LIGAR4
LOW 3
GOTO PROG
LIGAR4
HIGH 3
GOTO PROG
BAIXAR
Nenhum comentário:
Postar um comentário