newuser1
Newbie level 1
We have replaced the receiver modules in some of our receiver units but they are running at half the Baud Rate so the PIC firmware isn't decoding the manchester code properly. I've tried halving the timer speed and increasing the length of the phase accumulator to allow for larger pulses but havn't had any luck getting teh PIC to decode the signal. Is there simple way of decoding mancheser code but at a slower baud rate?
Below is some of the code in the PIC:
Below is some of the code in the PIC:
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 RfReceive ;show monitor screen... CALL UpdateDisplay ;start 10th second timer... MOVLW 10 MOVWF TenthsCntr,ACCESS MOVLW 60 MOVWF SecondsCntr,ACCESS MOVLW TENTH_SEC_LO MOVWF TMR1L,ACCESS MOVLW TENTH_SEC_HI MOVWF TMR1H,ACCESS BCF PIR1,TMR1IF,ACCESS BSF T1CON,TMR1ON,ACCESS ;set up the phase loop variables... CALL InitPhaseLoop PhaseLoop ;Loops around and back to here ;start phase accumulator timer MOVLW PHASE_ACC MOVWF TMR2,ACCESS ;enable timer 2 BCF PIR1,TMR2IF,ACCESS BSF T2CON,TMR2ON,ACCESS ;increment the phase accumulator... MOVF PhaseDelta,w,ACCESS ADDWF PhaseAcc,f,ACCESS ;test for roll-over of phase accumulator... BTFSS STATUS,C,ACCESS BRA CheckChange RollOver ;shift current sample to last sample RRCF RxIn,f,ACCESS RRCF RxInOld,f,ACCESS BCF RxIn,7,ACCESS ;test the input from the RF receiver... BTFSC RfSignalIn BSF RxIn,7,ACCESS ;are we in sync?... BTFSC PhaseInfo,0,ACCESS BRA InSync LookForSync MOVLW 0xC9 CPFSEQ RxIn,ACCESS GOTO CheckChange MOVLW 0xAA CPFSEQ RxInOld,ACCESS GOTO CheckChange FoundSync ;found a new sync character... BSF PhaseInfo,0,ACCESS ;set counters... MOVLW DATA_IN_SIZE MOVWF DataInCharCntr,ACCESS MOVLW 8 MOVWF DataInBitsCntr,ACCESS ;set up pointer... LFSR2 DataIn00 BRA CheckChange InSync ;we're in sync, transfer whole characters to input areas... DECFSZ DataInBitsCntr,f,ACCESS BRA CheckChange ;re-set bit counter MOVLW 8 MOVWF DataInBitsCntr,ACCESS ;check character is valid manchester... CALL DecodeManchester MOVWF ValidCheck,ACCESS BTFSC ValidCheck,7,ACCESS BRA PhaseLoopError ;invalid character... ;store character... MOVF ValidCheck,w,ACCESS MOVWF POSTINC2,ACCESS ;check for character numbers to trigger analogue aquisistion of RSSI CheckChange ;Check if input has changed... ;shift current sample to last sample MOVFF PhaseSample0,PhaseSample1 MOVBF RfSignalIn,PhaseSample0,0,ACCESS MOVF PhaseSample0,w,ACCESS XORWF PhaseSample1,w,ACCESS MOVWF PhaseTemp,ACCESS BTFSS PhaseTemp,0,ACCESS BRA PhaseLoopEnd ;not changed... ;input edge, re-set the accumulator BTFSS PhaseSample0,0,ACCESS BRA PhaseLoopEnd MOVLW PHASE_EDGE MOVWF PhaseAcc,ACCESS BRA PhaseLoopEnd PhaseLoopError CALL InitPhaseLoop BRA PhaseLoopWait PhaseLoopEnd ;we have a new message?... BTFSS PhaseInfo,1,ACCESS BRA CheckOneMin ;wait for the phase accumulator timer to elapse PhaseLoopWait BTFSS PIR1,TMR2IF,ACCESS BRA PhaseLoopWait BCF T2CON,TMR2ON,ACCESS ;clear the 'Packet In' LED DCFSNZ PacketInCntr,f,ACCESS BCF PacketInLed BRA PhaseLoop RfRecieve.End Return[/I] Any help anyone could give to point me in the right direction would be greatly appreciated. Thanks,