example code for DS1337


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Question I2C/LCD conflict on PortB on EasyPic6

    Quote Originally Posted by BobK View Post
    Hi Jellis,

    I finally got a chance to look at your program. You have the pins of PortB setup for the LCD and you are also using PortB4. & 5 for the RTC alarms and PortB.0 and 1 for the I2C connections. You need to change them and set the RTC connections on a different Port.

    BobK
    Yes, I am aware of that. It is because the development board I am using (EasyPic6) hardwires PortB RB0/RB1 to the LCD that the board uses, thus making a conflict with the RB0/RB1 pins that are used by my 18F4550 MCU for the I2C interface to the DS1337. That is why I am commenting out all of the LCD related code in this test version, which unfortunately makes it difficult to troubleshoot the DS1337 clock operations without being able to see the outpus on the LCD. I am therefore using my oscilloscope to check the DS1337 pins during ops as my only way to troubleshoot...awkward!
    I have another LCD on order (two weeks delivery from Bulgaria) that will permit me to connect it as an external LCD to the EasyPic6 that will resolve this pin conflict, but in mean time I am still trying to troubleshoot code and get the clock working. Any suggestions how to troubleshoot without LCD??

    One thing I am wondering....I have the DS1337 circuit with pullup resistors and capacitor installed on an Archer Universal Breadboard with wire connections to the EasyPic6 for the I2C interface and the ALarm1 input....would this be possible cause for the clock not working due to extra capacitance from wiring/breadboard hookup? I wanted to get code working before reducing everything to an integrated PCB.

    I will try your contrl suggestion. Thanks for advice!

  2. #2
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi Jellis,

    Do you have a crystal with a capacitance load of 6pf? If not, the clock won't be very accurate.

    Yea it is kind hard to see if the RTC is working without a display. I have a serial LCD that I plug into my clock boards. The clocks run without the LCD but I only plug it in when I'm checking the times and testing the clock. I built a test program into it that lets me change the alarm times to one and two minutes from the current times and at the completion of the test it restores the alarm times to their normal settings and reboots the system. I've had 80 of them in service for almost 3 years now.

    I just tried to get a picture of the board to send to you but the limits were exceded. If you send me your email address I'll send you a picture.

    BobK
    Last edited by BobK; - 2nd December 2009 at 02:45. Reason: Not done yet

  3. #3
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Unhappy Would like to receive the photo

    Quote Originally Posted by BobK View Post
    Do you have a crystal with a capacitance load of 6pf? If not, the clock won't be very accurate.
    I am ordering one with 6pf capacitance now...the one I have been using has 27pf capacitance and I still haven't been able to get the DS1337 to run no matter what CONTROL word I send it. Even wit %00000000, which is no alarms and 32.768kHa on the SQW output, I don't see anything on the SQW output pin or an indication that the clock is running. Frustrating! Hopefully with a LCD I will make some progress in the troubleshooting.

    Yea it is kind hard to see if the RTC is working without a display. I have a serial LCD that I plug into my clock boards. The clocks run without the LCD but I only plug it in when I'm checking the times and testing the clock. I built a test program into it that lets me change the alarm times to one and two minutes from the current times and at the completion of the test it restores the alarm times to their normal settings and reboots the system. I've had 80 of them in service for almost 3 years now.

    I just tried to get a picture of the board to send to you but the limits were exceded. If you send me your email address I'll send you a picture.
    I am ordering a serial serial LCD (delivery in 2 weeks) to resolve the Pin conflicts in my EasyPic6 with the I2C interface (RB0/RB1) from the 18F4550 MCU. Your test program sounds very interesting. How do you initiate the MCU to run just the test program instead of the application program?...is it when you plug something into that the MCU senses like an external PC to MCU serial cable or a USB cable? I would like to consider doing something similar in our application. Would definitely like to see the photo you offer...send to my email at [email protected].

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    John,

    I'm not sure which pin you've connected SQW to, but ...
    Code:
          TRISA =%00000000 
          TRISB =%00000000 
          TRISC =%00000000 
          TRISD =%00000000
    One of the first things you do is set almost all the pins to output.
    That would stop any signal from SQW.
    <br>
    DT

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    If you think it is a capacitor issue and you are ordering more parts you may want to look at the DS1337C. Everything is built in.

    What voltage are you running the RTC on?
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Talking Stupid me!

    Quote Originally Posted by Darrel Taylor View Post
    I'm not sure which pin you've connected SQW to, but ...
    One of the first things you do is set almost all the pins to output.
    That would stop any signal from SQW.
    <br>
    I seem to be having a lot of senior moments lately...this being another one. I should have caught that....once I set TRISB to provide for inputs on the pins I had connected to SQW/_INTB and _INTA the alarms worked as intended, thus indicating to me that current time and alarms were being correctly set at programming time even though I couldn't see that they were because of lack of a LCD.
    Thanks again Darrel!

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Re-Writing IF-THEN-AND-ENDIF code?
    By jessey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th August 2006, 17:23

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts