Simultaneous lighting

Discussion in 'Embedded Systems and Microcontrollers' started by chris92, Nov 13, 2013.

  1. chris92

    Thread Starter New Member

    Nov 13, 2013
    7
    0
    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
     
  2. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,770
    1,103
    If you want them all on simultaneously won't a simple switch do the job? Or did you mean 'sequentially'?
     
  3. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    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...
     
  4. chris92

    Thread Starter New Member

    Nov 13, 2013
    7
    0
    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.
     
  5. JohnInTX

    Moderator

    Jun 26, 2012
    2,339
    1,022
    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.
     
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    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
     
Loading...