After a long break I am working on an "old" project again.
The aim is to build a led powered map of the river Elbe and the Port of Hamburg with all the "traffic lights" on the waterways.
This means that some 450 LEDs have to powered by PICs and the light of each LED be transported by a separate fibreoptic…
All the leds are flashing according to the "real world" (e.g. one of the LEDs will have 3 short light flashes of less than a second each within a period of 9 seconds…). At the same time the LEDs shall not just be just switched on and switched off again, PWM is part of programming the PICs.
All of the above is already been taken care of, but one problem remains…
In some cases two lighthouses form a light "beam" that informs the captain of a ship that he is on the right track (rear and fore side) ...when the two lights are above the other.
In order to visualize these beams, in two cases more than 70 LEDs have to be installed. Each of the LEDs to be switched on four milliseconds after the other.
However, 70 LEDs means 3 PICs 18F46K22 to form such a light beam (as I only use the Ports B, C and D of each PIC as 24 x 40 mA = 0,96 A!).
After a few minutes, the three Pics are not synchronous any more… and the clear vision of the light beam is not existing anymore. So what I need is to synchronize the three Pics, for which all of the PORT A Input/Output Pins would generally be available.
I raised the question before and got the reply: use one pf the PICs as master; send a digital signal from the master to the other PICs and restart them by using an "interrupt".
The program code of all the PICs is very simple; however mathematically a nightmare; for 2000
rows it basically looks like:
.program Hamburger_Hafen_PIC_01
'PIC 0.1
'Port B Bein 0 Sommerflethwisch OF Weiss ISO 8s
'Port B Bein 1 Elbe 120 Rot Quick
'Port B Bein 2 Elbe 119 / HN1 Grün Quick
'Port B Bein 3 Mühlenberger Loch Weiss Quick
'Port B Bein 4 Este EZ3 / HN24 Grün Quick
'Port B Bein 5 Finkenwerder Tiefwasser 7B Weiss ISO 8s
'Port B Bein 6 EADS Startbahn Ost Weiss ISO 8s
'Port B Bein 7 Elbe 132 Rot Quick
'Port C Bein 0 Elbe 135 / KS 1 Gelb Quick
'Port C Bein 1 Einfahrt Köhlbrand Gelb Quick
'Port C Bein 2 Einfahrt Kohlenschiffhafen Gelb Quick
'Port C Bein 3 Köhlbrand KS 7 Grün ISO 8s
'Port C Bein 4 Sandauhafen Rot ISO 2s
'Port C Bein 5 Köhlbrand KS 6 Rot Quick
'Port C Bein 6 Vattenfall 2 Gelb Flash
'Port C Bein 7 Köhlbrand KS 8 / RST Rot Quick
'Port D Bein 0 Vattenfall KS 10 Gelb Flash
'Port D Bein 1 Altona HADAG Orange Quick
'Port D Bein 2
'Port D Bein 3
'Port D Bein 4
'Port D Bein 5
'Port D Bein 6
'Port D Bein 7
' Declarations section
main:
' Testing of all LEDs when the map is powered on
PortA = 0xFF
PortB = 0xFF
PortC = 0xFF
PortD = 0x00
TRISA = 0x00
TRISB = 0x00
TRISC = 0x00
TRISD = 0x00
delay_ms(100)
While TRUE
'regular loop
PortB = 0x03
PortC = 0xFF
PortD = 0x07
Delay_ms(4)
PortB = 0x03
PortC = 0xFF
PortD = 0x07
Delay_ms(4)
PortB = 0x03
PortC = 0xFF
PortD = 0x07
Delay_ms(4)
PortB = 0xFF
PortC = 0xFF
PortD = 0xFF
Delay_ms(4)
PortB = 0xFF
PortC = 0xFF
PortD = 0xFF
Delay_ms(4)
…
...
PortB = 0x0
PortC = 0x0
PortD = 0x80
Delay_ms(4)
PortB = 0x0
PortC = 0x0
PortD = 0x80
Delay_ms(4)
wend ' Endless loop
end.
Proposed solution:
Assumptions:
PIC1 to be the "Master"
PIC2 to be the "Slave"
An electrical bridge to be established between PIC1 PIN A0 and PIC2 PIN A1...
Let us assume PIC1's program loop lasts for 4 seconds and PIC2's loop is 5 seconds long.
That would mean, that PIC1 is going through 5 loops and sending the Interrupt-PING on PIN A0;
at the same time PIC2 is going through 4 loop and thereafter waiting for the Interrupt-PING on PIN A1.
Once PIC2 receives the PING on PIN A1, it will restart with its loop from the beginning...
How is that to be programmed in the PICs 1 and 2 ? Can you please help me out? Counter (step up /
step down) how would the Interrupt be programmed?
I am sure there is help somewhere - please guide my way!
Many thanks in Advance
Gert
Interrupt / synchronization of PICs
General discussion on mikroBasic PRO for dsPIC30/33 and PIC24.
Author
Message
Return to “mikroBasic PRO for dsPIC30/33 and PIC24 General”
Jump to
- NECTO Studio
- ↳ IDE
- ↳ IDE General
- ↳ IDE Beta Testing
- ↳ IDE Wish List
- ↳ ARM AI Compilers
- ↳ mikroC AI for ARM
- ↳ mikroC AI for ARM General
- ↳ mikroC AI for ARM Beta Testing
- ↳ mikroC AI for ARM Wish List
- ↳ PIC AI compilers
- ↳ mikroC AI for PIC
- ↳ mikroC AI for PIC General
- ↳ mikroC AI for PIC Beta Testing
- ↳ mikroC AI for PIC Wish List
- ↳ PIC32 AI Compilers
- ↳ mikroC AI for PIC32
- ↳ mikroC AI for PIC32 General
- ↳ mikroC AI for PIC32 Beta Testing
- ↳ mikroC AI for PIC32 Wish List
- ↳ dsPIC AI Compilers
- ↳ mikroC AI for dsPIC
- ↳ mikroC AI for dsPIC General
- ↳ mikroC AI for dsPIC Beta Testing
- ↳ mikroC AI for dsPIC Wish List
- ↳ AVR AI Compilers
- ↳ mikroC AI for AVR
- ↳ mikroC AI for AVR General
- ↳ mikroC AI for AVR Beta Testing
- ↳ mikroC AI for AVR Wish List
- ↳ Additional Software
- ↳ Visual TFT AI
- ↳ Visual TFT AI General
- ↳ Visual TFT AI Beta Testing
- ↳ Visual TFT AI Wish List
- PRO Compilers
- ↳ PIC PRO Compilers
- ↳ PIC Compilers General
- ↳ mikroC PRO for PIC
- ↳ mikroC PRO for PIC General
- ↳ mikroC PRO for PIC Beta Testing
- ↳ mikroC PRO for PIC Wish List
- ↳ mikroBasic PRO compiler for PIC
- ↳ mikroBasic PRO for PIC General
- ↳ mikroBasic PRO for PIC Beta Testing
- ↳ mikroBasic PRO for PIC Wish List
- ↳ mikroPascal PRO for PIC
- ↳ mikroPascal PRO for PIC General
- ↳ mikroPascal PRO for PIC Beta Testing
- ↳ mikroPascal PRO for PIC Wish List
- ↳ dsPIC PRO Compilers
- ↳ dsPIC Compilers General
- ↳ mikroC PRO for dsPIC30/33 and PIC24
- ↳ mikroC PRO for dsPIC30/33 and PIC24 General
- ↳ mikroC PRO for dsPIC30/33 and PIC24 Beta Testing
- ↳ mikroC PRO for dsPIC30/33 and PIC24 Wish List
- ↳ mikroBasic PRO for dsPIC30/33 and PIC24
- ↳ mikroBasic PRO for dsPIC30/33 and PIC24 General
- ↳ mikroBasic PRO for dsPIC30/33 and PIC24 Beta Testing
- ↳ mikroBasic PRO for dsPIC30/33 and PIC24 Wish List
- ↳ mikroPascal PRO for dsPIC30/33 and PIC24
- ↳ mikroPascal PRO for dsPIC30/33 and PIC24 General
- ↳ mikroPascal PRO for dsPIC30/33 and PIC24 Beta Testing
- ↳ mikroPascal PRO for dsPIC30/33 and PIC24 Wish List
- ↳ PIC32 PRO Compilers
- ↳ PIC32 Compilers General
- ↳ mikroC PRO for PIC32
- ↳ mikroC PRO for PIC32 General
- ↳ mikroC PRO for PIC32 Beta Testing
- ↳ mikroC PRO for PIC32 Wish List
- ↳ mikroBasic PRO for PIC32
- ↳ mikroBasic PRO for PIC32 General
- ↳ mikroBasic PRO for PIC32 Beta Testing
- ↳ mikroBasic PRO for PIC32 Wish List
- ↳ mikroPascal PRO for PIC32
- ↳ mikroPascal PRO for PIC32 General
- ↳ mikroPascal PRO for PIC32 Beta Testing
- ↳ mikroPascal PRO for PIC32 Wish List
- ↳ AVR PRO Compilers
- ↳ AVR Compilers General
- ↳ mikroC PRO for AVR
- ↳ mikroC PRO for AVR General
- ↳ mikroC PRO for AVR Beta Testing
- ↳ mikroC PRO for AVR Wish List
- ↳ mikroBasic PRO compiler for AVR
- ↳ mikroBasic PRO for AVR General
- ↳ mikroBasic PRO for AVR Beta Testing
- ↳ mikroBasic PRO for AVR Wish List
- ↳ mikroPascal PRO for AVR
- ↳ mikroPascal PRO for AVR General
- ↳ mikroPascal PRO for AVR Beta Testing
- ↳ mikroPascal PRO for AVR Wish List
- ↳ FT90x PRO Compilers
- ↳ FT90x Compilers General
- ↳ mikroC PRO for FT90x
- ↳ mikroC PRO for FT90x General
- ↳ mikroC PRO for FT90x Beta Testing
- ↳ mikroC PRO for FT90x Wish List
- ↳ mikroBasic PRO compiler for FT90x
- ↳ mikroBasic PRO for FT90x General
- ↳ mikroBasic PRO for FT90x Beta Testing
- ↳ mikroBasic PRO for FT90x Wish List
- ↳ mikroPascal PRO for FT90x
- ↳ mikroPascal PRO for FT90x General
- ↳ mikroPascal PRO for FT90x Beta Testing
- ↳ mikroPascal PRO for FT90x Wish List
- ↳ 8051 PRO Compilers
- ↳ 8051 Compilers General
- ↳ mikroC PRO for 8051
- ↳ mikroC PRO for 8051 General
- ↳ mikroC PRO for 8051 Beta Testing
- ↳ mikroC PRO for 8051 Wish List
- ↳ mikroBasic PRO compiler for 8051
- ↳ mikroBasic PRO for 8051 General
- ↳ mikroBasic PRO for 8051 Beta Testing
- ↳ mikroBasic PRO for 8051 Wish List
- ↳ mikroPascal PRO for 8051
- ↳ mikroPascal PRO for 8051 General
- ↳ mikroPascal PRO for 8051 Beta Testing
- ↳ mikroPascal PRO for 8051 Wish List
- ↳ ARM PRO Compilers
- ↳ ARM Compilers General
- ↳ mikroC PRO for ARM
- ↳ mikroC PRO for ARM General
- ↳ mikroC PRO for ARM Beta Testing
- ↳ mikroC PRO for ARM Wish List
- ↳ mikroBasic PRO for ARM
- ↳ mikroBasic PRO for ARM General
- ↳ mikroBasic PRO for ARM Beta Testing
- ↳ mikroBasic PRO for ARM Wish List
- ↳ mikroPascal PRO for ARM
- ↳ mikroPascal PRO for ARM General
- ↳ mikroPascal PRO for ARM Beta Testing
- ↳ mikroPascal PRO for ARM Wish List
- ↳ Older versions of Compilers
- ↳ Older versions of mikroC Compilers
- ↳ mikroC for PIC
- ↳ mikroC General
- ↳ mikroC Beta Testing
- ↳ mikroC Wish List
- ↳ mikroC for dsPIC30/33 and PIC24
- ↳ mikroC for dsPIC30/33 and PIC24 General
- ↳ mikroC for dsPIC30/33 and PIC24 Beta Testing
- ↳ mikroC for dsPIC30/33 and PIC24 Wish List
- ↳ RSC-4x mikroC
- ↳ RSC-4x mikroC General
- ↳ RSC-4x mikroC Wish List
- ↳ mikroC Beta testing
- ↳ Older versions of mikroBasic Compilers
- ↳ mikroBasic compiler for PIC
- ↳ mikroBasic General
- ↳ mikroBasic Beta Testing
- ↳ mikroBasic Wish List
- ↳ mikroBasic compiler for dsPIC30/33 and PIC24
- ↳ mikroBasic for dsPIC30/33 and PIC24 General
- ↳ mikroBasic for dsPIC30/33 and PIC24 Beta Testing
- ↳ mikroBasic for dsPIC30/33 and PIC24 Wish List
- ↳ mikroBasic for dsPIC30/33 and PIC24 Bug List
- ↳ Obsolete Project: mikroBasic compiler for AVR
- ↳ mikroBasic for AVR General
- ↳ mikroBasic for AVR Wish List
- ↳ mikroBasic Beta testing
- ↳ Older versions of mikroPascal Compilers
- ↳ mikroPascal compiler for PIC
- ↳ mikroPascal FAQ
- ↳ mikroPascal General
- ↳ mikroPascal Beta Testing
- ↳ mikroPascal Wish List
- ↳ mikroPascal Bug List
- ↳ mikroPascal compiler for dsPIC30/33 and PIC24
- ↳ mikroPascal for dsPIC30/33 and PIC24 General
- ↳ mikroPascal for dsPIC30/33 and PIC24 Beta Testing
- ↳ mikroPascal for dsPIC30/33 and PIC24 Wish List
- ↳ mikroPascal for dsPIC30/33 and PIC24 Bug List
- ↳ Obsolete Project: mikroPascal compiler for AVR
- ↳ mikroPascal for AVR General
- ↳ mikroPascal for AVR Wish List
- ↳ mikroPascal Beta testing
- ↳ Library Development Discussion
- ↳ Code Requests
- Additional Software
- ↳ Visual TFT Software
- ↳ Visual TFT General
- ↳ Visual TFT Beta Testing
- ↳ Visual TFT Wish List
- ↳ Visual GLCD Software
- ↳ Visual GLCD General
- ↳ Visual GLCD Beta Testing
- ↳ Visual GLCD Wish List
- ↳ Package Manager Software
- ↳ Package Manager General
- ↳ Package Manager Beta Testing
- ↳ Package Manager Wishlist
- ↳ GLCD Font Creator Software
- ↳ SpeakUp Software
- ↳ Timer Calculator
- ↳ CAN Calculator
- ↳ mikroBootloader
- Hardware
- ↳ Development Boards
- ↳ CODEGRIP programmer and debugger
- ↳ Mikromedia
- ↳ mikroProg™ programmer and debugger
- ↳ Development Boards Wishlist
- ↳ Review
- ↳ Click Boards release
- ↳ Hexiwear
- Website & Forums
- ↳ Libstock Discussion
- ↳ Product Announcements
- ↳ Website & Forums General Discussion
- ↳ Website & Forums Wishlist
- ↳ User Projects