XBee with PIC16F877A

Discussion in 'Embedded Systems and Microcontrollers' started by waseem1, Apr 10, 2010.

  1. waseem1

    Thread Starter New Member

    Mar 26, 2010
    7
    0
    In my project I used PIC 16F877A to send logic 1 to the XBee transmitter and XBee receiver will receive that signal from the transmitter. The PIC 16F877A which is connect to the XBee receiver will give some output when receive that logic one. unforcentely the circuit not working the program for transmitter shown below

    PROCESSOR P16F877A
    INCLUDE "P16F877A.INC"
    __CONFIG _XT_OSC & _WDT_OFF & _CP_OFF & _LVP_OFF & _PWRTE_ON
    ORG 0X00
    GOTO START
    ORG 0X04
    START:
    BANKSEL TRISB
    MOVLW 0X01
    MOVWF TRISB
    MOVLW B'00000100'
    MOVWF TXSTA
    MOVLW D'25'
    MOVWF SPBRG
    BSF TXSTA,5
    BANKSEL PORTB
    CLRF PORTB

    LOOP:
    BTFSs PORTB,0
    CALL SEND1
    GOTO LOOP
    SEND1:
    MOVLW 0X01
    MOVWF TXREG
    L2:
    BTFSS PIR1,TXIF
    GOTO L2
    RETURN
    END

    the program for receiver

    PROCESSOR 16F877A
    INCLUDE <P16F877A.INC>
    __CONFIG _XT_OSC & _WDT_OFF & _LVP_OFF & _PWRTE_ON & _CP_OFF
    SAVE EQU H'20'
    ORG 0X00
    GOTO START
    ORG 0X04
    START:
    BANKSEL TRISB
    MOVLW 0X02
    MOVWF TRISB
    BANKSEL TRISD
    MOVLW B'00000000'
    MOVWF TRISD

    MOVLW B'00000100'
    MOVWF TXSTA
    MOVLW D'25'
    MOVWF SPBRG
    BSF TXSTA,5
    BANKSEL PORTB
    CLRF PORTB

    BANKSEL RCSTA
    BSF RCSTA,SPEN
    LOOP:
    BTFSS PIR1,RCIF
    GOTO LOOP
    MOVF RCREG,W
    MOVWF SAVE
    BTFSS SAVE,1
    GOTO NEXT
    ;/*********************************
    BSF BORTD,0
    BSF BORTD,1
    BSF BORTD,3
    ;/*********************************
    NEXT:
    BTFSC SAVE,1
    GOTO LOOP
    ;*********************************
    BCF BORTD,0
    BCF BORTD,1
    BCF BORTD,3
    ;*********************************
    END
    can you help to solve my problem
     
  2. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    Do us a favor and edit your post putting your code in the CODE /CODE tags. It makes reading code much easier, and will help alot.
     
Loading...