-
16F819 serin
I am attempting to communicate between 2 pics. I can send data OK
but cannot seem to receive the serial data in to the pic. I can read the data
with a serial input lcd. I have only attempted to send a single byte 128 to 255. Have any suggestions?
INCLUDE "modedefs.bas"
DEFINE OSC 8
DEFINE CHAR_PACING 500
OSCcon = $70 ' config 8mhz
SO CON 6 ' Define serial output pin.
SI CON 1 ' Define serial input pin.
F VAR BYTE
Output PORTB.0 'FDOT Out
Input PORTB.1 'Serial In
Output PORTB.2 'C1 Relay
Output PORTB.3 'PWM Output
Input PORTB.4 'status LED
Output PORTB.5 'H Relay
Output PORTB.6 'Serial Out
Output PORTB.7 'C2 Relay
PB = $ff
'TRISA = %11111111
'TRISB = %00000011
'Poke PORTB, %00000000 ' Initialize PortB
'Poke PORTA, %00000000 ' Initialize PortA
Pause 2000
loop:
SerIn SI,t9600,F ' input character
SerOut SO,t9600,[I,148,#F]
Pause 500
GoTo loop
-
Have you tried serin N9600 instead of T9600? When you receive directly from a computers serial port you need to use inverted (N), and a PC serial port sends out true, so I believe the same should be true for communication between two micros. You need to send in true and receive in inverted.
-
I have tried T9600, N9600, OT9600, ON9600.
I tested the B1 input energizing a digital output and that works.
I tried serin on B4 and it doesn't seem to work either.
I'm stuck
-
looks like a faulty one since RB4 is multiplexed with the MSSP and it's disable at start-up...
On wich pin the other PIC send the data???
RA.4??? If so is there any pull-up resistor attach to??
any on PORTA??? if so, is all analog stuff are disable???