![]() |
![]() |
![]() |
|
|
|||||||
| Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Hi,
I'm developing RF communication using two PIC18F2520s and melexis TX / RX ICs for a medical implant. Data transmission has been verified, as has reception up to the input pin of the RX PIC USART. My data is Manchester coded, as recommended, and I'm wondering how to synchronize the receiver PIC USART since standard serial start bit (long one followed by a transition to zero, or vice versa) cannot be implemented. The preamble we use is 0x55 three times (i.e. clock run 01010101 x3) followed by start byte 0x75. The problem is that in initial RX IC synchronization it often takes one or two bit toggles to receive data so the first bits of the preamble are often lost. The USART RCIF flag seems to go high at random and the data in the RCREG is not correct (most often 0x00). This even occurs when no data is transmitted, since digital noise is output from the RX IC. To some extent this can be minimized by monitoring the RX IC RSSI level and only looking at the RCREG when the RSSI level is above a certain threshold. However if I send only one data byte (or two Manchester encoded) and search the RCREG only for the start code 0x75 it seems to work, regardless of whether the bits of the preamble are lost or not. Its makes no sense that the USART knows where the 0x75 byte starts and ends if there is say 2 1/2 preamble bytes before it. This is a solution but obviously not optimum as preamble/start code would need to be sent for each data byte. Any help would be greatly appreciated. |
|
|
|
|
|
|
(permalink) |
|
Simply don't use the USART, it's not suitable for Manchester coding.
Check my tutorials which do RF comms not using the USART. |
|
|
|
|
|
|
(permalink) |
|
Hey, thanks but I have checked out you site before. The intorduction to (tutorial 12) seems quite detailed but are there specifics of 12.1 etc?? Seems only to specify what is required to do tutorial
Also I'm using MPLAB and unfortunately IT here would probably not allow a third party development tool to be installed, is this required?? |
|
|
|
|
|
|
(permalink) | ||
|
Quote:
Quote:
|
|||
|
|
|
|
|
(permalink) |
|
Oh I missed the asm file downloads... pretty important I guess.
I'm gonna jump straight into 12.2, and maybe leave the transmitter as is... using the USART, as it is working fine. Thought I would need to use your WinPicProg to do the tutorials. Thanks! |
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) |
|
Ok thanks for saving the frustration later on!.
Theres the problem that Microchip dont fully explain the USART operation... only a simple functional explanation is given.... A complete comms overhaul it is then! I'll let you know how it works out! Thanks Again! |
|
|
|
|
|
|
(permalink) |
|
is this really the simpler solution??? The complexity has me overwheled... im finding the code impossible to debug when I integrate it into my own program
|
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) |
|
Ok maybe i did a little too much too soon, I read through the code and took a reasonable understanding and then integrated it into my asm files, making changes (which should not have affected fuctionality).
Now Ive gone right back to basics, on tutorial 12.1 making only the changes necessary to operate on the PIC18F2520 (ie header, include, my config, changed I/Os, FSR,INDF -> FSR1,INDF1, removed bank selection RP0/RP1, changes rlf ->rlcf, clrw -> clrf w) No other changes. TX: No problems, 20 header 1's generated followed by 0. RX: Almost always the header detected is too short, (usually bitcnt=7), and sometimes I get no mid frame transition errors. From a comms point of view my setup is pretty ideal, lamda/4 antenna in close proximity, 19 of the 20 start bits appear clearly at the PIC input. I have even removed the RF and placed a wire between the two micros, the errors are the same Last edited by col_implant; 15th November 2007 at 03:07 PM. |
|
|
|
|
|
|
(permalink) |
|
From a comms point of view you could ignore the tx/rx modules, and just connect them pin to pin. Have you modded the code for the clock rate you're using?, as far as I remember it's written for 4MHz?.
|
|
|
|
|
|
|
(permalink) |
|
Yea thats what I have done now.
I'm also using a 4MHz crystal so no mods required there |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| High ADC sampling rate PIC, 18F needed? | bananasiong | Micro Controllers | 24 | 28th October 2007 12:13 PM |
| URGENT!! 16F877 & USART & Interrupt & Recieve Problem | DaMieN | Micro Controllers | 0 | 18th September 2007 10:52 AM |
| Rf Pic | flemmard | Electronic Projects Design/Ideas/Reviews | 1 | 9th September 2007 08:33 PM |
| 16F628A USART - Sync receive mode | kenmac | Micro Controllers | 14 | 6th June 2006 09:16 PM |
| Send and Receive In PIC16F873 With USART | lht782002 | Micro Controllers | 0 | 26th April 2006 03:21 PM |