Shop OBEX P1 Docs P2 Docs Learn Events
Model Railroad Fast Clock — Parallax Forums

Model Railroad Fast Clock

Roy CarlsonRoy Carlson Posts: 46
edited 2007-10-24 20:10 in General Discussion
I would like to create a model railroad FAST CLOCK for use on my layout using the·SX Chip and a serial LCD, LCD APP MOD·or 7 Seq LED display.

The purpose of the fast clock is to speed up real time for running model train operating sesions.· For example, If the operating session will last 2 hours, we would want the clock to show a full 24 day in only 2 hours.· The software must allow for setting the session time frame with a start and a pause feature (for derailments or breaks).

I have used the BS2 with the RTC chip and know how to display the real clock screens but wasn't sure if this would be needed for this project.· I guess it would be good to have the real clock and the FAST Clock displayed on the same screen together or toggled.

I have the LCD APP MOD display with the four buttons - I could use this for the clock display and use the buttons as the inputs for setting the real time, start, pause, and scale modes.

I could increment the scale modes in even hours·or 30 minute increments to keep things simple.

Do you think I should use a software routine to take the real time and modify it for the FAST CLOCK or use some form of a·software timming sequence·using a count or other routine?

Any help or ideas are greatly appreciated.

Roy

PS - Any ideas on how to backlight the LCD APP MOD?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Roy Carlson

904-536-7405
roy-kathycarlson@msn.com

Comments

  • PolywogsPolywogs Posts: 28
    edited 2007-10-21 23:20
    ···· I think a subroutine with an adjustable rate is what you want. To be able to scale the the Fast Clock period to the session period would be a must.· (Current Time)/(Total Time) *(Fast Clock Period Total) = (Current Fast Clock)

    ·· The interface should be simple enough for kids to figure out, this will give you the greatest efficiency of fun.



    ··· Program it for modbus if an interface to a computer is needed.
  • John CoutureJohn Couture Posts: 370
    edited 2007-10-22 02:18
    Real Time Clock chips (i.e. PCF 8583) typically require a 32.... Khz crystal. What if you hooked it up to a faster crystal?

    Or, again an RTC outputs a 1Hz pulse, you could use that to trigger a counter that increments the "software" clock 12 units (24 hours = 2 hours is same as 12 hours = 1 hour).

    Or if "precise" time is not needed, just keep a couple of counters (day, hour, minute second) and display them. Update them (i.e. add 12 units every seconds). Add a button in there that will stop the clock (Ah to power to STOP TIME, people will think you are a wizard!). Jon Williams wait_ms() routine with parameters like wait_ms(4,250) will give you a one second delay. With parameters like 1,83 will give you APPROXIMATELY your fast clock (1000/12)

    BTW a cool RTC board is available here for only $7 USD (if you were to compare this to designing your own board, getting the battery and holder and all of the components together, you would see this is a real bargain)

    http://www.futurlec.com/Mini_PCF8583.shtml

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John J. Couture

    San Diego Miramar College
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-10-22 12:26
    You may also want to look at the DS1307 also from Futurelec. They also have a mini board for $7 and there are lot's of DS1307 examples on this forum. I will probably get one on my next order with them. (but I do have one built onto my Professional development board already). I have worked mainly with the DS1302 in my projects because of simplicity but the DS1307 has I2C control making it very expandable on an SX-28 or also Basic Stamp with some additional code writing (depending on BS2 model).

    http://www.futurlec.com/Mini_DS1307.shtml

    Here is a DS1302 (not DS1307) project I did using an SX-28 and·LCD:

    http://forums.parallax.com/showthread.php?p=643780




    Post Edited (T&E Engineer) : 10/22/2007 12:31:09 PM GMT
  • PolywogsPolywogs Posts: 28
    edited 2007-10-24 08:32
    ····· http://www.futurlec.com is a really neat link.
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-10-24 09:59
    Yea I really like them for their diverseness of products and cheaper prices. However, their website updates are not often.

    There cheapest shipping rate is·low ($4) but you will wait a couple of weeks as (at least for me) items ship from Thailand. I have tried their next higher shipping rate (big jump in cost)($16) - but it got here in only a 2-3 days.

    [font=arial,helvetica,verdana color=#c41010 size=3]USA, Canada, UK, European Union(EU) and Australia[/font]
      [size=+1]Standard Post [*]For orders up to US$29, Delivery Charge - US$4.00. [*]For orders US$30 to US$49, Delivery Charge - US$6.00 [*]For order US$50 to US$99, Delivery Charge - US$9.00 [*]For order US$100 and above, Delivery Charge - US$14.00
        [size=+1]Express Post[/size] [*]For orders up to US$99, Delivery Charge - US$16.00. [*]For order US$100 and above, Delivery Charge - US$33.00
          [size=+1]Courier[/size] [*]For orders up to US$99, Delivery Charge - US$33.00. [*]For orders US$100 and above, Delivery Charge - US$66.00 [/size]
        • JonnyMacJonnyMac Posts: 9,216
          edited 2007-10-24 14:24
          At the risk of stating the obvious... you could synthesize an RTC using a simple interrupt and by using a variable count for milliseconds, scale the speed of your clock from there. Right?
        • BeanBean Posts: 8,129
          edited 2007-10-24 15:13
          I agree with Jon. Why use an RTC chip when you aren't using "real" time anyway ?

          If you made an interrupt that triggered every 1 millisecond, you could use a word counter and be able to scale the seconds from that.

          If you made the counter start at 1000 you would get real time. If you started the counter at 100 you could get 10x real time (6 seconds to the minute). Starting the counter at 83 would give 12x real time. You would 24 hours in only 2 hours.

          Bean.

          ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
          My goal is to live forever...Or die trying.
          - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          www.hittconsulting.com
          ·
        • RobotWorkshopRobotWorkshop Posts: 2,307
          edited 2007-10-24 15:35
          I think the approach that Jon and Bean suggest is probably the best one for your application. To adjust the time you could use a potentiometer connected to the ADC on the SX48 and use that to scale the time. The Interrupts would occur at a fixed internal but you could use a variable (based on the ADC reading) to control how many times through the interrupt handler it would take for each of your virtual time intervals.

          I'd just build it on one of the $10 SX48 protoboards that Parallax sells. You could also add checks for special "times" within your program and let it control relays, etc which can control events on your layout. The SX48 has lots of I/O and you should have pins and code space to spare.

          If you like building circuits on a regular solderless breadboard first I do have a version of the SX48 in a nice 40-pin DIP form factor with a serial port and regulator onboard.

          Good luck with your project!

          Robert

          Post Edited (RobotWorkshop) : 10/24/2007 3:51:14 PM GMT
        • Roy CarlsonRoy Carlson Posts: 46
          edited 2007-10-24 20:10
          I was just checking the forum during a break at my work and boy you all are terriffice.

          I like your ideas and will try them over the weekend. I have the SX28 board but not the SX48.

          I did like the idea of using the RTC chip to display the real time and could either use a LCD or 7 Seg display with a toggle to display real time or the fast clock time.

          I could use a simple toggle button to switch the scale to compress a 24 day into 2, 3, 4, 6 or real time.

          I think the application would warrant a button to start the day at 8 AM for the operating session.

          I think I could use the MAX chip to display time to 7 segments which would keep things to a minimum.

          Roy

          ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


          ·
        Sign In or Register to comment.