Shop OBEX P1 Docs P2 Docs Learn Events
help with sx project — Parallax Forums

help with sx project

derm0derm0 Posts: 6
edited 2007-04-09 16:11 in General Discussion
I am currently trying to·build a digital clock·incorporating the sx28 microcontroller. I have to write assembly code to set the time·and keep the time moving·and to set an alarm on the clock. The clock also·needs to display the time of the day on a standard text LCD. If anyones ever done a design like this or can offer any advice on any part of the assembly code it would be greatly appreciated.
Thanks·

Comments

  • ForrestForrest Posts: 1,341
    edited 2005-01-16 15:45
    Check out the Parallax SX download area - there's an article on interfacing an LCD to the SX
    http://www.parallax.com/sx/downloads.asp
  • Russ61Russ61 Posts: 11
    edited 2005-01-16 17:47
    Derm0,

    A few weeks ago, I chose an alarm clock to be my first SX project.· I wanted to use LEDs so I can see the display at a greater distance though.· You can look at the attached file to see how I set the time (including seconds), alarm time and still keep time and update my display.· I have 4 buttons (Time, Alarm, Hours, Minutes) and 1 switch (Alarm Set).
    I am multiplexing 6 seven segment LEDs with 2 74HC595 shift registers, one for the digits, and the other for the digit position.· I rotated the LED in positions 3 and 5 so I could use the decimal as the upper half of my colons between hours/minutes and minutes/seconds.· I am using the internal RTCC rollover to keep time (I gain 3 or 4 seconds per day).· The next phase in this project is to incorporate a DS1302 real time clock to get more accurate time.
    I hope that some of the code will help you.

    RWC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Russell Crow

    Project Manager
    Cohesive Automation Inc.


    Post Edited (Russ61) : 1/16/2005 6:15:57 PM GMT
    1280 x 960 - 316K
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-01-16 17:58
    derm0,

    in my SX book, I describe a digital SX 28 alarm clock driving 7-segment LED displays. Porting the code to drive an LCD display should be doable. At least, it shows how to keep track of the time, and how to handle the alarm time.

    You can download the book sample codes from the Parallax site: http://www.parallax.com/dl/src/prod/sx/SrcCodeExamples.zip

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • derm0derm0 Posts: 6
    edited 2005-01-21 16:01
    Mr. Daubach
    I downloaded your code examples from the link you gave me and studied all the files but was unable to find the clock example.
    I'd greatly appreciate it if you could tell me which one of the files has the clock example code as I seem to be overlooking it.
    Thanks
    Derm
  • Jim McCorisonJim McCorison Posts: 359
    edited 2005-01-21 16:25
    Russell said...
    I rotated the LED in positions 3 and 5 so I could use the decimal as the upper half of my colons between hours/minutes and minutes/seconds.

    What a cool idea!!!

    The neat thing about public forums is that everybody has a different way of tackling the same problems.

    Jim
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-01-21 16:43
    derm0,

    sorry, I have copied the wrong link with my last post. Please download the ZIP file at www.parallax.com/dl/src/prod/sx/ProgSXEdPre.zip. In this ZIP file, you will find App016.src which is the clock example.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • derm0derm0 Posts: 6
    edited 2005-01-26 12:09
    Thanks for all the help guys
    I have my design nearly completed now and have a lot of the code working. Just one thing, I've used and rewrote some of the code I got and wrote some of my own. I am having problems trying to incorporate my code for the LCD with the code I modified from Guenther's example and the code I wrote myself. My code is now starting to get very complicated.·I have been doing a bit of study on sx/B and it seems to be a lot less complicated than the sx assembly language especially with projects similiar to the alarm clock.
    I have looked over the code that Russell sent me on a few weeks ago and the code in the on-line sx/B examples but am still finding it difficult to write sx/B code to interface the LCD to the board.·If anyone could offer any advice it would be greatly appreciated.
    Thanks
    Derm
  • BeanBean Posts: 8,129
    edited 2005-01-26 13:45
    There is an LCD example in the SX/B help file under "Example projects".
    Bean.
  • derm0derm0 Posts: 6
    edited 2005-02-02 10:55
    Russell

    Thanks for the help with the code. Just·one quick question. Wat pins did you use to connect up your buttons and switch. I've set up my LCD but i'm not sure about my design with the buttons and switch

    Thanks

    Derm
  • derm0derm0 Posts: 6
    edited 2005-02-02 13:57
    Does anyone have any ideas how I would program the alarm clock code to work with an LCD? I have already gotten the code working for writing to the LCD in assembly language and have my LCD hooked up to my SX28 and working. However I am now having a lot of trouble trying to incorporate the code I have for the clock functions with the code I have for the LCD. Anyone's ideas on how I might do this would be a massive help

    thanks again

    Derm
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-02-02 14:30
    There's a serial LCD controller project in the help file -- that should be helpful. With an LCD, you simply take one of you clock digits, convert to ASCII by adding 48 ("0"), then send to the display in the position you want. The nice thing about using an LCD is you don't actually have to update anything until there is a change.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Russ61Russ61 Posts: 11
    edited 2005-02-04 03:42
    Dermo,
    ·
    I used RA.0 for my “time set” button, RA.1 for my “alarm set” button, RA.2 for my “hours set” button, RA.3 for my “minutes set” button and RB.0 for my “alarm is set” switch.· Press and hold the “time set” button, then press the “hours set” or “minutes set” button to increment the hours and minutes.· The seconds are incremented by pressing and holding the “time set” button while pressing the “alarm set” button.· Pressing and holding the “alarm set” button and pressing the “hours set” or “minutes set” buttons set the alarm time.· I hope this helps.
    ·I am currently working on converting this to assembly and integrating a 1pps signal from an atomic clock movement.

    Good Luck,

    RWC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Russell Crow

    Project Manager
    Cohesive Automation Inc.
    ·
  • derm0derm0 Posts: 6
    edited 2005-02-11 11:10
    Mr. Daubach
    I wos just wondering if you did out any schematic diagram for your alarm clock example showing your choice of pin connections. I'm still having problems with my design and I don't think it's the LCD i'm using as opposed to LEDs as i'm able to write to the LCD. Any help would be greatly appreciated.
    Thanks again
    Derm
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-02-11 13:09
    Derm,

    yes, there is a schematic in my book. Actually, for the alarm clock I use the basic schematic for a general 7-segment driver plus two additional pushbuttons. Both drawings are attached to this post.

    I have copied the following text from my book which explains the various operation states, and the functions of the two pushbuttons.

    ·    Default “Clock mode” – The current time is displayed, and if an alarm is enabled, the two decimal points in the seconds digits shall be on. When the alarm time has been reached, the two decimal points shall blink, and the buzzer shall generate an intermittent tone alarm sound.
    o    No alarm active:
      -    “Mode” activates the “Set clock” function to adjust the time.
      -    “Set” activates setting of the alarm time.
    o    Alarm active:
      -    Any button press stops the alarm.
    
    ·    “Set clock” mode – The display shows the time when “Mode” was pressed, and the digit that can be currently changed is marked with a blinking decimal point (starting with the one-seconds digit).
    o    “Set” increments the current decimal.
    o    “Mode” activates the next digit to be changed. 
    o    When “Mode” is held down when the 10-hours digit is active, and “Set” is pressed while “Mode” is down, the entered time will be accepted, and the clock starts with this new time as soon as both buttons are released.
    o    When Mode” is pressed and released and “Set” was not pressed while “Mode” was down, the entered time will be discarded, and the former clock setting remains unchanged, i.e. the display shows the current clock time again that was updated in the background during the “Set clock” mode.
    
    ·    “Set alarm” mode – The display shows the last entered alarm time, and the digit that can be currently changed is marked with a steady decimal point (starting with the one-seconds digit).
    o    “Set” increments the current decimal.
    o    “Mode” activates the next digit to be changed. 
    o    When “Mode” is held down when the 10-hours digit is active, and “Set” is pressed while “Mode” is down, the entered time will be accepted as the new alarm time, and the alarm is enabled.
    o    When Mode” is pressed and released and “Set” was not pressed while “Mode” was down, the entered alarm time will be discarded, and the alarm will be disabled.
    
    



    I hope this information helps a bit.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    Günther
    469 x 158 - 25K
    255 x 78 - 13K
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-04-09 16:11
    Derm0,

    I know this post is more than a year old. However, here is a completed project using an SX28/48/52 protoboard and a DS1302 with an LCD.

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

    Also here is another one using an SX48/52 with a DS1302 going to a 16x16·LED matrix for a scrolling time/date·display effect:

    http://forums.parallax.com/showthread.php?p=643775
Sign In or Register to comment.