Simultaneous lighting

Thread Starter

chris92

Joined Nov 13, 2013
7
Hi, please am new to embedded systems...... Can anyone help me with an MPLAB code that would light LEDs simultaneously just like a Christmas light. Am using PIC16f84a microcontroller. Thanks
 

tshuck

Joined Oct 18, 2012
3,534
Have you gone through a tutorial, or tried anything yourself, or are you being lazy and asking for a tailor-made solution?

If you have tried and it isn't working, post your code so we might help you find out what is wrong...
 

Thread Starter

chris92

Joined Nov 13, 2013
7
Am just looking for ideas. I was thought in class to day to make 2 LEDs flash continuously. I was now given this assignment. I don't know how to go about it. Just a christmass light that flashes one after the other. Thanks for your attention.
 

JohnInTX

Joined Jun 26, 2012
4,787
One way is to rotate a bit in a register then write that register to the output port to do up to 8 LEDs sequentially. You will have to determine when to reload the register (hint: check STATUS,C after rotating).

Another way is to use a table lookup scheme that fetches arbitrary patterns from a table and writes each one to the port. There is lots on table lookups here at AAC and on microchip.com. You are looking for ADDWF PCL,F kinds of things.

Whatever you do, start by writing out on paper what you are trying to accomplish, step by step (as the PIC will have to do). Then figure out how to do in with the PIC (instruction set, registers etc). Then manually, on paper, 'desk check' your design to see what happens and convince yourself that it will work. After all of that, implement your solution to the problem on the PIC and go from there.

Have fun.
 

ErnieM

Joined Apr 24, 2011
8,415
Hi, please am new to embedded systems...... Can anyone help me with an MPLAB code that would light LEDs simultaneously just like a Christmas light. Am using PIC16f84a microcontroller. Thanks
Am just looking for ideas. I was thought in class to day to make 2 LEDs flash continuously. I was now given this assignment. I don't know how to go about it. Just a christmass light that flashes one after the other. Thanks for your attention.
Well, which one is it? ;)

The PICkit development boards have a few LEDs on them. They have tutorials and the first ones are how to blink a LED.

PICkit 2 tutorial is for assembler, PICkit 3 is for C (which now is a free download).


http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023805

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en538340
 
Top