Hello Rob,
Rob >>
My idea was to transfer the 8bit data via 8pins (wasteful I know)
So if I had 2 x 16F628 20Mhz one sampling using pulsein
The other reading rs232 data in and send out to an lcd.
The one sampling the pulse would set 8 pins high or low in BCD format.
<<
Here is a sample of working PIC to PIC that I use. It is extremely fast. You can modify it to fit you.
The logic beind it, is to take a decimal and send each digit to the other chip. Using only two pins. You can play with the timing and speed it up tremendously. I used a 675 talking to a 648A. Tell me what you think..
The transmit still has "Test" data in it (Redundancy Number=1234), and NUmber is overwritten when a ADC is done.
Plus there are a couple of other things that could be changed. But it should work like a champ.
Dwayne
Recieve part.........
TRISa=%00110000
TRISb=%00000000
Counter var byte
Counter2 var byte
Result var byte
Pause 500
Porta.0=0
Porta.7=0
Portb=13 'clear lcd
Porta.0=1
Pause 1
Porta.0=0
'Flashes LED
Porta.1=1
Pause 1000
Porta.1=0
Counter=0
Loop3
Counter2=0
Result=0
Loop2:
if Porta.4=0 then Loop2
Result.0=Porta.5
Result=Result << 1
kt:
if porta.4=1 then kt
Counter2=Counter2+1
if Counter2 < 4 then Loop2
Result=Result+48
Counter2=0
Porta.7=1
Portb=Result
Porta.0=1
Porta.0=0
Counter=Counter+1
if Counter=16 then
Porta.7=0
Portb=1 'clear lcd
Porta.0=1
Pause 1
Porta.0=0
Counter=0
endif
Pause 3
goto Loop3
end
Tranmit part...........
ANSEL=%00111000
CMCON=%00010111
TRISIO=%00011100
ADCON0=%00001100
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
counter var byte
counter2 var byte
Digloop var byte
Dignum var byte
Number var word
Number=1234
Loop:
GPIO.5=1
Pause 300
GPIO.5=0
Pause 300
if GPIO.2=0 then Loop
GPIO.0=0
ADCIN 3, number
number = number >> 6
For counter = 3 to 0 step -1
DigNum=number dig counter
for counter2= 1 to 4 step 1
GPIO.1=DigNum.3
GPIO.0=1
Pauseus 50
GPIO.0=0
Pauseus 500
DigNum = DigNum << 1
next counter2
Pause 10
Next counter
Goto Loop
End
Bookmarks