I have two pic chips hooked together between B.5 on a 16f876 (sender) and
B.5 on a 16f877 (receiver). I have a 2k2 resistor between the two at the
16f876 (sender) side. The 16f876 (sender) line is normally low and turns to
high to signal it is done. The 16f877 is seeing faulse signals from the
16f876 that the 16f876 is not sending, I think just line noise? Can I just
use a pulldown 10k resistor on the 16f877 side?
How long is the connection? If it is less than a few feet it is
probably not line noise. Why is the 2k2 resistor there? Are both chips
running off of the same supply voltage and ground? Is the transmitter
pulling the high and low, not just letting it go high impedance?
One quick thing to try: put a small cap from the data line to ground.
This will reduce transients, but will delay the signals by R*C.
> I have two pic chips hooked together between B.5 on a 16f876 (sender) and
> B.5 on a 16f877 (receiver). I have a 2k2 resistor between the two at the
> 16f876 (sender) side. The 16f876 (sender) line is normally low and turns
to
> high to signal it is done. The 16f877 is seeing faulse signals from the
> 16f876 that the 16f876 is not sending, I think just line noise? Can I just
> use a pulldown 10k resistor on the 16f877 side?
Are the two PICs on the same board? If so, just wire the pins together
directly.
Ok let me get this correct, as I messed up original message. Too long at
this.
I am using a 16f877 to control 6 16f876. All within 14inches
This is Ports on 16f877 (Master)
| C.0 -------- Triggers PicBoard #1 | B.0 --------
Busy Line from PicBoard #1
| C.1 -------- Triggers PicBoard #2 | B.1 --------
Busy Line from PicBoard #2
| C.2 -------- Triggers PicBoard #3 | B.2 --------
Busy Line from PicBoard #3
| C.3 -------- Triggers PicBoard #4 | B.3 --------
Busy Line from PicBoard #4
| C.4 -------- Triggers PicBoard #5 | B.4 --------
Busy Line from PicBoard #5
| C.5 -------- Triggers PicBoard #6 | B.5 --------
Busy Line from PicBoard #6
Now lets look at just the connection to PicBoard #1
(master)16f877 C.0 triggers (slave) B.0 16f876
(this activates slave board #1 when it goes low)
then for the slave to let master know if its busy or not
(slave) C.0 16f876 signals (master)16f877 B.0
(B.0=low means slaveboard#1 is busy)
(B.0=high means slave board#1 is ready)
I wrote a programs in Master to
Turn On PicBoard #1
Turn On PicBoard #2
Turn On PicBoard #3
Turn On PicBoard #4
Turn On PicBoard #5
Turn On PicBoard #6
Turn Off PicBoard #1
Turn Off PicBoard #2
Turn Off PicBoard #3
Turn Off PicBoard #4
Turn Off PicBoard #5
Turn Off PicBoard #6
using routines like
TV2 = 0
While TV2_done = 0
Wend
All the slaves are triggered by the Master but the Master does not wait for
the Slave busy line to go high. I swapped slave boards between #1 and #2
and still get the same results. So I
made a button and led setup to plug in each board to substitute Master.
Everything on board seems to work fine. When I trigger the slave it works
and the busy line turns on and off when it should. So now it seams to be my
MASTER picboard. So I hooked Master back up and watched all the busy/ready
lines and all lines goes low and high.
Here is the readings I get on the busy/ready line from the slave talking to
the master. It goes low showing busy and then goes back high when ready.
The connections between the pics are about 14inches. The line between the
slave to the master for busy/ready has a 220 ohm resistor at the slave end
(I said 2k2 last message...opps). This is just for zapp protection.
Is there something that might be making PortB (Input) from seeing the slaves
correct (except slave #1)
I thought using a 10k pulldown resistor might help the master see the low.
16f877(Master) <------------------------[ 220 ohm ]----< 16f876(Slave)
|
10k
|
GND
It seems the problem is in my master program. Somehow it does not see or
react to the _done lines going low. It does stop the second time it gets to
the same slave that did not send the ready (high) signal.
' - - - -SETUP PORTA for OUTPUT- - - - - - -
' used to control LEDs
' 6 bit bi-directional port, cmos output drivers (except pin4)
ADCON1 = 7 ' Set PORTA and PORTE to digital
TRISA = %00000000 ' set PortA for all output
PortA = %00000000 ' turn all lines on PortA OFF
Reverser_led var PORTA.0 ' Reverse LED
GrinderA_led var PORTA.1 ' Grinder A LED
GrinderB_led var PORTA.2 ' Grinder B LED
Pump_led var PORTA.3 ' Pump LED
' var PORTA.4 ' Not used < Open Drain Output
' var PORTA.5 ' Not used
' - - - -SETUP PORTB for INPUT- - - -
' used to read valve controllers
' 8 bit bi-directional port, TTL input
TRISB = %01111111 ' sparein, trig, emer on PORTB to input
Main_done var PORTB.0 ' Main Air Supply done line
Clamp_done var PORTB.1 ' Clamp done line
Index_done var PORTB.2 ' Index done line
Tilt_done var PORTB.3 ' Tilt done line
TV1_done var PORTB.4 ' Transverse1 done line
TV2_done var PORTB.5 ' Transverse2 done line
Counter_done var PORTB.6 ' Counter done line
' var PORTB.7 ' not used
' - - - -SETUP PORTC for OUTPUT- - - -
' used to trigger valve controllers
' 8 bit bi-directional port, TTL output
TRISC = %00000000 ' set PortC for all output
PortC = %00000000 ' turn off all portC
Main var PORTC.0 ' Main Air Supply Valve
Clamp var PORTC.1 ' Clamp Valve
Index var PORTC.2 ' Index Valve
Tilt var PORTC.3 ' Tilt Valve
TV1 var PORTC.4 ' Transverse1 Valve
TV2 var PORTC.5 ' Transverse2 Valve
Counter var PORTC.6 ' Subract from Mechanical Counter
' var PORTC.7 ' not used
' - - - -SETUP PORTD for OUTPUT - - - -
' used to control grinders and pump
' 8 bit bi-directional port, TTL output
' TRISD = %11110000 ' set PortD for 4 output & 4 input
TRISD = %00000000 'set all to output <---Remove Later ----<<<<
PortD = %00000000 ' turn off all portD
Reverser var PORTD.0 ' Reverse for grinderA
GrinderA var PORTD.1 ' Grinder A SSR
GrinderB var PORTD.2 ' Grinder B SSR
Pump var PORTD.3 ' Pump SSR
Program_button var PORTD.4 ' Program Button (start)
TV1_button var PORTD.5 ' GrinderA Motor Button
TV2_button var PORTD.6 ' GrinderB Motor Button
Pump_button var PORTD.7 ' Pump Button
' - - - -SETUP PORTE for OUTPUT- - - -
' 3 bit bi-directional port, TTL input
' set to digital with above ADCON1 = 7
TRISE = %00000111 ' set PortE for all input
PortE = %00000000 ' turn off all portE
chip_button1 var PORTE.0 ' not used
chip_button2 var PORTE.1 ' not used
auto_button var PORTE.2 ' not used
' - - - -SETUP VARIABLES- - - -
lasttilt var word ' Tracks where Tilt is
'--------------------------------------------------------
start: pause 2000 ' pause for AVC circuits to see master is
there