You don't really need a random number generator to accomplish what you want, which is to prevent all pics from coming up at once. What you DO need is two free i/o lines per pic. Let's call these line IN and OUT. The IN of the first PIC is connected to Ground. The OUT of the first pic connects to the IN of the second pic. The OUT of the second pic connects to the IN of the third pic. Continue this procedure of connecting the IN and OUT connections for each succeeding pic. Note that the FIRST pic has it's IN line ALWAYS connected LOW to Ground. Now each pic has as part of its startup code the configuration of it's IN and OUT i/o port bits. Then each pic outputs a HIGH on its OUT i/o line. (use a pullup resistor if you are the paranoid type and overly concerned about the fact that the line will initially be an input and therefore floating). Once the OUT line is configured, output a HIGH on this line. Now finish up whatever other i/o initialization is required, and then go into a loop waiting for IN to be LOW. Since the FIRST pic has it's IN line hard-wired LOW, it will be the first pic to meet this IN==LOW requirement. It will then DELAY for the desired time (whatever time YOU have programmed), and then it will put a LOW on it's OUT line. This LOW now appears on the IN line of the NEXT pic, which ALSO delays for some time and then makes *it's* OUT go LOW, triggering the NEXT pic. This process of delaying and then triggering the NEXT pic continues until ALL pics have gone through the process. If you want visual confirmation of each pic coming out of it's WAIT mode, tie a 1k resistor to +5v and the other side of the resistor to the anode of an LED. Connect the cathode of the LED to the OUT line of the pic you want to monitor. You can get more brightness if you use a lower value resistor, but that increases current drain and raises the value of the LOW output. The method outlined above has the following good points: ALL pics are programmed exactly the same. The actual ORDER of turn-on is a function of the wiring order. It can be extended to handle any number of pics. Any pic can be used to trigger multiple "branches" The bad point is: It uses two i/o lines per pic. ************** Now, there IS a way to get by with only a single i/o line per pic, but it *requires* a resistor and a regular RED LED per pic. In this case each pic has a 1k resistor connected between +5v and the single IN/OUT i/o pin. BETWEEN one pic and the next there is a RED LED. The anode connects to the curent pic, and the cathode of that LED connects to the PREVIOUS pic's IN/OUT line. Except for the FIRST pic. The first pic's LED has its cathode connected to Ground. All pics start off with the IN/OUT line programmed as an INPUT. That allows the first LED to have it's anode at about 1.5v, and all the other LED anodes will be at AT LEAST +3v. When a pic sees a LOW on its IN/OUT input, it delays, then switches the IN/OUT pin to OUTPUT MODE, with the output LOW. (Outputting a HIGH is a no-no, as this attempts to place a full 5 volts across the LED). As each pic outputs a LOW, the voltage on the NEXT pic's IN/OUT (IN) line will drop to 1.5 volts. This is seen as a change to the LOW state by the NEXT pic. Visually, what you will see is only ONE LED on at a time. As each pic finishes it's delay, the NEXT LED will come on, and all previous LEDs will be off. Once the LAST unit has undergone it's delay, ALL the LEDs will be OFF. In place of an LED you can use two 1N4148 type diodes in series. Possible cheaper, but you lose the visual indication. By the way, different color LEDs have different "on" voltages, and they range from about 1.2 to about 3 volts. Once you find a brand and style of LED that works for you, stay with that brand and style, as different LEDs of the same color can have wide voltage variations. I have found most RED LEDs to have about 1.5 volts across them at a few milliamps of current flow. Fr. Tom McGahee ----- Original Message ----- From: Tony Pan To: Sent: Tuesday, August 14, 2001 1:42 PM Subject: Re: [PIC]: Generating a "truly" random number on the application of power > Mike, > > I guess it's more economic to do it in software rather than in hardware. > (It's a commercial product.) > > It 's OK to allow a handful of boards to start at the same time. What we > want to avoid is that all the boards (20, 30 or more) to start at the same > time. > > Tony > > ----- Original Message ----- > From: "Dipperstein, Michael" > To: > Sent: Thursday, August 16, 2001 1:26 PM > Subject: Re: [PIC]: Generating a "truly" random number on the application of > power > > > > Why not just delay the application of power to each board? If you have a > > control pin to spare, you can build a system that where it's the job of > each > > board to allow power to flow to the next. > > > > In any random number scheme, you still have the possibility that all > generators > > will generate the same number and come up at the same time. This can't > happen > > when it's the job of one board to apply power to the next. > > > > -Mike > > > > > > -----Original Message----- > > From: Tony Pan [mailto:weidong.pan@verizon.net] > > Sent: Tuesday, August 14, 2001 10:18 AM > > To: PICLIST@mitvma.mit.edu > > Subject: [PIC]: Generating a "truly" random number on the application of > > power > > > > > > Hi, > > > > In our project, several identical boards are connected together. Normally, > > on the application of power, they will be turned on at the same time and > > starting running at the same time. But we don't want that to happen. If > all > > boards are running at the same time, they will consume too much power and > > cause a problem. > > > > So, we want to impose a lockout time at the beginning of the software; the > > lockout time should be random for each board (though they use the same > > software). Only after the lockout time expires would the program start > > running. Thus the boards will start at different time and won't cause a > > power shortage. > > > > My question is: how to generate a "truly" random number on the application > > of power. The number should not be determined upon the compilation of the > > software, but should be upon the initial powerup of the chip. (Or, it > should > > be determine by each individual chip.) > > > > Help? > > > > (By the way, I write my program in C and use PICC compiler.) > > > > Thanks in advance. > > > > Tony Pan > > > > -- > > 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 > > > > -- > > 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 > > > > > > > > -- > 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 > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads