PDA

View Full Version : Using SEROUT and SERIN



acinorth
- 18th July 2011, 19:32
I have 2 PIC16F876 processors and I am trying to comunnicate serially between them. I need to send 3 nimbers. I have tried numerous configurations, but can not get a reliable transfeer. I get a variety ov numbers but not the values that I asigned to the variables I am using an LCD display as a test device simply to view the results. Whats wrong?


Display program
AX VAR BYTE
BX VAR BYTE
CX VAR BYTE

DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 1
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_RWREG PORTB
DEFINE LCD_RWBIT 2

pAUSE 500

LOOP1:
LCDOUT $FE,1
pause 2000
LCDOUT $FE,$80,"TEST"
pause 1000
SERIN PORTC.3,0,3500,LOOP1,["A"],#AX,#BX,#CX
LCDOUT $FE,$C0,#AX
LCDOUT $FE,$C0 + 4,#BX
LCDOUT $FE,$C0 + 8,#CX
PAUSE 3000
GOTO LOOP1

;Program for outputing the data


AX VAR BYTE
BX VAR BYTE
CX VAR BYTE
AX = 2
BX = 150
CX = 1
LOOP1:
SEROUT PORTC.4,0,[0,0,"A",#AX,#BX,#CX]
PAUSE 1000
GOTO LOOP1

mackrackit
- 20th July 2011, 12:33
Welcome to the forum.
It looks like you have SERIN mixed up with SERIN2. Take a close look at SERIN2 and SEROUT2 and use those commands.

Here is an example(s)
http://melabs.com/samples/PBP-mixed/ser2mod.htm