PIC Traffic Lights


Posted on Feb 6, 2014

All that remains now is for the code to be `, compiled and converted to a HEX file that the PIC can understand. This is achieved easily with the PIC compiler that comes with the PICBASIC package. The PIC is programmed with any of the parallel or serial port programmers that are available free of charge from the NET. If you arrange the LEDs as the


PIC Traffic Lights
Click here to download the full size of the above Circuit.

diagram of my prototype box, FIG 1, then the LEDs at the left of the PIC we will call LEDs A and to the right of the PIC LEDs B. Number them, starting at the top of LED A the RED LED number 0. The next one down is AMBER and is number 1. The bottom one GREEN is numbered 2. The right hand side LEDs starting from the top is numbered 4 for the top RED LED with number 5 being allocated for the middle, AMBER LED. The bottom, GREEN LED is number 6. Loop: Is the start of this programme. It is suitably called loop, as that is what the programme does. It loops continuously until it is switched off. It must be followed by the colon. HighO: Places a logicl on portB pinO consequently lighting LED 0. The colon is there to separate the first statement (high 0) from the next one in the same line. If the next statement (high 6) was placed on the next line down there would be no need for the colon. It just saves space. Pause1000 Is an instruction to tell the PIC to delay for 1 second. The actual time will depend on the clock frequency of the PIC. As a rule of thumb 1000 can be regarded as 1 second and 5000 as 5 seconds. The portB pins are placed in a register called bl. This could have been called b0, b2, b3 etc. there are, of course, only so many of these registers in each PIC. Lowbl instructs that everything in register b 1 goes to logic 0. In our case all the pins in portB, 0 to 7 are taken low. It does this in sequence from pin 0 to pin...




Leave Comment

characters left:

New Circuits

.

 


Popular Circuits

Morse Keyer circuit
Battery-Temperature Sensing Nicad Charger
Logic-Level Translators
Audio Phone Ring Generator Using Switching Supply
140W Amplifier Circuit ( 2x 70 Watt ) Schematic Diagram
Oscillator circuits 5
usb power socket with indicator
ATR0981 ATR0981 UHF SiGe Front-end IC
MC34017A Telephone Tone Ringer Bipolar Linear/I2L
TIMER IS AUTOPATCH KEYER
2 VALVE TRANSMITTER



Top