2 Pics working together

General discussion on mikroBasic PRO for PIC.
Post Reply
Author
Message
Treg
Posts: 1
Joined: 22 May 2020 15:36

2 Pics working together

#1 Post by Treg » 22 May 2020 15:54

Dear Forum,
I have a simple(?) problem.
Two PIC 18F46K22 are working on a LED curtain.
Each of the PICs handles 24 LED on PORT B, C and D.
The LED curtain is 48 LEDs all-in.
When started, the 48 LEDs are perfectly synchrinized.
However, after a few minutes, the two PICs are
not synchron anymore.
I use a very simple program code

program PIC_01
main:
TRISB = 0x00 ' Set PORTB direction to be output
TRISC = 0x00 ' Set PORTC direction to be output
TRISD = 0x00 ' Set PORTD direction to be output

LATB = 0x00 ' Turn OFF the LATB leds
LATC = 0x00 ' Turn OFF the LATC leds
LATD = 0x00 ' Turn OFF the LATD leds

while TRUE
PortB = 0x1
PortC = 0x0
PortD = 0x0
Delay_ms(2)
PortB = 0x2
PortC = 0x0
PortD = 0x0
Delay_ms(2)
...
(abt. 6.000 lines of similar data...)
...
PortB = 0x0
PortC = 0x0
PortD = 0x0
Delay_ms(2)
wend
end.

Both PICs have program-code of exactly the same length....
I wonder how to link the PICs, so that the LED curtain keeps synchron for hours...
The board, the PICs are installed on, are on basis of SPRUT's proposals and have 8Mhz oscillator.

Any proposals would help.

Many thanks in advance

Treg

Richie800
Posts: 50
Joined: 09 Jul 2007 00:31

Re: 2 Pics working together

#2 Post by Richie800 » 25 May 2020 14:44

You can make the pic respond to an outside input (interrupt) like an op-amp. This can be used to cause the pics to wait for a high (or low) input from the op-amp to flash the led's.

Post Reply

Return to “mikroBasic PRO for PIC General”