;---------------------------------------------------------------------------
;Disable reception and transmition
banksel TXSTA
bcf TXSTA,TXEN
;banksel RCSTA
;bcf RCSTA,CREN
;-----------------------------------
Also I forget to say that I receive data that I send from one PIC to other but it is just blinking the problem.
@ericgibbs
Thank you for answering. I changed code for both PIC as you say, but it is still the same, it is still blinking both PORTA and PORTB . Are you shore that clearing bit CREN will clear the RCREG buffer ? I did not find that in the data sheet for 16f877.
list p=16f877A ; list directive to define processor
#include <p16f877A.inc> ; processor specific variable definitions
errorlevel -302, -207
org 00h
goto start
org 04h
;save working and status register
movwf W_Save
swapf STATUS,W
movwf STATUS_Save
;take data and put it on PORTB
banksel RCREG
movf RCREG,W
movwf PORTB
;restore working and status register
banksel W_Save
swapf STATUS_Save,W ; Restore Status and W
movwf STATUS ;
swapf W_Save,F ;
swapf W_Save,W ;
retfie
start
radix dec
cblock 20h
brojac,brojac1,podatak,aktiviraj_transmisiju,STATUS_Save,W_Save
endc
; setting TRIS/A/B/C
banksel TRISB
movlw 0ffh
movwf TRISA
movwf TRISC
movlw 00h
movwf TRISB
;Seting UART
movlw b'00000110' ; all analog pins = digital
movwf ADCON1
banksel SPBRG
movlw 0x0C
movwf SPBRG
movlw b'00100100'
movwf TXSTA
banksel RCSTA
movlw b'10010000'
movwf RCSTA
;Setting interrupts
banksel PIE1
bsf PIE1,RCIE
movlw b'11000000'
movwf INTCON
Main
call Trans ;call routine for sending data
call Pauza ;make a pause
goto Main ;all the time
Trans
banksel PORTA
movf PORTA,W
movwf TXREG
banksel TXSTA
WtHere btfss TXSTA,TRMT
goto WtHere
return
Pauza
movlw 50
movwf brojac1
mala_pauza_1
movlw 100
movwf brojac
mala_pauza
decfsz brojac,f
goto mala_pauza
decfsz brojac1,f
goto mala_pauza_1
return
end
before it and
ho pic2pic,
Downloaded your code, get back to you later.
Here is video capture of situation. Is not high quality. One can see LED on and LED off.
Is it possible to someone build the same circuit, to check if I am wrong. Its really simple.
One need :
2 -16f877
14 - LED and 14 resistors for LED (For PORTA and PORTB)
2 - chrystal
4 - 27 pF capacitors
Supply stable 5 V.
Just put LED and resistors on PORT/A/B. Connect what must one for PICs, set the program, connect two PICs . And that's it.
Hi @ericgibbs
Thank you. My supply voltage is stable 5 V. I don't put CONFIG bits in code because program for transmit HEX file from my computer to PIC overrides CONFIG bits set in code. I use WINPICPRO 1.91 and I set fuses always "POWER UP" and "BROWN OUT" as check other clear, and XT for oscillator. I never had any problems before.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?