Jump to content

enl

Members
  • Content Count

    341
  • Joined

  • Last visited

  • Days Won

    22

Reputation Activity

  1. Like
    enl reacted to xxx1 in 2015 Black Friday/Thanksgiving Deal List   
    Another one:
    http://www.icstation.com
     
     

  2. Like
    enl got a reaction from bluehash in 2015 Black Friday/Thanksgiving Deal List   
    Saelig: http://www.saelig.com/category/CW.htm?utm_source=2015+Cyber+Week+Pre-Order+%28A%29&utm_campaign=Cyber+Week+Pre-Order+Event++%28A%29&utm_medium=email
  3. Like
    enl reacted to Fmilburn in [POTM] Blue Angels F-18 Costume   
    This project is a submission for the 2015 Project of the Month Halloween contest.  It came about as a request from my four year old grandson after he had seen the Blue Angels fly over during Seafair in Seattle.

    The basic air frame was constructed from two cardboard boxes as shown in the photograph below.
    .
    The boxes are attached to each other with brads and hot glue.  Edges are reinforced where I felt necessary by folding extra cardboard over or gluing in reinforcement cardboard.  Also shown in the photograph above are the following:
    wings, tail, and fins constructed from a corrugated plastic storage box and hot glued in place reflector on the nose constructed from a coffee can bottom which will eventually become the "search light".  There is a similar reflector on the tail which will become the jet exhaust. control panel with various switches and a potentiometer I had in my junk box installed on a wooden paint stirring stick The visible surfaces were then covered with wrapping paper using Outdoor Mod Podge - a waterbased sealer, glue and finish available in craft stores in the United States.  A second coat was then put on to make it a bit more waterproof.

    This is the schematic for the avionics.
     
    A little custom MSP430G2553 board with two AA batteries beside it in the tail controls an Adafruit neopixel ring "jet exhaust" with a toggle switch on the panel to turn it on and off.  Everything else runs off of three AA batteries with the wiring in the front of the aircraft between a cardboard firewall and the nose.  Two latching buttons turn colored LEDs on the panel on and off while a third turns a 3W LED (searchlight) on and off.  There is a potentiometer to control the brightness of the searchlight.  Finally I repurposed the sound board and speaker from an old greeting card that was originally powered by a coin cell.

    The WS2812 Adafruit Neopixel ring is controlled by the MSP430G2553. I used the library posted by ILAMtitan at 43oh - so full credit to those who had a hand in developing it.  The library example worked well as is for my purposes and about the only thing I changed was the output pin and the number of pixels being controlled in the code.
     
    Here is a picture of my grandson trying it out. We glued plastic cups over the headlight and jet exhaust and stuck Energia stickers on it.  I may touch it up a bit more if I have time and post a final picture.

     
    Improvement Ideas:  I also made a "candy counter" out of an old scale for his entertainment (and mine).  His immediate reaction was that we should somehow attach the candy counter to the airplane.  Clever, but not practical due to the need for the scale to be level and not banged around by a four year old.  Using a counter where candy is funneled past a beam, like Chicken did with his counter might work though.  My idea is that we add GPS along with thumbs up/down buttons.  Then he could rate offerings and either store the data as a reminder for next year or send it out over the IOT with location so that his buddies know where the good candy is.
  4. Like
    enl reacted to bluehash in Oct 2015 - 43oh Halloween Contest   
    Hi Team,
    If you are keeping a close watch on @@enl's Halloween projects, anyone? thread, we created a small contest. This is a little late in the month.. but there are prizes to be had!
    Showcase your Halloween project here..whether it is a costume or anything done at home to scare people.
     
    How To Enter
    To submit your entry, make an entry into this thread with the following:
    Start a build thread in any of the following Project subforums - MSP, Tiva-C, CCXXXX, C2000 or BeagleBone. This will enable members to ask you questions and comment on your project. Please post: a small description of your project. a picture or video of your setup Code. Schematic and/or board files. In this thread, post a small description of your project. a picture or video of your setup.  
    Prizes
    The winners will get to choose any prize from the pool in order of 1st, 2nd, 3rd, 4th..etc. Thanks to @@abecedarian for sponsoring the prizes.
    Radio Shack Motor Pack, value = $39.95 USD (donated by abecedarian) WIZwiki W7500, value = $45.00 USD (donated by abecedarian) RaspPI B+(donated by abecedarian) Your choice of $25 giftcard from Sparkfun, Adafruit or anyplace that sends giftcards electronically. I can even Paypal it to you if you are not interested in a card. Same as above, but $20. Dev board from TI <$20. Dates
    - Voting begins on Nov 1st.
    - Entries due October 31st.
     
    Rules :
    - You must be a member of the 43oh forum at least a week before your submission or have at least 5 posts in the forums, for your entry to be considered when the voting begins.
    - One entry from each member will be permitted.
    - Your design has to be open source. if you can, select a license from here or here. 43oh will not claim any ownership.
    - Your project can be anything based around TI Micro-controllers. You may interface any of TI's controller to another controller. But try to keep TI as the main controller.
    - You may reuse code from anywhere as long as you give credit to the original author.
    - You must submit code and schematics of your project with a proper description.
    - You can submit your project, if it was created before the announcement of the contest.
    - Previous entries in other 43oh contests will not be permitted.
  5. Like
    enl got a reaction from vinicius.jlantunes in SMD soldering practice kit - assembly   
    Better than my first experience with the 0603 by hand. To the extent that I do anything this size by hand (not much as I am too shakey and my eyes are shot), I use a solder paste rather than wire. Holds the component in place, easier to get the appropriate quantity, and leaves my other hand free to hold the component down with a dental pick so I don't displace it. I would definitely suggest getting several small tips, both points and chisel end.
     
    If you want to experiment with tip shape, file an old tip to the shape you want to try. It won't last too long once filed, as the core alloy-- usually copper based-- will erode from heat driven oxidation and flux action, but it is a good way to try different point geometries before buying new tips.
  6. Like
    enl reacted to Fmilburn in Halloween projects, anyone?   
    Got it more or less finished and just need to do some touch up.  This is what inspired it...

    This is the airframe and control panel put together.  It consists of two cardboard boxes with corrugated plastic wings cut out of a discarded storage box.  The panel is made from a paint stirring stick and the switches, pot, and buttons are recycled from other projects or stuff I tore apart.  The lights are mounted on coffee can lids and covered with plastic cups from something we ate.  Everything is held together with hot glue and brads.

    I went to the dollar store and got some blue and yellow wrapping paper and glued it to the airframe with outdoor Mod Podge (works great for this sort of thing).  Then I put another coat of Mod Podge on it for strength and some lacquer to help weather proof it a bit.

    This is the avionics ready to be installed.  There is a 3W LED for a searchlight in front and an Adafruit 24 light neopixel ring in back (not shown) that is driven by a special built MSP430 and Energia.  The searchlight can be dimmed or brightened with a potentiometer.  The sound comes from an old greeting card I tore apart and repurposed.  The other buttons light up LEDs on the panel.

    We also decorated it with an Energia sticker.  Here it is being taken for a test flight.  It has pretty good maneuverability - he missed the brick wall.

    It does look like it was made from a cardboard box and it lacks the lines of the original but the customer is happy.
  7. Like
    enl got a reaction from bluehash in SMD soldering practice kit - assembly   
    Better than my first experience with the 0603 by hand. To the extent that I do anything this size by hand (not much as I am too shakey and my eyes are shot), I use a solder paste rather than wire. Holds the component in place, easier to get the appropriate quantity, and leaves my other hand free to hold the component down with a dental pick so I don't displace it. I would definitely suggest getting several small tips, both points and chisel end.
     
    If you want to experiment with tip shape, file an old tip to the shape you want to try. It won't last too long once filed, as the core alloy-- usually copper based-- will erode from heat driven oxidation and flux action, but it is a good way to try different point geometries before buying new tips.
  8. Like
    enl got a reaction from Taggsladder in Learning transistors and I have a problem :)   
    Depending on the application, you might try a latching relay instead.
     
    In a low power ap, you can't beat them, but there are a few drawbacks, such as they do not drop out on power loss like a standard relay. Even in a non-low power ap, not needing to power the coil continuously is a nice feature. If you haven't seen a latching relay, among other places you see them is in electronic thermostats.
  9. Like
    enl got a reaction from Taggsladder in Learning transistors and I have a problem :)   
    Q4 is going to see greater than 20Vgs, and may fail. Generally not a lot of leeway in these ratings. I wouldn't even count on a long life if you are running at just below 20V, as even small transients beyond 20V can damage the FET.
     
    As for the two BJT's, I don't see any particular issue with Q2 until the gate of Q4 fails, as there shouldn't be dissipation greater than about 225mW while switching for Q2 at 30V supply (15mA*15V), and a few mW when full on. That shouldn't be sufficient to lead to heating issues. Once the gate fails for Q4, though, there is indeterminate current limiting for the collector of Q2, and likely Q2 will fail.
     
    I would also put a 100K to ground from the base, though, to prevent leakage from turning it on, as the LED in the base line keeps the output pin from pulling it hard off.
     
    I can say nothing about Q1 failing without knowing the diode you used. What is its reverse breakdown?
     
     
    Once you are switching a load, things get more involved, as the dissipation in Q1 can be significant, especially if Ib is deficient. You need about 10mA Ib to hold the transistor in saturation at 200mA Ic, and I don't think you will have that here, which means you may end up with significant dissipation under load, if you are running at 200mA. You may also have dissipation issues with Q4 under load, but I am too lazy to look up the full data sheet right now. Things may be OK-- unless there is a major issue looking at the data sheet, I would go with this as a start for 100 to 200mA-- but I wouldn't put a product in the field without a lot of testing, as you are closer to the bounds than I might be comfortable with based solely on a paper design.
  10. Like
    enl got a reaction from dubnet in Learning transistors and I have a problem :)   
    Q4 is going to see greater than 20Vgs, and may fail. Generally not a lot of leeway in these ratings. I wouldn't even count on a long life if you are running at just below 20V, as even small transients beyond 20V can damage the FET.
     
    As for the two BJT's, I don't see any particular issue with Q2 until the gate of Q4 fails, as there shouldn't be dissipation greater than about 225mW while switching for Q2 at 30V supply (15mA*15V), and a few mW when full on. That shouldn't be sufficient to lead to heating issues. Once the gate fails for Q4, though, there is indeterminate current limiting for the collector of Q2, and likely Q2 will fail.
     
    I would also put a 100K to ground from the base, though, to prevent leakage from turning it on, as the LED in the base line keeps the output pin from pulling it hard off.
     
    I can say nothing about Q1 failing without knowing the diode you used. What is its reverse breakdown?
     
     
    Once you are switching a load, things get more involved, as the dissipation in Q1 can be significant, especially if Ib is deficient. You need about 10mA Ib to hold the transistor in saturation at 200mA Ic, and I don't think you will have that here, which means you may end up with significant dissipation under load, if you are running at 200mA. You may also have dissipation issues with Q4 under load, but I am too lazy to look up the full data sheet right now. Things may be OK-- unless there is a major issue looking at the data sheet, I would go with this as a start for 100 to 200mA-- but I wouldn't put a product in the field without a lot of testing, as you are closer to the bounds than I might be comfortable with based solely on a paper design.
  11. Like
    enl got a reaction from tripwire in Halloween projects, anyone?   
    @fmilburn:
     
     
    F117 is straightforward.. One of the better patterns is at http://users.ece.cmu.edu/~koopman/airplanes/f117/
     
    There are others, including some very nice origami, but I fear trying to scale origami up to costume size might require 0.5mm aluminum aircraft aluminum skin rather than cardboard to be manageable yet stiff enough when done..
  12. Like
    enl got a reaction from Fmilburn in Halloween projects, anyone?   
    @fmilburn:
     
     
    F117 is straightforward.. One of the better patterns is at http://users.ece.cmu.edu/~koopman/airplanes/f117/
     
    There are others, including some very nice origami, but I fear trying to scale origami up to costume size might require 0.5mm aluminum aircraft aluminum skin rather than cardboard to be manageable yet stiff enough when done..
  13. Like
    enl got a reaction from Fmilburn in Newbie - need help in choosing LaunchPad model   
    @@JohnDough --
     
    The MSP430G launchpad kit includes a 32.768KHz crystal. It is not installed and you will need to solder it on place. I would not call it a beginner soldering job, but it isn't bad as small components go. I would use the supplied crystal, as it will fit the pads on the board and is matched to the internal oscillator driver. You will need to check the specs before programming if you use a different one, as you may need to change the load capacitance from the sample code.
     
    ULN2803 is fine with the LED displays you selected, but see the following for why I don't think you want to go this way.. They are common anode, so each channel of the IC will pull down a a segment for each display, power supply permitting.
     
    The non transistors are not what you want for the high side at 3.3V, as you will drop 1V (give or take) across the uln2803, and another 0.7V across the npn transistor (maybe more with drop in the MSP430 output) on the anode since it will need to be used as an emitter follower. This leaves about 1.6V for the LED and current limit resistor. The LED needs 1.8 min (up to 2.2v), and it is a good idea to have at least 0.5v minimum across the limit resistor, with 1.0v or more being better. You won't get the segments to light reliably, much less be able to balance the current through them to get uniform brightness-- the brightness is proportional the current.
     
    Given this, I would suggest following the advice to use an integrated OLED display, if you can. If you want to go with the 7-seg units, there are a few options that I will outline:
     
    1) Use a pnp transistor in common emitter at the anodes with an npn to ground as a first gain stage from the MSP430 output. You will need current limiting resistors at the bases of the npn, and between the pnp bases and npn collectors.
     
    2) use a low drop LED current driver array instead of the uln2803, if you can find one with lower than 0.5V drop. Then you won't need limit resistors for the LED segments, as that will be done by the IC (using current mirrors internally).
     
    3) Use a higher drive voltage for the LEDs. This will require a little more work for the anode switching, but option1 will do the trick. Using this with option 1 lets you use a larger limit resistor for the LED segments, giving more uniform brightness. Note that the schematic on the page you linked to is for an arduino, which runs at 5V, thereby providing some margin for the current limit resistor.
  14. Like
    enl got a reaction from Fmilburn in Newbie - need help in choosing LaunchPad model   
    As an additional note, if you are willing to let the brightness be moderately low, you could get by without the uln2803, as each output will only  be driving a single led at a time, and use the npn transistor as an emitter follower. The display you selected is 20mA max continuous, 30mA peak. The outputs of the MSP430g2553 can sink 20mA with about 0.5V to 0.7 drop at 3.3V (SLAS735J fig7), and a total of 48mA sink or source (SLAS735J P24), and will have a drop of a bit less than 0.25V at 5mA sink. This suggests to me that if you limit the current of the LEDs to 5mA or so, you can pick them based on a drop of 3.3V-2V-0.6V-0.25V=0.45V (drop at 5mA from graph, emitter follower drop presuming <0.5mA base current at high, and midrange drop of LED) with a max sink of 35mA. This is in the safe, if not ideal, region of design, giving a limit resistor of 100 ohms (nominal current will be about 4.6mA). At 91ohms (5% series, but not one many people keep in the quantity of the factors of 10) you would be, nominally, right at 5mA, but with brightness more sensitive to variation in components. at 120ohms, you'd be at 3.75mA. As I said, going this way you will be at the dim side. The 100ohm will put you at about 1/2 or a tad less of the perceived max brightness for a single display run without multiplex. The numbers make it look like about 1/13 (1/3 of 1/(20/4.6)), but, due to the flicker of multiplexing, it is perceived brighter than the actual average, and the human eye is non-linear on top of that.
     
    Would I do it this way for NASA? no. For a commercial product? This is a lot less sketchy than many things done in commercial products, and is well within the data sheet specs, so I absolutely would, given the savings in component cost and size.
     
     
    Edit: attach circuit schematics to show described options, drawn crudely with clipart and MS PAINT, because they are handy on my beater laptop. I don't think I made any major errors.
     
    Edit 2: left out the base resistor on the bottom right. I really shouldn't do these on MSpaint during a useless meeting......

  15. Like
    enl got a reaction from dubnet in Newbie - need help in choosing LaunchPad model   
    @@JohnDough --
     
    The MSP430G launchpad kit includes a 32.768KHz crystal. It is not installed and you will need to solder it on place. I would not call it a beginner soldering job, but it isn't bad as small components go. I would use the supplied crystal, as it will fit the pads on the board and is matched to the internal oscillator driver. You will need to check the specs before programming if you use a different one, as you may need to change the load capacitance from the sample code.
     
    ULN2803 is fine with the LED displays you selected, but see the following for why I don't think you want to go this way.. They are common anode, so each channel of the IC will pull down a a segment for each display, power supply permitting.
     
    The non transistors are not what you want for the high side at 3.3V, as you will drop 1V (give or take) across the uln2803, and another 0.7V across the npn transistor (maybe more with drop in the MSP430 output) on the anode since it will need to be used as an emitter follower. This leaves about 1.6V for the LED and current limit resistor. The LED needs 1.8 min (up to 2.2v), and it is a good idea to have at least 0.5v minimum across the limit resistor, with 1.0v or more being better. You won't get the segments to light reliably, much less be able to balance the current through them to get uniform brightness-- the brightness is proportional the current.
     
    Given this, I would suggest following the advice to use an integrated OLED display, if you can. If you want to go with the 7-seg units, there are a few options that I will outline:
     
    1) Use a pnp transistor in common emitter at the anodes with an npn to ground as a first gain stage from the MSP430 output. You will need current limiting resistors at the bases of the npn, and between the pnp bases and npn collectors.
     
    2) use a low drop LED current driver array instead of the uln2803, if you can find one with lower than 0.5V drop. Then you won't need limit resistors for the LED segments, as that will be done by the IC (using current mirrors internally).
     
    3) Use a higher drive voltage for the LEDs. This will require a little more work for the anode switching, but option1 will do the trick. Using this with option 1 lets you use a larger limit resistor for the LED segments, giving more uniform brightness. Note that the schematic on the page you linked to is for an arduino, which runs at 5V, thereby providing some margin for the current limit resistor.
  16. Like
    enl got a reaction from bluehash in Share pics of your workspace setup   
    http://forum.43oh.com/topic/2896-post-a-pic-of-your-home-work-bench-get-a/
  17. Like
    enl got a reaction from yyrkoon in Share pics of your workspace setup   
    http://forum.43oh.com/topic/2896-post-a-pic-of-your-home-work-bench-get-a/
  18. Like
    enl got a reaction from zeke in What are you doing right now..?   
    Needed a new board vise that would sit flat. The old linemaster is not quite the thing for some jobs, and is kinda a pain to crank, though it is real solid and heavy.
     
    This was out of the scrap bin in about an hour. 1/2" square tube, 1/4" rod, a spring from the junk pile, and a thumbscrew. Mots time consuming part was tapping the holes. No tools more advanced than a handheld drill and a hand tap and hand die (for the end of the rod). There is a nut inside the tube to jam with the nut on the rod end. I was trying to figure how to mill a tapered grip on a chunk of ABS from the scrap bucket, then I said to myself: "self, it is only going to be a taper edge to just grip the top of the board and hold it down. Why not give more room by using flat head (countersink) screws". So I did.
     
    Rubber baby buggy bumpers on the bottom for gription.
     
    Edit: fixing really embarrassing typos. Ok, I'm not really embarrassed... and adding pic holding board



  19. Like
    enl got a reaction from bluehash in What are you doing right now..?   
    Needed a new board vise that would sit flat. The old linemaster is not quite the thing for some jobs, and is kinda a pain to crank, though it is real solid and heavy.
     
    This was out of the scrap bin in about an hour. 1/2" square tube, 1/4" rod, a spring from the junk pile, and a thumbscrew. Mots time consuming part was tapping the holes. No tools more advanced than a handheld drill and a hand tap and hand die (for the end of the rod). There is a nut inside the tube to jam with the nut on the rod end. I was trying to figure how to mill a tapered grip on a chunk of ABS from the scrap bucket, then I said to myself: "self, it is only going to be a taper edge to just grip the top of the board and hold it down. Why not give more room by using flat head (countersink) screws". So I did.
     
    Rubber baby buggy bumpers on the bottom for gription.
     
    Edit: fixing really embarrassing typos. Ok, I'm not really embarrassed... and adding pic holding board



  20. Like
    enl got a reaction from tripwire in What are you doing right now..?   
    Needed a new board vise that would sit flat. The old linemaster is not quite the thing for some jobs, and is kinda a pain to crank, though it is real solid and heavy.
     
    This was out of the scrap bin in about an hour. 1/2" square tube, 1/4" rod, a spring from the junk pile, and a thumbscrew. Mots time consuming part was tapping the holes. No tools more advanced than a handheld drill and a hand tap and hand die (for the end of the rod). There is a nut inside the tube to jam with the nut on the rod end. I was trying to figure how to mill a tapered grip on a chunk of ABS from the scrap bucket, then I said to myself: "self, it is only going to be a taper edge to just grip the top of the board and hold it down. Why not give more room by using flat head (countersink) screws". So I did.
     
    Rubber baby buggy bumpers on the bottom for gription.
     
    Edit: fixing really embarrassing typos. Ok, I'm not really embarrassed... and adding pic holding board



  21. Like
    enl got a reaction from Fmilburn in What are you doing right now..?   
    Needed a new board vise that would sit flat. The old linemaster is not quite the thing for some jobs, and is kinda a pain to crank, though it is real solid and heavy.
     
    This was out of the scrap bin in about an hour. 1/2" square tube, 1/4" rod, a spring from the junk pile, and a thumbscrew. Mots time consuming part was tapping the holes. No tools more advanced than a handheld drill and a hand tap and hand die (for the end of the rod). There is a nut inside the tube to jam with the nut on the rod end. I was trying to figure how to mill a tapered grip on a chunk of ABS from the scrap bucket, then I said to myself: "self, it is only going to be a taper edge to just grip the top of the board and hold it down. Why not give more room by using flat head (countersink) screws". So I did.
     
    Rubber baby buggy bumpers on the bottom for gription.
     
    Edit: fixing really embarrassing typos. Ok, I'm not really embarrassed... and adding pic holding board



  22. Like
    enl got a reaction from bluehash in What are you doing right now..?   
    DIY camera for the 'scope. The 'Scope itself is a Nikon stereo zoom I picked up for a gloatable low price, that has an oddball camera port. Two ports, one left and one right, but the optics for them are non-standard, so no way I can afford commercial cam optics. Best price I have found used is still over $1000, without a camera. This is trial run for a better quality and resolution setup.
  23. Like
    enl got a reaction from bluehash in What are you doing right now..?   
    Well, finally woke back up, got real work done (one of the ways I make a living), and for those that are interested, have pics of the $3ish junkpile microscope cam. I did finally get the focus in in sync with the eyepieces. Just a real tight focal plane. If anyone wants pics and complete description, let me know. Otherwise, attached is a pic of the final product. And, yes, that is a handlebar clamp. The second time I pulled the camera off and had to try to re-align and find the focal plane, that went on to make it easy to find location. I was going to make up a shim to go between the registration faces in teh tube, but this is good enough, so I didn't bother.

  24. Like
    enl got a reaction from ElevenToes in Project Help - Digital Command Control(DCC) Operation Using a timer   
    There really isn't much to it.
     
    In many contexts, it can get quite involved, but in a straightforward application on a small processor like the MSP430, you can keep it simple.
     
    Def (working): Semaphore: A signal made available by one function for to indicatte a status or condition to one or more other functions, outside the standard call-return or exception models.
     
    For your application, I would define an external (global; outside all functions) volatile (signal to the compiler that the variable can be changed from more than one place in an unsynchronized, unchecked, and independent manner, so that ANY access to the variable it via memory, not via temporary use of a processor register) integer that the interrupt handler sets to some value when a bit is complete, and the main loop watches to know when to prep the next bit.
     
    For example: the semaphore value might also act as the timer increment, and the main loop looks for it to be reset to 0
    // at header of code // outside any function volatile unsigned int nextbitcount=0; // ... // ... // ... // in main loop // ... // ... // wit for the interrupt routine to be done with bit while (nextbitcount) { // nextbitcount!=0 } // not ready for new value if (dataval &0x0080) { // is MSb of current byte a 1? nextbitcount = 58; } else { nextbitcount = 100; } dataval = (dataval <<1);; // shift to bring next bit to MSb // in interrupt handler // ... // ... // the bit being used for output is in var outputbitmask // if it is, for example, P1.5, outputbitmask is set by // #define outputbitmask 0x20 P1OUT ^= outputbitmask; // flip output bit CCR1 += nextbitcount; // time for next interrupt if (P1OUT & outputbitmask) { // was output set to high? lots of ways to test this // in second half cycle... time to update in main loop nextbitcount=0; // reset semaphore } This is not finished code, obviously. Note that there are three  parts: the external var that does double duty-- semaphore to signal condition to main and also communicates the data timing from main to the interrupt handler;the synch loop and bit handler in main (which is at best a model, as the main loop is unlikely to be be locked in a wait like this if it also needs to gather inputs, like throttle position, and sequence the data bytes and sync bits between them...but this is a model), and the interrupt handler, which may actually be pretty much written for you here.
     
    This is a common model, and is used for a wide variety of tasks, including completely independent functions, such as when one interrupt handler needs to talk to another or two unsynchronized threads need to signal each other, though this is about the simplest application, and more by the time you get to multithreaded cases (not happening on the low end MSP430 in all likelyhood, but common in full operating systems like *nix) the signalling is generally done using a more involved library tool.
  25. Like
    enl got a reaction from ElevenToes in Project Help - Digital Command Control(DCC) Operation Using a timer   
    Looking at the standard on the NMRA site (S-9.1 - http://www.nmra.org/sites/default/files/standards/sandrp/pdf/s-9.1_electrical_standards_2006.pdf), the timing isn't terribly tight.
     
    If I were going to implement this, I'd use a single timerA and deal with the outputs in an  interrupt handler. Let the timer free run in continuous, and use CCR1 to set the interrupt time. Each entry to the interrupt, add the appropriate time to CCR1 and change the state of the output as appropriate. There are a number of ways to sequence the bits. I would probably not do it in the interrupt routine. I would use a semaphore to signal the main loop to prep the next bit, and place the value in a shared volatile.
     
    I would run the timer from MCLK, and pretty much any calibrated speed would be fine for this... the timing is really not that tight (52-64us for each half of a `1' pulse) 8MHz clock is MORE than adequate, and 1MHz might even be OK, though the interrupt latency variability might make it sketchy for a receiver that isn't real tolerant. The `0' bits are so loose that timing for them isn't an issue (95 to 9900us for each half cycle, total less than 12000us) This is a perfect application for software handling of the data. For the 8MHz clock, I would set the timer to divide by 8, so it counts microseconds. Interrupt latency will be less than 3/4us (six processor clocks).
     
    There are a number of standard samples showing the basic idea for using the interrupts this way, such as Example 1 in http://www.ccs.neu.edu/home/noubir/Courses/SWARM/S09/slides/msp430-clocks-timers.pdfor on pages23/24 of https://courses.cs.washington.edu/courses/cse466/11au/calendar/04-Interrupts-posted.pdf
     
    A number of the timer examples in the TI MSP430 documents also use the same model.
×
×
  • Create New...