arash
Active Member
Offline
Posts: 111
Thank You
-Given: 2
-Receive: 0
|
|
« on: December 06, 2005, 03:17:24 15:17 » |
|
Hi all Do you know What is manchester code. (It is in Mikrobasic)
|
|
|
Logged
|
|
|
|
Wizpic
Global Moderator
Hero Member
Offline
Posts: 1203
Thank You
-Given: 554
-Receive: 409
|
|
« Reply #1 on: December 06, 2005, 07:35:18 19:35 » |
|
it's what you use sending data over RF, the transmitter side encodes it sends it over RF and the reciever decodes it. it's the best way to do RF. RF stuff is very hard to do the best thing you can do if you want to find out more is go here http://www.picbasic.co.uk/forum/showthread.php?t=198&highlight=manchester theres quite a bit of stuff on it. the trouble you will find is that prople who got it working will not share as they can work very hard to get it working and error free hope this helps wizpic
|
|
|
Logged
|
When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
|
|
|
meax98
Active Member
Offline
Posts: 167
Thank You
-Given: 1376
-Receive: 52
|
|
« Reply #2 on: December 07, 2005, 09:35:55 09:35 » |
|
Manchester code is a code in which data and clock signals are combined to form a single selfsynchronizing data stream. Each encoded bit contains a transition at the midpoint of a bit period, the direction of transition determines whether the bit is a 0 or a 1. Second half is the true bit value and the first half is the complement of the true bit value. Manchester RF_Send_Byte format St1 St2 Ctr B7 B6 B5 B4 B3 B2 B1 B0 [/size][/font]
|
|
|
Logged
|
|
|
|
arash
Active Member
Offline
Posts: 111
Thank You
-Given: 2
-Receive: 0
|
|
« Reply #3 on: December 07, 2005, 11:44:46 11:44 » |
|
It realy hard to understand. Do you have a sample?
|
|
|
Logged
|
|
|
|
meax98
Active Member
Offline
Posts: 167
Thank You
-Given: 1376
-Receive: 52
|
|
« Reply #4 on: December 07, 2005, 01:13:43 13:13 » |
|
No, it's not hard. You are using mE mikroBasic, as I can see: This is "transmit" part: program RF_TX dim i as byte dim msg as string[20] main: msg = "mikroElektronika" PORTB = 0 ' Initialize port TRISB = %00001110 ClearBit(INTCON, GIE) ' Disable interrupts Man_Send_Init(PORTB) ' Initialize Manchester sender while TRUE Man_Send($0B) ' Send start marker Delay_ms(100) ' Wait for a while for i = 1 to Strlen(msg) Man_Send(msg) ' Send char Delay_ms(90) next i Man_Send($0E) ' Send end marker Delay_ms(1000) wend end. This is "receive" part: program RRX dim error, ErrorCount, temp as byte main: ErrorCount = 0 TRISB = 0 CMCON = 7 ' VRCON = 0 ' Uncomment the line for PIC16 Lcd_Init(PortB) ' Initialize LCD on PORTB Lcd_Cmd(LCD_CLEAR) Man_Receive_Config(PORTA,3) ' Configure and synchronize receiver while true Lcd_Cmd(LCD_FIRST_ROW) while true ' Wait for the start marker temp = Man_Receive(error) if temp = $0B then break end if ' We got the starting sequence if error then ' Exit so we do not loop forever break end if wend do temp = Man_Receive(error) ' Attempt byte receive if error = true then Lcd_Chr_Cp(63) ' ASCII for "?" Inc(ErrorCount) if ErrorCount > 20 then Man_Receive_Init(PORTA) ' alternative: ' temp = Man_Synchro ErrorCount = 0 end if else if temp <> $0E then ' Don't write the end marker on LCD Lcd_Chr_Cp(temp) end if Delay_ms(20) end if loop until temp = $0E ' Wait for the end marker wend end. Hardware: 2 x PIC16F877A (with OSC 4 MHz), pair of RX/TX modules - on TX module connect DATA_IN pin to RB0 of TX PIC - on RX module connect DATA_OUT pin to RD6 of RX PIC
|
|
« Last Edit: December 07, 2005, 01:18:59 13:18 by meax98 »
|
Logged
|
|
|
|
arash
Active Member
Offline
Posts: 111
Thank You
-Given: 2
-Receive: 0
|
|
« Reply #5 on: December 07, 2005, 06:30:16 18:30 » |
|
Thank you.this can realy help me.But what is the hardware.Sorry i'm a little dimwit..
|
|
|
Logged
|
|
|
|
Wizpic
Global Moderator
Hero Member
Offline
Posts: 1203
Thank You
-Given: 554
-Receive: 409
|
|
« Reply #6 on: December 08, 2005, 12:11:21 00:11 » |
|
your 2 pic chips and RF unit that make it work with out these you may aswell not bother writing code it would be like you trying to drive a toy car wizpic
|
|
|
Logged
|
When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
|
|
|
arash
Active Member
Offline
Posts: 111
Thank You
-Given: 2
-Receive: 0
|
|
« Reply #7 on: December 08, 2005, 05:52:16 05:52 » |
|
What's the detail of RT4 and RR3?
|
|
|
Logged
|
|
|
|
Parmin
Hero Member
Offline
Posts: 582
Thank You
-Given: 496
-Receive: 133
Very Wise (and grouchy) Old Man
|
|
« Reply #8 on: December 08, 2005, 07:56:40 07:56 » |
|
In my experience, no need to get too detail with these boards. They just works. Factory pretuned and pre aligned make these BFM (Bloody Fukn Magic) boards a breeze to use. Just treat the RF boards as component, why bother to find out whats inside a PIC chip? Just use them as the specs suggested. You could buy those or their similar variant from Mouser, Digikey, Australian Oatley Electronics etc. There should be datasheets from them seller's site. :p
|
|
|
Logged
|
If I have said something that offends you, please let me know, so I can say it again later.
|
|
|
meax98
Active Member
Offline
Posts: 167
Thank You
-Given: 1376
-Receive: 52
|
|
« Reply #9 on: December 08, 2005, 08:30:35 08:30 » |
|
Here is explanation for TX/RX modules.
|
|
|
Logged
|
|
|
|
arash
Active Member
Offline
Posts: 111
Thank You
-Given: 2
-Receive: 0
|
|
« Reply #10 on: December 08, 2005, 08:59:57 20:59 » |
|
What do you mean Parmin?I must connect an ant to the output pin.Is that enough?
|
|
|
Logged
|
|
|
|
Parmin
Hero Member
Offline
Posts: 582
Thank You
-Given: 496
-Receive: 133
Very Wise (and grouchy) Old Man
|
|
« Reply #11 on: December 09, 2005, 06:26:10 06:26 » |
|
Yup. Connect a 1/8 wavelength cable at the output and tadaaa...... Although 1/4 or 1/2 length give better distance. 1/8 wavelenth is about 180 mm err... 7 inch?
|
|
|
Logged
|
If I have said something that offends you, please let me know, so I can say it again later.
|
|
|
jugglerb
Guest
|
|
« Reply #12 on: December 09, 2005, 02:24:53 14:24 » |
|
if you happen to turn the tuning screw how easy is it to get these re-tuned? I moved mine - is the tuning vital or is this just a fine tune mechanism?
|
|
|
Logged
|
|
|
|
meax98
Active Member
Offline
Posts: 167
Thank You
-Given: 1376
-Receive: 52
|
|
« Reply #13 on: December 09, 2005, 03:44:50 15:44 » |
|
It's very easy to re-tune them. Make small circuit for TX part (very simple, button, TX module, something to produce data stream) and also for TX part (RX module, LED) and have fun. With that "tuning screw" you are "changing" channels.
|
|
« Last Edit: December 10, 2005, 02:36:21 14:36 by meax98 »
|
Logged
|
|
|
|
Parmin
Hero Member
Offline
Posts: 582
Thank You
-Given: 496
-Receive: 133
Very Wise (and grouchy) Old Man
|
|
« Reply #14 on: December 10, 2005, 12:25:31 00:25 » |
|
at 433 Mhz, a nudge would bring you up ur down a few hundred khz. Bad news. To re tune do as Meax98 said. Hookup an LED on output of the RX, then tx something out and tune till the LED is the brightest... should get ye within a few tens Khz. Unless you have a freq counter, you may not be able to better that. Make sure you use the original freq coz if you change them and have to replace them boards (coz it got zap or sum'pin'?) you would have to go to all the tuning drama again. Make sure you tune them with non metalic tool so the freq do not drift.
|
|
|
Logged
|
If I have said something that offends you, please let me know, so I can say it again later.
|
|
|
meax98
Active Member
Offline
Posts: 167
Thank You
-Given: 1376
-Receive: 52
|
|
« Reply #15 on: December 10, 2005, 02:35:28 14:35 » |
|
jugglerb, btw, why did you play with the "tuning screw"?. What did you try to achieve?
|
|
|
Logged
|
|
|
|
nileshhande
Junior Member
Offline
Posts: 70
Thank You
-Given: 23
-Receive: 5
|
|
« Reply #16 on: October 20, 2006, 06:54:02 18:54 » |
|
No, it's not hard. You are using mE mikroBasic, as I can see: This is "transmit" part: program RF_TX dim i as byte dim msg as string[20] main: msg = "mikroElektronika" PORTB = 0 ' Initialize port TRISB = %00001110 ClearBit(INTCON, GIE) ' Disable interrupts Man_Send_Init(PORTB) ' Initialize Manchester sender while TRUE Man_Send($0B) ' Send start marker Delay_ms(100) ' Wait for a while for i = 1 to Strlen(msg) Man_Send(msg) ' Send char Delay_ms(90) next i Man_Send($0E) ' Send end marker Delay_ms(1000) wend end. This is "receive" part: program RRX dim error, ErrorCount, temp as byte main: ErrorCount = 0 TRISB = 0 CMCON = 7 ' VRCON = 0 ' Uncomment the line for PIC16 Lcd_Init(PortB) ' Initialize LCD on PORTB Lcd_Cmd(LCD_CLEAR) Man_Receive_Config(PORTA,3) ' Configure and synchronize receiver while true Lcd_Cmd(LCD_FIRST_ROW) while true ' Wait for the start marker temp = Man_Receive(error) if temp = $0B then break end if ' We got the starting sequence if error then ' Exit so we do not loop forever break end if wend do temp = Man_Receive(error) ' Attempt byte receive if error = true then Lcd_Chr_Cp(63) ' ASCII for "?" Inc(ErrorCount) if ErrorCount > 20 then Man_Receive_Init(PORTA) ' alternative: ' temp = Man_Synchro ErrorCount = 0 end if else if temp <> $0E then ' Don't write the end marker on LCD Lcd_Chr_Cp(temp) end if Delay_ms(20) end if loop until temp = $0E ' Wait for the end marker wend end. Hardware: 2 x PIC16F877A (with OSC 4 MHz), pair of RX/TX modules - on TX module connect DATA_IN pin to RB0 of TX PIC - on RX module connect DATA_OUT pin to RD6 of RX PIC
hi, could you please explain above code for toggle bit and momentry ... THANKING YOU, WARM REGARDS,
|
|
|
Logged
|
|
|
|
arturo10422
Guest
|
|
« Reply #17 on: April 08, 2008, 11:28:26 11:28 » |
|
I need to know boud rate of data trasfer
|
|
|
Logged
|
|
|
|
billy77
Guest
|
|
« Reply #18 on: April 09, 2008, 12:00:30 12:00 » |
|
340 ~ 560 bps
|
|
|
Logged
|
|
|
|
tuvoj
Junior Member
Offline
Posts: 41
Thank You
-Given: 5
-Receive: 7
|
|
« Reply #19 on: April 13, 2008, 07:49:18 07:49 » |
|
Manchester encoding is a synchronous technique used alot in the early days of "PCs" (the 70's & 80's) by builders of offline storage interfaces like cassette tape and reel-to-reel mag devices, since it is relatively immune to single-bit error. Atari, IMSAI, SOL Technologies, Commodore, and Altair ALL had Manchester NRZ encoded storage devices... For more info read the page at: http://www.erg.abdn.ac.uk/users/gorry/course/phy-pages/man.htmlCheers-Tuvo Do Not Use h**p:// it is against the rules USE : >> http://www.erg.abdn.ac.uk/users/gorry/course/phy-pages/man.html
|
|
« Last Edit: April 14, 2008, 02:22:58 02:22 by tuvoj »
|
Logged
|
|
|
|
goslock
Newbie
Offline
Posts: 13
Thank You
-Given: 12
-Receive: 7
|
|
« Reply #20 on: April 14, 2008, 05:16:30 05:16 » |
|
it's what you use sending data over RF, the transmitter side encodes it sends it over RF and the reciever decodes it. it's the best way to do RF. RF stuff is very hard to do the best thing you can do if you want to find out more is go here http://www.picbasic.co.uk/forum/showthread.php?t=198&highlight=manchester theres quite a bit of stuff on it. the trouble you will find is that prople who got it working will not share as they can work very hard to get it working and error free hope this helps wizpic I think the best option to make the code manchester
|
|
|
Logged
|
|
|
|
Bitburner
Newbie
Offline
Posts: 10
Thank You
-Given: 0
-Receive: 10
|
|
« Reply #21 on: April 16, 2008, 06:45:29 06:45 » |
|
/shrug Manchester Encoding is certainly not as complicated as people seem to want to believe it is. Melanie quote's Manchester's simplicity in one easy paragraph Here is the secret of Manchester encoding/decoding in all it's simplicity... (in case any other reader wants to know why - it's to balance the data slicer in the receiver and help cancel out noise).
Encoding: 8 bit byte becomes 16 bits to transmit... zero's become "01" and ones become "10".
Decoding: 16 bits get deconstructed back to 8 bit byte... "01" gets turned back into a zero and "10" gets turned back into a one.
Example... you are sending byte $00 which is equal to %00000000... this get's turned into %0101010101010101.
Melanie Summary: - Each bit is transmitted in a fixed time (the "period").
- A 0 is expressed by a low-to-high transition, a 1 by high-to-low transition (according to G.E. Thomas' convention -- in the IEEE 802.3 convention, the reverse is true).
- The transitions which signify 0 or 1 occur at the midpoint of a period.
- Transitions at the start of a period are overhead and don't signify data.
Manchester code always has a transition at the middle of each bit period and may (depending on the information to be transmitted) have a transition at the start of the period also. The direction of the mid-bit transition indicates the data. Transitions at the period boundaries do not carry information. They exist only to place the signal in the correct state to allow the mid-bit transition. Although this allows the signal to be self-clocking, it doubles the bandwidth requirement compared to NRZ coding schemes
|
|
|
Logged
|
|
|
|
DINESHjp
Guest
|
|
« Reply #22 on: August 23, 2008, 02:25:22 02:25 » |
|
has someone tries the sample program of mikrobasic i think it wont work if anybody has successfully run that, plz share the experience
|
|
|
Logged
|
|
|
|
pickit2
Moderator
Hero Member
Offline
Posts: 4668
Thank You
-Given: 834
-Receive: 4322
There is no evidence that I muted SoNsIvRi
|
|
« Reply #23 on: August 23, 2008, 08:12:49 20:12 » |
|
has someone tries the sample program of mikrobasic i think it wont work if anybody has successfully run that, plz share the experience
If you had read Wizpic's link, http://www.sonsivri.com/forum/index.php?topic=480.msg2121#msg2121 it shows error in posted code. and you will find working code, that only needs a small amount of work, to get up to speed with manchester code. Melanie has posted a load of working code. they even call it Melbasic [sic] after her
|
|
|
Logged
|
Note: I stoped Muteing bad members OK I now put thier account in sleep mode
|
|
|
cooperharris
Junior Member
Offline
Posts: 90
Thank You
-Given: 72
-Receive: 22
|
|
« Reply #24 on: August 23, 2008, 08:34:17 20:34 » |
|
has someone implemented in FLOWCODE?, let me know how we could do this in that program .thanks ahead
|
|
|
Logged
|
|
|
|
|