Hi.
Using RF FSK modules with two 16F628, one way link. How may I sync the stream, I mean, send some preamble, like 8 x 0x55, and what?
The problem is that my code only work when i send the code twice.
TX code:
#include <16f628a.h>
#fuses INTRC_IO, WDT, PROTECT, NOBROWNOUT, NOMCLR, CPD, PUT , NOLVP
#use delay(clock=4000000, RESTART_WDT)
#use rs232(baud=2400, xmit=pin_b2, rcv=pin_b1, ERRORS)
#use fast_io(a)
#use fast_io(b)
#byte porta = 0x05
#byte portb = 0x06
#byte txsta = 0x98
#byte rcsta = 0x18
#byte pir1 = 0x0c
#byte pie1 = 0x8c
#bit txen = txsta.5
#bit spen = rcsta.7
#bit up=porta.3
#bit dw=porta.4
int page=0;
int aux_0=0;
int flag_0=0;
#bit deb=flag_0.0
void antideb()
{
aux_0++;
if(aux_0==0xff)deb=0;
}
void tx()
{
output_high(pin_b2);
spen=1;
delay_ms(5);
putc(0x55);
putc(0x55);
putc(0x55);
putc(0x55);
putc(0x55);
putc(0x55);
putc(0x10); // this is what I want, recognizes the 0x10 as unique address.
deb=1;
spen=0;
output_low(pin_b2);
}
Help.
Using RF FSK modules with two 16F628, one way link. How may I sync the stream, I mean, send some preamble, like 8 x 0x55, and what?
The problem is that my code only work when i send the code twice.
TX code:
#include <16f628a.h>
#fuses INTRC_IO, WDT, PROTECT, NOBROWNOUT, NOMCLR, CPD, PUT , NOLVP
#use delay(clock=4000000, RESTART_WDT)
#use rs232(baud=2400, xmit=pin_b2, rcv=pin_b1, ERRORS)
#use fast_io(a)
#use fast_io(b)
#byte porta = 0x05
#byte portb = 0x06
#byte txsta = 0x98
#byte rcsta = 0x18
#byte pir1 = 0x0c
#byte pie1 = 0x8c
#bit txen = txsta.5
#bit spen = rcsta.7
#bit up=porta.3
#bit dw=porta.4
int page=0;
int aux_0=0;
int flag_0=0;
#bit deb=flag_0.0
void antideb()
{
aux_0++;
if(aux_0==0xff)deb=0;
}
void tx()
{
output_high(pin_b2);
spen=1;
delay_ms(5);
putc(0x55);
putc(0x55);
putc(0x55);
putc(0x55);
putc(0x55);
putc(0x55);
putc(0x10); // this is what I want, recognizes the 0x10 as unique address.
deb=1;
spen=0;
output_low(pin_b2);
}
Help.