PIC Traffic Lights

  
Inside:
Repository
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


  • Populaire video
     
  • Automatic Traffic Light Control System Using PIC Microcontroller
    Duration: 1:46.
  • Circuit wizard traffic lights circuits
    Duration: 3:08.

News


  • KMBZ
    SchoolA federal judge earlier had issued a permanent injunction that barred the college from universally drug screening all students. The 8th ruling upheld the judge's permitting the college to drug test students in five programs involving
     21 January 2017
  • The Daily Tribune
    The Daily Tribune
    The Daily Tribune Chavonne Taylor is escorted into Judge Kathryn Viviano's courtroom in Macomb County Circuit Court for Taylor's insanity plea hearing. Ray Skowronek--The ...
     21 January 2017
  • Forbes
    Forbes : Samsung Reveals Galaxy S8, New Nokia Sells Out, Deciding On The S8 Launch DateTaking a look back at seven days of news and headlines across the world of Android, this week's Android includes Samsung's reveal of its Galaxy S8 fla
     21 January 2017
  • Wall Street Journal (blog)
    Wall Street Journal (blog) Talent Pool: Make It GreatAs president, Mr. Trump must share his “do well” message with the country's 7.5 million information professionals who carry a legacy of “incredible innovation”
     20 January 2017
  • TWN
    TWN Stocks Flagged As Top Movers: Jabil , Inc. (NYSE:JBL), Yandex N.V. (NASDAQ:YNDX)Sell-side analyst recommendations point to a short term price target of $24.55 on the shares of Jabil , Inc. (JBL). The consensus rating is 2.6, suggesti
     19 January 2017
  • The Independent Republic
    Stocks To Look Out For: Ciena (CIEN), Jabil (JBL)Ciena Corporation (CIEN) ended last trading session with a change of 0.97 percent. It trades at an average volume of 2.75M shares versus 1.71M shares recorded at the end of last trading sess
     19 January 2017
  • The Independent Republic
    Baxley Report Stocks To Look Out For: Jabil , Inc. (JBL), Extreme Networks, Inc. (EXTR)Jabil , Inc. (JBL) ended last trading session with a change of 0.81 percent. It trades at an average volume of 2.11M shares versus 1.17M shares record
     16 January 2017
  • Moneycontrol.com
    locked at 5% upper on IT project from US GSATrigyn locked at 5% upper on IT project from US GSA. Shares of Trigyn were locked at 5 percent upper at Rs 111.50 on Thursday after its subsidiary received IT contract from the independent ag
     12 January 2017
  • PCWorld
    gets upgrade after 35 yearsInside wearables, smart devices, robots, and computers like Raspberry Pi are communications buses called I2C (Inter Integrated ), which date back to 1982, and SPI (Serial Peripheral Interface), which was born in 1
     10 January 2017

.