As a first advise try to use a pic which having Hardware Usart like 16F628 or 16F877. By the way you can use HSERIN HSEROUT commands which are working very well. I had written two program to establish a communication system between two pics. It is a pity that it was written in PBP but the commands are so similar and you can convert them easily from one to other.
The trick was to use the preambl signal first at the beginning of data package sent by TX before to start real comunication. I got this idea from one TX/RX producer. Anyhow, here, I give you the sample codes;
TX Section;
--------------
Serout2 OUTPIN,1646,[REP$AA\5,REP$00\5,REP$FF\5]
SerOut2 OUTPIN,1646,[("E"),("R"),DATAVAR]
SerOut2 OUTPIN,1646,[("E"),("R"),DATAVAR]
SerOut2 OUTPIN,1646,[("E"),("R"),DATAVAR]
SerOut2 OUTPIN,1646,[("E"),("R"),DATAVAR]
SerOut2 OUTPIN,1646,[("E"),("R"),DATAVAR]
SerOut2 OUTPIN,1646,[("E"),("R"),DATAVAR]
As you have seen on the first line I give the preambl signal by giving the following combinations;
$AA=%10101 $00=%00000 $FF=%11111
You have to give at least 5-6 times continuously the same data. It will help to RX section for catching one of them absolutely.
RX Section;
------------
SerIn2 INPUTPIN,1646,[WAIT ("ER"),DATAVAR]:TOTAL=TOTAL+1
The best speed which I found was 600 baud, especailly if you use 4 MHZ xtal.
You can try faster speeds also.
I put one variable as TOTAL to count how many times I am getting the DATAVAR to see how many times I am catching the serial DATA sent by TX section. I have seen that if I send 6 SEROUT commands (as 6 lines) I was catching 5 of them and sometimes even 6. It shows that the system is working very well.
I hope you can do somethings with these sample codes.
ERO
hi,
your code works exellent .. i tried to latch and momentry some relays...latch working exellent but momentry not working ...could you please explain some example ..how to ..i already posted twice regarding momenty funcion (RF Code).but i havnt got any reply.. plz help me out ..
Thanking you
Regards