1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

3x3x3 LED Cube - can i use16f628 instead 16f690

Discussion in 'Microcontrollers' started by robotsmani, Jan 20, 2009.

  1. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    What are you wanting to do if I new I would help you out you what to turn the cube on or something
     
  2. welflash

    welflash New Member

    Joined:
    Mar 8, 2009
    Messages:
    22
    Likes:
    0
    trully i'd like to use the cube as a customized light on my bike
    i'll divide the leds
    15 leds for the brake n 6 leds each for turn sign
    i need 4 switch to do that
    switch #1 is turn left sign
    switch #2 is turn right sign
    switch #3 is brake lamp
    switch #4 to select which subroutine to use

    for example...
    hit the brake than the brake leds start running (it'll be the default)
    push switch #4 than hit brake the brake leds start blinking
    something similar with the turn sign leds
    push switch #4 once again than all leds light make some subroutine

    yes it might be something complicated for me to learn
    but...i wanna learn this microcontroller long time ago
    n i couldn't afford the microcontroller course
    so i thought that this would give me spirit to do it
    well...i already got some spirit when you...be80be answered all of my questions
    n again...sorry for my bad english
     
    Last edited: Apr 8, 2009
  3. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    Here try this this is the code make a folder C:\ledcube and put the led.asm
    then unzip the video I made and do it like I show you hope it helps.
     

    Attached Files:

  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn

    You write code in assembly then turn it in to a hex if you look at the video in the mplab.zip
    I think it will put some light on it
     
  6. welflash

    welflash New Member

    Joined:
    Mar 8, 2009
    Messages:
    22
    Likes:
    0
    sorry...it's double post
     
    Last edited: Apr 9, 2009
  7. welflash

    welflash New Member

    Joined:
    Mar 8, 2009
    Messages:
    22
    Likes:
    0
    that's exactly what i've done...
    but the result was failed...failed n failed...
    after i read ur posts...
    bam...i remember...
    "Source file path exceeds 62 characters"
    yes, man...
    you gave me some spirit...
    thank you

    i'll try to recompile the asm again.
     
  8. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    Post your code if don't get it to work use the code tags and maybe get that bike rolling
     
  9. Tightwad

    Tightwad New Member

    Joined:
    Dec 12, 2008
    Messages:
    45
    Likes:
    0
    Location:
    Dallas, TX
    I am a bit confused on the Schematic....I only see one layer of LEDs. Can someone post an explanation of how the other layers are wired in?

    I can't see Youtube or the video might be enough to help explain....thanks!
     
  10. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    It's on the Schematic hard to put 27 leds on there. There three layers one layer for each transistor look real good at the right side of it.
    top roll, center roll, bottom roll, You hook the anode to the 9 pins by stacking three rolls
    on top of each one then the 3 cathode to the tree transistors
     
    Last edited: Apr 9, 2009
  11. Tightwad

    Tightwad New Member

    Joined:
    Dec 12, 2008
    Messages:
    45
    Likes:
    0
    Location:
    Dallas, TX
    Seems like one of those things that will make more sense when i build it. Does it get complex to expand it to be six sided? It would be cool to make a box with 6 sides, but seems like it would be a bit much to expect.
     
  12. welflash

    welflash New Member

    Joined:
    Mar 8, 2009
    Messages:
    22
    Likes:
    0
    the asm you've sent me isn't working
    so i used the hex that works before
    i convert it to asm, change it with mplab
    here it is:

    LADR_0x075F
    MOVLW 0x07
    MOVWF LRAM_0x1F
    BSF STATUS,RP0 ; !!Bank Register-Bank(0/1)-Select
    MOVLW 0x0B
    MOVWF PORTA ; set bit 0, 1 and 3 in porta as input
    clrf PORTB
    BCF STATUS,RP0
    MOVLW 0xFF
    MOVWF PORTB

    LADR_0x076A
    btfss PORTA, 0
    call LADR_0x05DE
    btfsc PORTA, 0
    clrf PORTB
    btfss PORTA, 1
    call LADR_0x0571
    btfsc PORTA, 1
    clrf PORTB
    btfss PORTA, 3
    call LADR_0x0357
    btfsc PORTA, 3
    clrf PORTB

    goto LADR_0x076A

    End

    i put a 1K resistor at each input in portA (RA0, RA1 and RA3)
    and 10K resistor at Vcc
    it works but it only stop until the subroutine has done
    is it the code (clrf PORTB)?
    what is the code to use so it will stop right after i release the push button?
     
  13. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    For starters a switch start or stops some thing so if it starts it not going to stop till it done
    and to make it stop you have to interrupt it so you have to use interrupts to do what you want. And i can't see why you couldn't build from the asm I posted. But you can disassemble a hex. which is no good to use because it not all of it. I'm not trying to be bad but you wasting your time learn how to write code have fun with code like the 3x3x3 but learn to write code. hook up some leds and a switch or two and write some code to see how it works then go back to this and make it do what you want. A pic is not like a computer it dos one thing at a time if it polls for a switch thats what it keeps doing till it happens then it dos what you tell it to do when that is done it come back to where it was which was checking for the switch to be pressed.
     
  14. atferrari

    atferrari Well-Known Member

    Joined:
    Oct 8, 2003
    Messages:
    2,812
    Likes:
    121
    Location:
    Buenos Aires - Argentina
    computers also

    Computers also do things one at a time.
     
  15. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    A pic is not able to multitasking like my duel amd 64 can and no where as fast. But that not
    what I telling him He want's to change code that starts a big loop and here no end to the loop so if you want to stop it in the middle you will have to use interrupts. It would be hard
    to use a "btfcs" and "btfss" to start and stop three page loop when you want it to with out interrupts. Once the loop starts. You could poll the switch first run the loop once and poll the switch. But that would not work good
     
  16. welflash

    welflash New Member

    Joined:
    Mar 8, 2009
    Messages:
    22
    Likes:
    0
    got it sir...
    i see your point...
    i put the switches right after i read part of the lesson for reading switches you've sent me.
    i intended to finish the reading so i could write the code by myself.
    i'll get back to you for the result.
    you're a great master be80be, it's a big step to me for i realy2 zero about assembly. Big big thanks to you.
     
  17. octobpra

    octobpra New Member

    Joined:
    Jul 24, 2008
    Messages:
    4
    Likes:
    0
    Hello i have try that cube but i can't control layer per layer am i wrong in schema ? but i have checked many times i have no wrong... but still i can't control single led or layer per layer if i turn on layer bottom is right but if i turn on RA6 layer RA5 and RA6 turn on so if i turn on RA7 then RA5,6,7 turn on ...what wrong can u help me ???
     
  18. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    what chip are you using
     
  19. octobpra

    octobpra New Member

    Joined:
    Jul 24, 2008
    Messages:
    4
    Likes:
    0
    Thanks BE i use PIC16F628A is my pic damaged maybe ???
     
  20. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
  21. octobpra

    octobpra New Member

    Joined:
    Jul 24, 2008
    Messages:
    4
    Likes:
    0
    thanks Be i have try many times as ur advice it's working but when i try to change source code to build myself i wanna control led one by one layer by layer it can't work since i am a new bie in asm in pic programming can u send me example of source code that control layer by layer...? i try to write code but if i turn on layer RA5 it's oke but when i turn on layer RA6 so RA6 and RA5 led turn on together ??? why ?
     

Share This Page