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

programming a byte on one pin

Discussion in 'Microcontrollers' started by MrDEB, Nov 4, 2012.

  1. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,198
    Likes:
    110
    Location:
    Seattle, WA
    ONLINE
    LOL Tony. Tatertoes. I like that :)

    Good call on the constant values. Too bad Tatertoes ignored your comments.
     
  2. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    Why not use a 720 ohm it's close enough to 25 and you leds are made for 30mA full on or over a 100mA if your scanning them
     
  3. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    For information only, I just experimented with the MSB and LSB but didn't catch the fact that one of the arrays had two bits enabled which threw me for a loop until I realized it.
    Apparently JonSea or ?? didn't read the post that I was experimenting by changing the MSB to LSB just to satisfy my curiosity.
    ITS CALLED LEARNING BY DOING.
     
  4. dave

    Dave New Member

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


     
  5. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23

    Yo Burt, I measured one LED current draw and it came up 18.9ma
    Going to measure one of the matrix displays segments just to see what it measures running on 9v. It should be about the same if I understand the TLC5916/17.
    First need to wire up pone of the new brighter Matrix that KINGBRIGHT doesn't even list on their site (typed in the matrix number in the search box TBC40-12SURKCGKWA) unless someone proves me wrong.
    According to the data heet it is a whole lot brighter intensity.
     
  6. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,198
    Likes:
    110
    Location:
    Seattle, WA
    ONLINE
    Experimenting is good...randomly changing stuff isn't experimenting.

    Did you consider what should happen when you changed from MSB first to LSB first? I suspect not.

    So when you changed it and apparently the LEDs flashed in sequence, you had no clue why or where to look for the problem.

    I seriously request you never mention my name again or the TAP-28. Just call it a dev board. Thank you.
     
  7. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    I had an idea that it would do what it did, seriously I had a 99% inkling what it would do but I had to find out for sure.
    The only reason why I as others bought the "so called development board" was we felt sorry that you had all that inventory. Besides I wanted to see what all the fuss was about and find out its just a simple board that could be better but it is useful. As I understand it its nothing to jump up and down about, nothing new. Its just a simple board that is OK.
    As far as the free advertising, I will do as I please. This is a free country. Lets see now this makes three threats you have throwen my direction.
    As Alfred E Newman says "WHAT MED WORRY"
     
  8. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    No he didn't but I bet he does now see what it does! Give him a break here Jon this is his hobby and you know what looks like your hobby is writing what's wrong with MrDeb

    IF you sit a write for hours what you think will help him and it looks like it did sink in oh well maybe it will help some one else

    But adding all this drama also kills all the stuff you write to help the guy. Sure he looks like he doesn't read haft what is posted, Can't help that can we. Sure he get's lost some times can't help that too.

    But if we just show how to fix these problems some one can use that.

    But all in all MrDeb is still plugging part's in seeing what happens hell the man never has stopped trying. I would of regroup my ideas about this long time ago, But MrDeb still plugging alone there. Thats called trying and for that one reason I'm still here trying to Help Him.
     
    Last edited: Nov 17, 2012
  9. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    Thanks Burt.
    I use the phrase
    LEARN BY DOING is much more valuable in the learning process than sitting in a classroom while a teacher explains theory etc.
    I was an auto mechanic for 20+ years. Had three years in High School, Two in Junior college. After college I thought I knew everything there was to know about auto repair. BOY was I wrong.
    After twisting wrenches for a living for a couple of years I then became proficient at auto repair. Then it was somewhat required to have $30,000 worth of equipment to work on cars. I then went to work as a groundskeeper at a school district. Read and started repairing the irrigation systems. Became very proficient at that.
    HOW? by the motto "LEARN BY DOING". And yes I read every thing and try every suggestion. It may not seem like it but I can and will persevere regardless of the criticism Jon spews out.
    Lets see what examples we have--Told the PIC controlled soldering iron wouldn't work - works like a charm
    The beer cooler project - after realizing the voltage regulator issue it works great. Yes I received lots of guidance but in the end I put the code together to MAKE it work. Just maybe someone will read about my mistakes and learn from them.
    Recently amazed myself by writing some code and no errors. Didn't work at first but it does now. WHY? learned by mistakes as well as others mistakes.
    My present project- LED matrix w/ wireless, Burt straighten out my basic code using the SHIFT.bas (never even heard of it) but the additional code needed to get this project working I have written, no copy n paste as suggested.
    Still plugging along in Idaho.
     
  10. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    I just have to say this copy n paste Swordfish and any compiler that use's libraries for SUB"S and FUNCTIONS are no more or less then copy n paste . Where people get in trouble is not learning how they work and just start jabbing in the dark. CODE

    Here MrDeb this is the output of the code I wrote with 3 buttons pressed and one that shows how much noise this receiver pick's up

    View attachment 68684
     
    Last edited: Nov 17, 2012
  11. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    What are you using to get the wave output onto the screen. It doesn't look like a camera shot. Perhaps the module in MPLAB? That sure is a-lot of noise??
    Well I confirmed that the PIC portion of my new board works using internal osc.
    on to connecting the high side chip and fabricating an LED test board where I can just place on top of the chip and see what is going on. Have seen these for sale. I figure it might be a good gremlin locating tool.
     
  12. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    No The pickit2 has a tool for logic and signal analyzer it takes snapshots of the open window Here a pdf that tells you how to use it.
     
    Last edited: Nov 17, 2012
  13. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    I am going to investigate the LOGIC TOOL. Have seen reference to it but never tried using. I need to walk before I run ---lol
     
  14. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    I don't no about that one But I learn my tools first they help you get up and running

    When I first started getting back into electronics I did't have many tools so every tool I fine that help I learn to use.

    The logic to will help you alot to see the signal You can check the output on the data pin and see it it's what you sent.
     
    Last edited: Nov 17, 2012
  15. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    Will look into using the LOGIC tool tomorrow. Trying to get my matrix all connected. Almost done but the eyes say its time to quit.
     
  16. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    Well I tested the 10f200TX'er as i call it and with the receiver i can clearly pick up any of the button presses .
     
  17. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    I am ordering some 10F200's after my SSI check gets here
    I got my new board all wired up but it appears I have no CLK output. Checked using a DMM. The wires from the PIC to the SDI, CLK inputs are maybe too long. Thinking I need pull up resistors as I get slight voltage changes. Will investigate tomorrow.
     
  18. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    Found that my had my clk grounded via a small snippet of wire.
    added 10k pullups to the CLK and SDI pins. works better? in theory it should be better.
    Now to just straighten out the code, figure out what each line is doing then insert into my original code with the arrows. Found I need to configure the green leds by using separate TLC5916. Looking at the code I am running, I get the Green LEDs on when they are not wanted.
    Using a 750ohm external resistor on the TLC5916 I show 26.3ma regulardless how many rows I have on. 5 colums = 153ma Driving the High side driver w/ 9v
    Making real progress
     
  19. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    BOY making all kinds of progress.
    Connected a second TLC5916 (one for RED Cathodes and one for GREEN cathodes) and using same SDI/CLK/LE connections and using the OE as a "chip select or color select" the setup works great. Found this configuration takes care of the current varation between the green and red led segments. Both now draw the same 26.3ma.
     
  20. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    Getting no where FAST

    been studying this code for two days trying lots of different things and seeing what each statement does.
    I figure if I build an array then access it each time I need different data in the colums. Tried using what has worked in the past but this SHIFT.bas doesn't do what I want. I just want suggestions, no answers as I want to try and do this.Have several comment lines. Been looking at the Swordfish bible and reference manual . Wondering if I try ptype or ref??
    Code (text):
    {
    *****************************************************************************
    *  Name    : UNTITLED.BAS                                                   *
    *  Author  : [select VIEW...EDITOR OPTIONS]                                 *
    *  Notice  : Copyright (c) 2012 [select VIEW...EDITOR OPTIONS]              *
    *          : All Rights Reserved                                            *
    *  Date    : 11/12/2012                                                     *
    *  Version : 1.0                                                            *
    *  Notes   : Burts knight rider                                                               *
    *          :                                                                *
    *****************************************************************************
    }
    Device = 18F2420
    Clock = 16
    Config OSC = INTIO67



    Include "InternalOscillator.bas "
    Include "shift.bas"
    Include "utils.bas"
    Include "convert.bas"
    Include "InternalOscillator.bas "
    Dim SDI As PORTC.4
    Dim CLK As PORTC.5
    Dim LE As PORTC.3
    Dim RED_OE As PORTC.0
    Dim GREEN_OE As PORTC.1
     
    Dim DataPin As SDI  
    Dim ClockPin As CLK
    Dim ResetPin_R As RED_OE
    Dim ResetPin_G As GREEN_OE
    Dim index As Byte
    Dim X As Byte
    Dim row0 As PORTb.0
    Dim row1 As PORTb.6
    Dim row2 As PORTB.1
    Dim row3 As PORTB.2
    Dim row4 As PORTB.3
    Dim row5 As PORTB.4
    Dim row6 As PORTB.5
    Dim led As PORTA.0
    dim R_ow as word
    dim colum_buffer(5) as byte
    Dim Z As Byte

    Const data(5)As Byte =(%00001001, %000001010 ,%00000100, %00001000, %00011111)
    Const Rows(7) As Byte =(%00001001, %000000010 ,%00000100, %00001000, %00100000, %01000000, %00000000)
    sub LOAD()
        for z = 0 to 4           // trying to build an array using the CONST data
    colum_buffer(Z)= data(z)
    next      
    end sub

    Sub StartScan()
       
       
       
        LE = 0
        ResetPin_G = 1
        Shift.Out(mSB_FIRST, colum_buffer(x) ,8)  // want to incorporate the CONST data here
        LE = 1         //Latch data
       high( portb.0)  
        DelaymS(1000)
        ResetPin_G = 0  // output disable
        LE = 0
     
         
       
       
    End Sub

    Shift.SetOutput(DataPin)
    Shift.SetClock(ClockPin)
    ADCON1 = $07
    Output(ResetPin_R)
    Output(ResetPin_G)
    Output (LE)

    //trisc=%00000000
    //trisb=%00000000
    //Output(row0)
    //Output(row1)  // enable row1
    //Output(row2)
    //Output(row3)
    //Output(row4)
    //Output(row5)  // enable row1
    //Output (row6)
    While true
     {  
     For index = 0 To Bound (data)
          DelayMS(500)
          X = (data(index)
     
      }
          load
         
          StartScan
    // High(row0)
    // High(row1)  // enable row1
    // High(row2)
    // High(row3)
    // High(row4)
    // High(row5)  // enable row1
    // High(row6)
     


     Wend
     End
     
  21. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    This is not that hard after you get the idea down pat. you shift out where the led will be on the columns
    and then fire the row.
     

Share This Page