Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2024, 06:05:50 06:05


Login with username, password and session length


Pages: [1]
Print
Author Topic: TX and RX Code (picbasic) Reqd.  (Read 8281 times)
0 Members and 1 Guest are viewing this topic.
remromgab15
Newbie
*
Offline Offline

Posts: 22

Thank You
-Given: 2
-Receive: 6


« on: October 31, 2008, 01:43:05 01:43 »

I've have visited picbasic forum and found out about the TX and RX code by T!M. Unfortunately the code was not posted and given only to licensed user. For those who had a copy can you please send me a copy or post it here so that others can see it also.
Logged
strat
Newbie
*
Offline Offline

Posts: 12

Thank You
-Given: 11
-Receive: 0


« Reply #1 on: November 26, 2008, 01:51:54 13:51 »

What kind of TX and RX do you look for ?  If you explain your project you can get more help.
Logged
remromgab15
Newbie
*
Offline Offline

Posts: 22

Thank You
-Given: 2
-Receive: 6


« Reply #2 on: November 28, 2008, 08:27:48 08:27 »

What kind of TX and RX do you look for ?  If you explain your project you can get more help.

RF code created for proton user. It is like a manchester code that can be used as encoder decoder program. I plan to connect a PIC to an RF module.
Logged
Ikaros
Junior Member
**
Offline Offline

Posts: 83

Thank You
-Given: 422
-Receive: 48


« Reply #3 on: December 24, 2008, 08:22:18 08:22 »

have a look here:

For d=0 TO 7
IF v.0[d]=0 Then
encoded.0[d*2]=0
encoded.0[d*2+1]=1
Else
encoded.0[d*2]=1
encoded.0[d*2+1]=0
EndIF
Next

d: number of bits to encode (8 bits)
v: byte to BE encoded
encoded: WORD sized variable holding the encoded
byte v.

Note that the encoded value is double size always.
Logged
remromgab15
Newbie
*
Offline Offline

Posts: 22

Thank You
-Given: 2
-Receive: 6


« Reply #4 on: December 25, 2008, 12:25:14 12:25 »

Actually i'm looking for the error detection part of the code.
Logged
Ikaros
Junior Member
**
Offline Offline

Posts: 83

Thank You
-Given: 422
-Receive: 48


« Reply #5 on: December 26, 2008, 06:13:07 18:13 »

I guess you mean CRC or checsum?

For checksum just add in a word variable all the transmitted or received bytes and compare. For CRC it is a little more complicated.

You have to use a polynomial like the $1021. So put crc_pol as a constant to $1021.

Then use this:

crc_check:                  'Uses: i,j,crc,k
crc=0                        'Final result CRC or Zero
For i=0 TO k
    crc=(array*256)^crc
    For j=0 TO 7
        IF crc.15=0 Then mul1
        crc=(crc<<1):crc=crc^crc_pol
        GoTo next_j1
mul1:
        crc=crc<<1
next_j1:
    Next j
Next i
return

as a subroutine.

The input array will be k+1 in length.

Generally if you have an array[k+1] then the result will be in crc word variable. When you want to check you can call the crc subroutine for all the array+crc and the result should be 0 (zero)

Good luck
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC