PDA

View Full Version : help about connecting 2 PICs



micro
- 31st December 2005, 16:09
i want to conect 2 PICs by using USART port
the transmitter one is pic16F84 and the reciever one is
pic16f877

for TX the codes are

INCLUDE "modedefs.bas"
trisb = %00000000
main:
serout portb.1,T9600, [8] ; send the number 8
goto main



for RX the codes are
b var byte

start :

hserin [b] ; recieve number 8 on the RX port

serout 1,2,[254,1]
pause 2
serout 1,2,[#b] ; view the number 8 on a serial LCD
pause 100
goto start

the problem is in the RX side i don't recieve the correct number
so what is wrong with codes ??

i used 2 pic16f877 ad i used HSEROUT and HSERIN and there is no
problem but i wanted to use different PICs this time
but i got wrong result

micro
- 1st January 2006, 14:52
i use now 2 pic16f84 to connect them serially by using the command
serout and serin, but there is something i would to ask about it

in the transmitter the codes is

trisb=0
serout 1,2,[%11111111]


in the reciever

trisa = 1
trisb= 0
b var word
serin porta.1,2,b
portb = b


i got the 1's bits in the other side but when i increase number of bits
in the transmitter about 10 bits i note some shifts in bits,
then 8 bits blocks transmitted one time
so if i want to transmit more bits should i arrange them in 8 bit blocks
and transmit them as 8 bits at a time and in the other side i rearrange them again ???