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,201
    Likes:
    111
    Location:
    Seattle, WA
    Ok, I am so done. I have tried to explain the methods of making things work but apparently you don't want to waste your time understanding.

    I hope Burt has the fortitude to continue to try to help you. In case you haven't noticed, nobody else is wasting their time in this futile effort.

    No more comments to follow, ever.
     
    • Like Like x 1
  2. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,161
    Likes:
    340
    Location:
    Brisbane Australia
    MrDEB gets one more victim.

    However, he will persevere and in 6 months time I'll post the same comment.

    C'est la vie.

    You just have to laugh.

    Have fun,

    Mike.
     
  3. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    Yep I've been burning up pic32mx250f128 not really just working on a board to play with they don't like solderless bread boards.


    Yep, il ne semble jamais lu ce que vous postez

    It's all about Fun,

    Mrdeb I got me some of them 10f200 going to see how well they work with the tx. Not much room for code but they blink leds nice.
     
    Last edited: Nov 15, 2012
  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

    Daughter board + Tap-28

    Decided to look at using the I2C / SPI port on the Tap 28 as suggested. Have yet to give it a go but I took out the High Side driver, jumpers etc to eliminate any possible problems.
     
  6. Pigskin Tony

    Pigskin Tony New Member

    Joined:
    Aug 20, 2012
    Messages:
    18
    Likes:
    0
    Somehow, I doubt if Jon cares much about what you do from this point forward.

    Whew doggie Mrdeb, you have a way with folks!
     
  7. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    Last edited: Nov 15, 2012
  8. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    Jonsea is the only one who has any issues with me that I am aware of. But you look at what he does over at DDIY, lots of members but about 5 or 6 actual active members. WHY, figure it out. He has even used four letter words toward members.
    WHY probably because I am to inquisitive and trying to learn. Making some progress but using Jonseas suggestion he keeps changing direction. He says use SPI then SHIFT.bas. I draw clear schematics but I can't win. At least I am not a quitter. I try something if it doesn't work then I find out why.
    I HAD issues with getting an LCD to display and come to find out the LCD (several just purchased) were bad Jopnsea still harps on that oe. He must be interested in me as he follows me around the web.--lol
    Don't have a clue about Pommie?Never heard anything about gripes from him. I thought he fell off the edge of the earth. Now there's a guy that can write code. I have said this numerous times. Yes he helped me several years ago but he disappeared.
     
  9. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    Yo Burt, thats basically the idea I had using the 7555 but yours is more refined for sure.
     
  10. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    Yep Mike is a one of a kind unbelievably clever coder I sure learn alot from his work.
     
  11. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    We have partial lift off

    Using a suggested code that Burt posted and my revised daughter board we have some success.
    Using the schematic w/ daughter board LED D1(out1) comes on then several seconds later LED d2 (out3) comes on.
    Going to look over the code and hopefully figure out what and why. I probably should use pull ups on the RC4(SDI) and RC5 (clock). Might make a difference or it should.
    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 =20
    //Config OSC = INTIO67
    //Include "intio8.bas"
    Include "shift.bas"
    Include "utils.bas"
    Include "convert.bas"
     
    Dim SDI As PORTC.4
    Dim CLK As PORTc.5
    Dim LE As PORTC.3
    Dim OE As PORTC.2

     
    Dim DataPin As SDI  
    Dim ClockPin As CLK
    Dim ResetPin As OE
    Dim index As Byte
    Dim X As Byte
    Dim row0 As PORTC.6
    Dim row1 As PORTC.7
    Dim row2 As PORTb.0
    Dim row3 As PORTb.1
    Dim row4 As PORTB.2
    Dim row5 As PORTB.3
    Dim row6 As PORTB.4
    Dim row7 As PORTB.5      
     
    Const data(8)As Byte =(%10000001, %010000010 ,%00100100, %00011000, %00011000, %00100100, %01000010, %10000001)
     
    Sub StartScan()
       
       
        LE = 0
        ResetPin = 1
        Shift.Out(MSB_FIRST, X, 8)
        LE = 1
        DelayUS(10)
        ResetPin = 0
    End Sub
    Shift.SetOutput(DataPin)
    Shift.SetClock(ClockPin)
    ADCON1 = $07
    Output(ResetPin)
    Output (LE)
    Output (row0)
    While true    
     For index = 0 To Bound (data)
          DelayMS(100)
          X = (data(index))
          StartScan
          DelayMS(100)
     Next
     High(row0)  // enable row1
     Wend
     End
     
  12. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    Mrdeb are you sure your using a 20mhz crystal don't change any thing til you make sure it's 20mhz

    Because what your saying sounds like you are using a 4 mhz if 4 mhz the delayMS (100) would be four time longer whitch would be almost a second before led changes maybe a little longer counting the loop
     
    Last edited: Nov 15, 2012
  13. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    I discovered my issue
    I have only one row enabled. Need to insert a FOR NEXT loop to index each row.
     
  14. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    Well I did a test with the 10F200 looks good here a sample with the pickit2 Logic Tools the Analyzer
    [​IMG]
     
  15. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,201
    Likes:
    111
    Location:
    Seattle, WA
    Since MrDeb is protesting that he's being picked on, I think it's fair to document all of his posts on this subject. Well, many of his posts, since it;s impossible to find them all with the confusing topic titles. Many people, myself included, are happy to offer some guidance with a project. This help usually involved a small number of back & forth posts to clarify some concept or misconception and then the original poster is off on the right path to a solution. Sadly, this isn't the case with MdDEB as the following illustrates.

    programming a byte on one pin ( 6 pages)

    led MATRIX CURRENT DRAW ( 20 pages)

    bi color matrix ( 2 pages)

    wireless communication ( 7 pages)

    LED resistor ( 2 pages)

    Bike project re visited (7 pages)

    Rf link kit from Seeed (8 pages)

    Bi-Color matrix ( 7 pages)

    using SPI in swordfish (only 1 page)

    Experimenting w/ TLC5916/17 (only 1 page)

    The above links cover 61 forum pages on the same topic. MrDEB tends to ask questions as a first step rather than doing any research or doing any experimentation. When somebody does address the question, it's often a wasted effort, as so many changes have occurred in a random way, the answer is no longer appropriate.

    MrDEB would be well served to respect the time of people who try to help him. He can do this by first attempting to solve his own problem before asking a question and to provide accurate information when he does ask a question.

    MrDEB will protest that all of this is unjust. His 3,485 posts here and 1361 at Digital-DIY, the majority of which are asking for help show that these remarks are accurate.

    And finally, you may wonder why I have attempted to help MrDEB. I hate to see him flailing around with nobody helping him. I always hold out some hope that at some point all this will make sense for him. But my help isn't appreciated, so he's on his own now.

    Jon
     
    Last edited: Nov 15, 2012
  16. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    MrDeb I had to change my drawing there's no wpu on gp2 just gp0 gp1 and gp3
    Here the up date and the hex that outputs the 3 signals
    View attachment 68660

    The code is fully tested it will output 3 button presses now the not as long as in the drawing there like this
    8mS start bit then 1mS 8 bits on sw1 then 2mS 8bits on sw2 and 4mS 8 bits on sw3
    The Hex is fully tested and works on a 10f200 chip

    And I may should of change the name of the hex but as always I tested my chip with a blinky to make sure the chip ran ok then changed that to The Tx 3 button code
     
    Last edited: Nov 16, 2012
  17. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    Thanks Burt now I need to get some 10F200's as well.
    PROTESTING?? is that what you call it. I call it the truth.
    Asking questions to learn is better than sitting in the dark not doing anything. What I can't understand is I follow suggestions but then you change the rules of the game mid season. You then decide to show your ignorance by using foul language on here as well as DDIY. I pray that someday you will realize your shortcomings when dealing with people.
    Your lucky I saved you from getting booted off Electrotech. Lets see you have been booted off twice that I know of.
     
  18. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    Making lots of progress this morning

    enabled all the rows and changed the MSB to LSB along with a few changes to the CONST arrays. YES I know what MSB and LSB is.
    I need to measure the current draw of the LEDs but according to the data sheet calculations I should be around 18ma. but my math has lots to be desired. Better to actually measure but them LEDs are bright.After changing to LSB I seem to be able to control which LED is supposed to be on. Hopefully I can tweek this code and use on the 5 x 7 matrix using the working code I was using but intergrate the SHIFT.bas into it.
    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 =20
    //Config OSC = INTIO67
    //Include "intio8.bas"
    Include "shift.bas"
    Include "utils.bas"
    Include "convert.bas"
     
    Dim SDI As PORTC.4
    Dim CLK As PORTc.5
    Dim LE As PORTC.3
    Dim OE As PORTC.2

     
    Dim DataPin As SDI  
    Dim ClockPin As CLK
    Dim ResetPin As OE
    Dim index As Byte
    Dim X As Byte
    Dim row0 As PORTC.6
    Dim row1 As PORTC.7
    Dim row2 As PORTb.0
    Dim row3 As PORTb.1
    Dim row4 As PORTB.2
    Dim row5 As PORTB.3
    Dim row6 As PORTB.4
    Dim row7 As PORTB.5      
     
    Const data(8)As Byte =(%00000001, %000000010 ,%00000100, %00001000, %00010000, %00100000, %01000000, %10000000)
     
    Sub StartScan()
       
       
        LE = 0
        ResetPin = 1
        Shift.Out(lSB_FIRST, X, 8)
        LE = 1
        DelayUS(10)
        ResetPin = 0
    End Sub
    Shift.SetOutput(DataPin)
    Shift.SetClock(ClockPin)
    ADCON1 = $07
    Output(ResetPin)
    Output (LE)
    output(row1)  // enable row1
    output(row2)
    output(row3)
    output(row4)
    output(row5)  // enable row1
    output(row6)
    output(row7)
    While true    
     For index = 0 To Bound (data)
          DelayMS(1000)
          X = (data(index))
          StartScan
          DelayMS(1000)
     Next
     High(row1)  // enable row1
     High(row2)
     High(row3)
     High(row4)
     High(row5)  // enable row1
     High(row6)
     High(row7)

     Wend
     End
     
  19. Pigskin Tony

    Pigskin Tony New Member

    Joined:
    Aug 20, 2012
    Messages:
    18
    Likes:
    0
    My CRITICAL THINKING says the switching form MSB-first to LSB-first just reverses the order the 8 bits are sent out and just just change the direction of the pattern.

    If this isn't the case, some of the data must not be 8 bits. Tatertoes, you should check your constant values.
     
  20. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    'Yep I just unplug the led board cable and swap ends LOL:eek:
     
  21. MrDEB

    MrDEB Active Member

    Joined:
    Apr 16, 2007
    Messages:
    4,414
    Likes:
    23
    Being AT ONE with TLC5916

    I was just experimenting with different changes to the code to see what effect it has on the output. Been trying to figure out the math using the app notes. I guess I am close as I used a 1k resistor and come up with 18ma per green LED.
    This will probably change?? when I use the high side driver and 9volts. MAYBE. Will see when I get that far but using 4-5vf LEDs at 9v.
    In the mean time going to experiment with what I have so far, one TLC5916, One 18F2420 and eight LEDs (green and red)
     

Share This Page