Boa tarde pessoal,meu colega enviou-me esse programa abaixo e tive varias duvidas na analise,pois estou estudando linguagem c pra pic(fabio pereira)à pouco tempo.
Gostaria que me explicassem os itens em vermelho com mais detlhes,se possivel for é claro!!
#include <16f628A.h>
#use delay(clock=20000000)
#fuses HS,NOWDT,NOLVP,NOBROWNOUT,PUT,NOMCLR
#use rs232(BAUD=9600,XMIT=pin_b2, RCV=pin_b1)
#define MAX_BUFFER 20. Foi criado uma matriz de 20 bits,elementos ou byte?[/color]
boolean CHEGOU_FRAME_ZIGBEE = false;
BYTE BufferRX[MAX_BUFFER]; O que significa esta expressão? ,BYTE não vi isso no livro a não ser byte(minusculo) e #BYTE
BYTE IndexBuf=0;
BYTE TamaPacoteZigBee=0;
long int AGUARDA = 250;
//---------------------------------------------------------------------------
//Interrupção de recebimento de caracter pela UART.
//---------------------------------------------------------------------------
#int_rda
void RS232_Recebe_Byte()
{
BufferRX[IndexBuf] = getc(); //Guarda o caracter no buffer.
if( (BufferRX[IndexBuf] == 0x7E) || (IndexBuf >= 22) ) // Pacote ZigBee válido.tambem não entendi
{
IndexBuf = 0;
memset(BufferRX,0x00,MAX_BUFFER); //Limpa Buffer.
}
if( IndexBuf == 2 ) //Posição do byte tamanho dos dados.
{
TamaPacoteZigBee = BufferRX[2]; //7E 00 XX ...
}
if( BufferRX[3] == 0x92 ) //API ID.
{
output_high(pin_b3); //Liga saída do Alarme.
AGUARDA = 250;
set_timer0(1);
}
IndexBuf++; //Indexador do buffer.
}
//}
//---------------------------------------------------------------------------
//PROGRAMA PRINCIPAL
//---------------------------------------------------------------------------
void main(void)
{
setup_timer_0(RTCC_INTERNAL | RTCC_DIV_64); //Pino-3 RA4/TOCKI
set_timer0(1); //OLD 131
enable_interrupts(GLOBAL | int_timer0);
enable_interrupts(int_rda); //Habilita interrupção de recebimento.
delay_ms(3000);
output_high(pin_b5);
delay_ms(3000);
output_low(pin_b3); //Saída do alarme desligada.
while(TRUE) //LOOP, Considera um loop mas não tem nada dentro das chaves após o while(TRUE)
{
}
}
DESDE JÁ AGRADEÇO-LHES