Results 1 to 9 of 9

Thread: Embedded systems...anyone wanna take a stab?

  1. #1

    Embedded systems...anyone wanna take a stab?

    Well I've been staring at this question (from my embedded systems class) for an hour now and can't figure out how to start it. There's no way I'm getting it done in time for class since I have to leave in 15mins, but now I'm just curious how to answer it. Anyone here have an idea how to answer this thing?

    Question (verbatim including grammatical errors):
    Given a 200 MHz crystal-controlled oscillator and a 32-bit and any number of 16-bit terminal-count timers, design a real-time clock that outputs the date and time down to the milliseconds. You can ignore leap years. Binary output is fine. Draw a diagram and indicate terminal-count values for all timers.
    I really want to use a prescaler but it since it doesn't mention the use of one, I don't think I'm allowed to.

  2. #2
    Member verified
    Join Date
    Sep 2010
    Owner Since
    Oct '08 - Oct '10

    Location
    Royersford, PA
    Posts
    3,814
    Blog Entries
    1
    Thanks
    1,059
    Thanked 442 Times in 317 Posts
    It doesn't say you can't use one... If it wasn't allowed, it would say it
    R135
    ╚╬╬╝
    - 24

  3. #3
    At 200mhz, cycle time is 5ns (1/200)

    Terminal-count means that the counter asserts after it reaches some arbitrary value. You can either let the counter run its full course, or stop it with a value within in its range.

    16bit counter gives 65536 clocks (2^16)
    32bit counter gives 4294967296 clocks (2^32)

    It's easier to start at the smallest value and daisy chain them.

    The finest granularity they need is 1 millisecond.
    1ms = 1,000,000ns. Cycle time of 5ns gives 200,000 clocks. So we need the 32bit counter for this.

    Each counter feeds into the next one.
    First 32-bit counter: terminal count of 200,000. This gives miliseconds
    Second 16-bit counter: 1,000. This gives seconds
    3rd counter: 60. Minutes
    4th counter: 60. Hours
    5th counter: 24. Days
    6th counter: 365. Years

    You get the idea. Each counter feeds the next one after it.

    EDIT: I may be off on the exact meaning of a terminal counter. In any case, the principle is the same. I'm not sure why your guy came up with 200mhz. Typical crystal value for a RTC oscillator is 32.768khz. This is very convenient because you can prescale with a power of 2, which lets you cheat when designing the counter and save silicon.
    Last edited by marshallh; 10-13-2010 at 03:43 PM.

  4. #4
    | @/|/| +|2()|/| verified
    Join Date
    Sep 2010
    Owner Since
    December 2009

    Location
    Fox Cities, WI
    Posts
    1,128
    Thanks
    92
    Thanked 18 Times in 17 Posts
    Id say its allowed .

  5. #5
    Man vs 3/S verified
    Join Date
    Sep 2010
    Owner Since
    2003

    Location
    Kingston, WA
    Posts
    1,501
    Thanks
    124
    Thanked 171 Times in 112 Posts
    Quote Originally Posted by marshallh View Post
    At 200mhz, cycle time is 5ns (1/200)

    Terminal-count means that the counter asserts after it reaches some arbitrary value. You can either let the counter run its full course, or stop it with a value within in its range.

    16bit counter gives 65536 clocks (2^16)
    32bit counter gives 4294967296 clocks (2^32)

    It's easier to start at the smallest value and daisy chain them.

    The finest granularity they need is 1 millisecond.
    1ms = 1,000,000ns. Cycle time of 5ns gives 200,000 clocks. So we need the 32bit counter for this.

    Each counter feeds into the next one.
    First 32-bit counter: terminal count of 200,000. This gives miliseconds
    Second 16-bit counter: 1,000. This gives seconds
    3rd counter: 60. Minutes
    4th counter: 60. Hours
    5th counter: 24. Days
    6th counter: 365. Years

    You get the idea. Each counter feeds the next one after it.

    EDIT: I may be off on the exact meaning of a terminal counter. In any case, the principle is the same. I'm not sure why your guy came up with 200mhz. Typical crystal value for a RTC oscillator is 32.768khz. This is very convenient because you can prescale with a power of 2, which lets you cheat when designing the counter and save silicon.
    This post makes me feel slow in the head :/

    Me Mongo, Mongo like candy!!!
    93 R/T - Modded, Full Suspension, Full Exhaust, Quaife Diff, Turbo brakes, Alpine/Boston Sound One of 25
    98 VR-4 - Billet 13t's, Downpipe, Blitz EBC, Ohlins R/T coil overs, SCE center differential, SCE oil pan, Pampena braced trans, TEC Rear Strut Bar, Custom Front Strut Bar, Camber Arms, Alum Driveshaft, 2" Koyo, Maximal oil cooler, SAFC2, Defi Gauges, RC 550's, Supra Pump, Skillard Splitter, Hardpipes, XYZ 14" front brakes/Carbotech, 255 Dunlop Z2's, AMR 18x9's, Alpine/Infinity/JL Sound. One of 13

    3SNG15 Best overall




    "I explode 1 piece rotors" -- ABM --
    Runs 12's (12.98's!!!!!!)
    My Garage

  6. #6
    Forum User
    Join Date
    Sep 2010
    Owner Since

    Posts
    1,187
    Thanks
    4
    Thanked 73 Times in 56 Posts
    Quote Originally Posted by R/T93 View Post
    This post makes me feel slow in the head :/

    Me Mongo, Mongo like candy!!!
    I agree, im gonna color by number to feel better

    -Ricer Evo 8: 8.75 @ 166 Best MPH of 167. Quickest 4G63 Powered Evo in The US!!!
    -Chris Cessna's Stock short block Evo 8: 9.76@150 Worlds Fastest Stock Motor Evo 8 and First Stock Block In The 9's!
    -Shawna's DD Evo 8: 9.97@143.88 Best MPH of 145 Full leather interior, A/C, navigation, stock brakes, cruisin 9's in style
    -Cory's Stock 7 bolt talon: 10.3@136 No crank walk here...
    -STM Stock turbo/motor Stealth RT: 10.95@127 Worlds Quyickest/Fastest and most powerful Stock turbo/ motor 3S
    -James STM built Pump gas Evo8 stock motor: 10.2@137 Stock long block, and only on pump gas!
    -Mike Faggiano Evo3 16g stock motor 1g 11.0@124 just a 16g knockin on 10's door.
    And the list goes on...

  7. #7
    | @/|/| +|2()|/| verified
    Join Date
    Sep 2010
    Owner Since
    December 2009

    Location
    Fox Cities, WI
    Posts
    1,128
    Thanks
    92
    Thanked 18 Times in 17 Posts
    Quote Originally Posted by R/T93 View Post
    This post makes me feel slow in the head :/

    Me Mongo, Mongo like candy!!!

  8. #8
    Quote Originally Posted by marshallh View Post
    At 200mhz, cycle time is 5ns (1/200)

    Terminal-count means that the counter asserts after it reaches some arbitrary value. You can either let the counter run its full course, or stop it with a value within in its range.

    16bit counter gives 65536 clocks (2^16)
    32bit counter gives 4294967296 clocks (2^32)

    It's easier to start at the smallest value and daisy chain them.

    The finest granularity they need is 1 millisecond.
    1ms = 1,000,000ns. Cycle time of 5ns gives 200,000 clocks. So we need the 32bit counter for this.

    Each counter feeds into the next one.
    First 32-bit counter: terminal count of 200,000. This gives miliseconds
    Second 16-bit counter: 1,000. This gives seconds
    3rd counter: 60. Minutes
    4th counter: 60. Hours
    5th counter: 24. Days
    6th counter: 365. Years

    You get the idea. Each counter feeds the next one after it.

    EDIT: I may be off on the exact meaning of a terminal counter. In any case, the principle is the same. I'm not sure why your guy came up with 200mhz. Typical crystal value for a RTC oscillator is 32.768khz. This is very convenient because you can prescale with a power of 2, which lets you cheat when designing the counter and save silicon.
    Winner! This is basically how it's done.

    In case you're wondering, your basic idea of a terminal counter is right except that it will always run to it's max value (16-bit 65536 as you said). But you can adjust the starting aka terminal value so that it doesn't always start from 0.

    Thanks for the response!

  9. #9
    Member verified
    Join Date
    Sep 2010
    Owner Since
    2005

    Location
    Fowlerville, MI
    Posts
    1,251
    Thanks
    42
    Thanked 48 Times in 41 Posts
    Quote Originally Posted by SilverJester View Post
    Winner! This is basically how it's done.

    In case you're wondering, your basic idea of a terminal counter is right except that it will always run to it's max value (16-bit 65536 as you said). But you can adjust the starting aka terminal value so that it doesn't always start from 0.

    Thanks for the response!
    You may be trying to say the same thing, but you'd set a compare register and throw an interrupt when the counter and compare register is equal. Most systems allow a reset of the counter when this interrupt happens.
    '92 Dodge Stealth RT/TT - Aug. 2012 COTM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
The 3000GT/Stealth/GTO Web History Project
3000gt.com
3000GT / Stealth International WWWboard Archive
Jim's (RED3KGT) Reststop
3000GT/Stealth/GTO Information and Resources
Team 3S
3000GT / Stealth / GTO Information
daveblack.net
3000GT/Stealth/GTO Clubs and Groups
Michigan 3S
MInnesota 3S
Wisconsin 3S
Iowa, Nebraska, Kansas 3S
North California 3000GT/Stealth
United Society of 3S Owners
3000GT/Stealth/GTO Forums
3000GT/Stealth International
3000GT/Stealth/GTO Event Pages
3S National Gathering
East Coast Gathering
Upper Mid-West Gathering
Blue Ridge Gathering