PIC Traffic Lights

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 - schematic

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 7. Hence the reason for next bL If we had put `for b1= 0 to 3:next bl` then it would only place the portB pins 0, 1, 2 and 3 to a logic low. The first line of the `main` listing (high O:high6:pause5000) is placing RED LED A on and GREEN LED B on. It then stays on for about 5 seconds and then goes to the next stage. The RED A stays on AMBER is off AMBER B is on and GREEN A and GREEN ` B is off and so the sequence continues. The ` 0. 5-second pause on the last line is there to avoid errors at the return of the sequence. Fig. 2. The complete two-traffic lights circuit. Simple isn`t it! It will be obvious by looking at Fig. 2 that there is not much to the circuit. Perhaps series resistors of about 100 0 should be placed in between the ports and the LEDs to limit the current. The programming of the PIC is very simple but you will need the necessary software. PICBASIC is available from MAPLINS and the programmer software and circuit diagrams are available free of charge off the NET. You may know someone who already has both of these types of software. The PICBASIC available free on the NET is probably a good compiler, but is a bit more involved in that you have to type in some other information as well as your programme listing. It is not as `user friendly` as the PICBASIC programmer produced by Micro Engineering Labs Inc. I had no reply either from the NET PICBASIC people when I asked for some advice. If you do not have any means of programming or you prefer not to anyway, but would like a working set of traffic lights (you can remotely operate the LEDs) then I can supply you with a pre-programmed PIC. I can also produce a PCB and an 18-pin holder for the PIC. If anyone is interested I can just send the HEX code on receipt of a floppy disc and the return postage. The preprogrammed PICs I could supply at say £5 including P and P. the PCB and IC holder I could also send for £5 including P and P. The compiler then goes on to change rgis assembly language into hexadecimal code. I have not shown this as it appears as a block of letters and numbers and you cannot recognise any of the stages in it. List of components:- R1 4. K Resistor. 1 R2 R3 R4 470R. 2 # 4Mhz crystal. 1 C1 C2 22pf capacitor. 2 C3 0. 1 Mf. 1 LED1 Green LED. 1 LED2 Orange LED. 1 LED3 Red LED. 1 IC1 PIC 16C84. 1 PCB Pins. 2


Recommended videos

  • Circuit wizard traffic lights circuits
    Duration: 3:08.
  • LED Traffic Light Control Circuit
    Duration: 0:31.
  • Density Based Traffic Signal System using Microcontroller
    Duration: 3:57.


  • Forbes
    Forbes : New Galaxy S8 Reviews, Stunning Pixel 2 Leaks, Samsung's Embarrassing ProblemsTaking a look back at seven days of news and headlines across the world of Android, this week's Android includes an extensive Galaxy S8 review, record
     28 April 2017
  • Reuters
    to set up unitApril 28 Two Russian nationals arrested in the United States last October on charges of conspiring to export sensitive military from the United States to Russia were sentenced to time served on Friday, a spokesman for U.S. pr
     28 April 2017
  • Gizmodo
    TechCrunch In the email, Levandowski explains that he will no longer be involved in the unit of Uber's Advanced Group that develops the LiDAR system that is crucial for self-driving cars. “I want to let you know that Travis and I h
     28 April 2017
  • Eetasia.com (press release)
    Eetasia.com (press release) design optimises deep learning appsThe integer operations-based tech reduces data bit width of the compute units and the memory that records training results of deep learning. Fujitsu Laboratories has develope
     27 April 2017
  • TechCrunch
    TechCrunch details in Uber lawsuit... submitted an 80-page list detailing the roughly 100 stolen trade secrets to the court, its attorneys quizzed Levandowski on a handful of design details, including its use of fiber laser and its spec
     26 April 2017
  • PR Newswire (press release)
    Stocks Under Scanner -- Flex Ltd, Jabil , TTM , and MSCI Inc.This Friday, Stock-Callers.com has initiated reports coverage on the following equities: Flex Ltd (NASDAQ: FLEX), Jabil Inc. (NYSE: JBL), TTM Inc. (NASDAQ: TTMI), and MSCI Inc.
     21 April 2017
  • Indiana Lawyer
    Indiana Lawyer : Title VII includes sexual orientationIvy Community College of Indiana, 15-1720, an eight-judge majority from the Chicago court detailed their reasoning for connecting bias against gays and lesbians to the prohibition of
     19 April 2017
  • Reuters
    sees Q1 2017 net profit up 60-90 pctReuters is the news and media division of Thomson Reuters. Thomson Reuters is the world's largest international multimedia news agency, providing investing news, world news, business news, news, headline
     17 April 2017
  • Slate Magazine
    Slate Magazine On Tuesday, the U.S. Court of Appeals for the 7th issued a landmark decision in Hively v. Ivy holding that Title VII of the Civil Rights Act of 1964 prohibits sexual orientation discrimination. The 8–3 rul
     5 April 2017