Aslam Jallali wrote : > Jan-Erik, > sorry - I meant to write from: www.golovchenko.org/cgi-bin/delay > this site has a delay generator. I haven't tested the > generated code yet I will do this tonight let you know if it was > working or not. I see , fine. I'm sure they "works", not just that they are the best solution for your specific application. > Now, as for application: I try to simulate irish lighthouses for a > decorative map. > Each lighthouse is represented by a LED on the map. > Each lighthouse has a different flashing sequence for example the Kish > Lighthouse, east of Dublin Bay, has a character of Fl (2) W 20s, this > according to chart means 0.4 second of light, followed by 3.6 seconds > eclipse, followed by another 0.4 seconds of light and 15.6 seconds eclipse. > This sequence is repeated every 20 seconds (fl 0.4, ec 3.6, fl 0.4, ec 15.6 = 20s.) > and the next lighthouse "Tory Island" is Fl (4) W 30s > (fl 0.2, ec 4.8, fl 0.2, ec 4.8, fl 0.2, ec 4.8, fl 0.2, ec 14.8 = 30s). > and so on.... A realy nice application !! As living by the east coast of Sweden myself, I could very well think of having something like that on my living room wall !! Now lets see... Note that all intervalls are integer multiples of 0.1 seconds. What I'd try to do, would be to first create a "time base" of 0.1 second. Easy using some of the timers. Then create short "tables" (in flash or in EEPROM) with some kind of coded version of the "Fl (2) W 20s" codes from the map. Each lighthouse will have a pointer into it's own table and also a counter that times how long a lighthouse have been "on" or "off". Then each 0.1 seconds, the code would decrement all counters and (if any of them reached zero) move forward to the next entry in that lighthouses table, set the LED on or off and re-load the counter with the new intervall. There would be plenty of time to run through all lighthouses each 0.1 seconds. > The flashes are either 0.2, 0.4, 0.5 or 1s. Sofar I found 21 > delay routine that are common amongst 20 lighthouses. Oh, so there are 20 lighthouses, fine. > Yes I suppose there is a common time base but I thought of 21 > delay routine first!I thought that was the more > suitable (easier!)option I'm not sure... > I will spare you the hardware setup just that I bought a > PIC16877 because that is the one that I can Program. Using one pin/lighthouse ? Note that even if you can run 20 mA through a (single) PIC pin, you can not run 8x20 mA on a single port. But maybe you must not use 20mA to get the LED's visible ? Finaly, make sure you publish a photo of the finished map on your wall when it's ready ! :-) :-) Jan-Erik. PS. Just a thought... I wounder if real lighthouses would blink in absolute sync ? That is, maybe one should try to have the lighthouses "drift" just a little (maybe 1-2% from each other) so you don't get some visual effects where some or all lighthouses seems connected to each other (which they are here, but wasn't in real life, right ?) Actuly, if one had a spare tube of 12F629's, one could mount one directly behind each LED, running on the INTOSC. Then you'd get a natural "drift" between the lighthouses :-) :-) -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics