Running Light Project (LED)

Discussion in 'Programmer's Corner' started by markidgmgig, Feb 29, 2008.

1. markidgmgig Thread Starter Member

Jan 18, 2008
11
0
I was assigned to make 4 programs that will satisfy the asked outputs and is to be programmed on PIC. (sadly i wasn't able to attend our scheduled seminar regarding PIC programming due to time restraint. so i thought of coming here again and would like to ask for help. I'd be thankful if you could help me with my project.)

1.) Running Light that will turn on/off all leds

Given were 8 leds with a time delay.

Cycle 1: 1 2 3 4 5 6 7 8 = on
Cycle 2: 1 2 3 4 5 6 7 8 = off

2) Running light that will turn on/off led one at a time

Cycle 1: 1 = on | 2 3 4 5 6 7 8 = off
Cycle 2: 2 = on | 1 3 4 5 6 7 8 = off
Cycle 3: 3 = on | 1 2 4 5 6 7 8 = off
Cycle 4: 4 = on | 1 2 3 5 6 7 8 = off
so on and so forth...

3) Running light that will turn on odd turn off even leds and vice versa

Cycle 1: 1 3 5 7 = on | 2 4 6 8 = off
Cycle 2: 2 4 6 8 = on | 1 3 5 7 = off

4) This time running light that will turn on/off led one at a time AND THEN runs reversed

Cycle 1: 1 = on | 2 3 4 5 6 7 8 = off
Cycle 2: 2 = on | 1 3 4 5 6 7 8 = off
Cycle 3: 3 = on | 1 2 4 5 6 7 8 = off
Cycle 4: 4 = on | 1 2 3 5 6 7 8 = off
so on and so forth...

Cycle 9: 8 = on | 1 2 3 4 5 6 7 = off
Cycle 10: 7 = on | 1 2 3 4 5 6 8 = off
Cycle 11: 6 = on | 1 2 3 4 5 7 8 = off
Cycle 12: 5 = on | 1 2 3 4 6 7 8 = off

2. HarveyH42 Active Member

Jul 22, 2007
425
6
I don't do PIC, but can imagine the hundreds of similar projects on the web, if not here in this forum. Have you tried the search function, or Google? You didn't mention what language, or which compiler. By the way, this is so insanely simple, you should be ashamed of yourself for asking.

Just in case no one here is feeling like showing some pity, and taking 15-20 minutes writing your homework for you... Will help you get started on your own. First, get the datasheet for the PIC you intend to use, need at least 8 I/O pins. Next, search the web for a beginner's tutorial in which ever language you plan on using. The very first thing most every tutorial start with, set a port/pin for output, and flashing an LED. If you can flash one LED, it's simple to flash 8. I did the night-rider one as my second program when I started AVR, took about 20 minutes in assembly. I hadn't programmed anything since the late 80's.

For the most part, if you start a project before asking for help, you will get dozens of replies, helping you fix the code/circuit you post. Skipping class, then asking strangers to do the work for you...

Jan 18, 2008
11
0
4. HarveyH42 Active Member

Jul 22, 2007
425
6
If you really expect to get help, you need to at least get started on it, and post the code you have so far. I don't use PIC, but I have used PIC tutorials to get some insight on how to do a few things. I know just enough PIC stuff, that I might struggle through doing it in assembly, and I've never used one. PIC only have 32 instructions, and one register. No big deal with a high level language, like 'C', and probably not so bad once you've get a good collection of routines. I chose AVR, because it seemed a little more friendly for assembly, with 130 instructions and 32 registers.

In my first reply, I gave some direction on how you can get started on your own. Seriously, search the web, you might find the exact program you are looking for, or something very close. Whether you are 'into' programming or not, you will need to start some place. I could post the code for my AVR running lights, but it wouldn't do you much good.

Seriously, this isn't that bad. If you know a little programing, you can do this.