Shop OBEX P1 Docs P2 Docs Learn Events
DS1307 Initialization and Demo — Parallax Forums

DS1307 Initialization and Demo

ShaliniShalini Posts: 59
edited 2013-04-05 06:15 in Propeller 1
Hi everyone!

I'm having some trouble intializing the ds1307 rtc. I've included the codes I'm using for initialization and demo . Please take a look at them and point me if i have the things in the right place or not.

Thanks in advance
«1

Comments

  • ShaliniShalini Posts: 59
    edited 2013-04-03 05:52
    sorry about that...i using different sources now, which i'm not able attach to the code here... but it can be found on obex.parallax.com
    The programs I'm using now are:
    DSRTC_driver
    FullDuplexSerial
    Extended_FDSerial <-- Extended Full Duplex Serial on obex.parallax
    LCD RTC demo

    I'm getting error in LCD RTC demo program. I've bolded and underlined as to where it's indicating the error. The error is "Expected a Subroutine Name"
    PUB Main
    LCD.init(TX_PIN, BAUD, 2, 16)
    LCD.cls
    Can anybody help me out on how to fix this error!!

    Thanks
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2013-04-03 06:03
    If you are using my 12/24hr code, I used a Sparkfun serial LCD display.

    If you just want to display the time on your PC using the Parallax Serial Terminal, just remove the LCD code.

    Make sure you have specified the correct pins for the RTC clock and data pins.
  • ShaliniShalini Posts: 59
    edited 2013-04-03 06:52
    If you are using my 12/24hr code, I used a Sparkfun serial LCD display.

    If you just want to display the time on your PC using the Parallax Serial Terminal, just remove the LCD code.

    Make sure you have specified the correct pins for the RTC clock and data pins.

    oh ok...i fixed it as per ur code....now all programs are loaded...what is the next step?? should the time automatically appear on the LCD??
  • ShaliniShalini Posts: 59
    edited 2013-04-03 07:23
    Shalini wrote: »
    oh ok...i fixed it as per ur code....now all programs are loaded...what is the next step?? should the time automatically appear on the LCD??

    in the serial terminal its giving me some other characters updating every second not the rtc clock.
    4PQU8fglK2VvAAAAAASUVORK5CYII=
  • JLockeJLocke Posts: 354
    edited 2013-04-03 07:41
    Shalini wrote: »
    ... should the time automatically appear on the LCD??

    No, if you're running the code that was attached above, you need to run the Parallax Serial Terminal at 57600 baud rate.
  • ShaliniShalini Posts: 59
    edited 2013-04-03 07:49
    JLocke wrote: »
    No, if you're running the code that was attached above, you need to run the Parallax Serial Terminal at 57600 baud rate.

    ok I'm getting 01/01/00 Sun
    00:00:80 AM

    how do i set the time and date??
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2013-04-03 07:50
    You have to activate the Parallax Serial Terminal quickly after loading the program.

    If the clock has not been set, enter "y" at the "Enter 'y' if you want to set clock:" prompt and enter the year, month, day, etc to set the clock...
  • ShaliniShalini Posts: 59
    edited 2013-04-03 07:57
    You have to activate the Parallax Serial Terminal quickly after loading the program.

    If the clock has not been set, enter "y" at the "Enter 'y' if you want to set clock:" prompt and enter the year, month, day, etc to set the clock...

    I'm not getting the prompt to set the date and time.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2013-04-03 08:08
    Shalini wrote: »
    I'm not getting the prompt to set the date and time.

    Make sure you start the Parallax Serial Terminal, set the appropriate Comm Port and set Baud Rate to 57600.
    Load the program from the Propeller tool (F11) and immediately click the enable button on the Serial Terminal.

    The program gives youe 3 seconds to respond.

    If you miss it, hit the reset button on the Propeller board...

    If you are not familiar with the Parallax Serial Terminal, you should read up on it
  • ShaliniShalini Posts: 59
    edited 2013-04-03 08:16
    Make sure you start the Parallax Serial Terminal, set the appropriate Comm Port and set Baud Rate to 57600.
    Load the program from the Propeller tool (F11) and immediately click the enable button on the Serial Terminal.

    The program gives youe 3 seconds to respond.

    If you miss it, hit the reset button on the Propeller board...

    If you are not familiar with the Parallax Serial Terminal, you should read up on it

    Ok thanks a lot. I have the clock running on the serial terminal. I've to work further to make it display the time and date on the LCD.
  • ShaliniShalini Posts: 59
    edited 2013-04-03 10:13
    Shalini wrote: »
    Ok thanks a lot. I have the clock running on the serial terminal. I've to work further to make it display the time and date on the LCD.

    how can i make this time and date display on the lcd??? I've included the code,but I've excluded all LCD lines because I'm getting "subroutine error" on the following line:
    PUB Main
    LCD.init(TX_PIN, BAUD, 2, 16)

    Could u please check the code and guide me how to fix it....thanks
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2013-04-03 10:19
    What LCD device are you using and what OBEX diver?

    Your particular LCD and OBEX code probably have totally different routines and parameters that the Sparkfun LCD/driver I used.
  • ShaliniShalini Posts: 59
    edited 2013-04-03 10:34
    I'm using a 8x2 lines MDLS82603-LV-G LCD and the driver is NT3881DH-01
  • ShaliniShalini Posts: 59
    edited 2013-04-03 10:37
    I initalized the lcd with the following codes and its working alright...
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2013-04-03 10:42
    Shalini wrote: »
    I'm using a 8x2 lines MDLS82603-LV-G LCD and the driver is NT3881DH-01

    You are going to have to do a little work here. This appears to be a parallell LCD (using 8 or four pins).

    You need to find an OBEX object (or other code) that will work with your LCD and study the code to learn how to use it.


    NOTE: you got it working before my post :smile:
  • ShaliniShalini Posts: 59
    edited 2013-04-03 10:47
    You are going to have to do a little work here. This appears to be a parallell LCD (using 8 or four pins).

    You need to find an OBEX object (or other code) that will work with your LCD and study the code to learn how to use it.


    NOTE: you got it working before my post :smile:

    The LCD I'm using is not a familiar one like HD4480, so can i still find a OBEX object for this lcd... and yes I'm using 4 bits
  • ShaliniShalini Posts: 59
    edited 2013-04-03 11:33
    Shalini wrote: »
    The LCD I'm using is not a familiar one like HD4480, so can i still find a OBEX object for this lcd... and yes I'm using 4 bits

    I found these on OBEX...
  • ShaliniShalini Posts: 59
    edited 2013-04-03 11:57
    The LCD is working fine with the previous LCD driver and demo code...and time and date is displayed on the serial terminal, but not on lcd because I've commented the LCD parts in the LCD RTC Demo.spin. If I don't comment it then I get subroutine error on this line
    PUB Main
    LCD.init(TX_PIN, BAUD, 2, 16) <-- "subroutine" error

    so I want to know what 2 and 16 are in the code??
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2013-04-03 12:27
    Shalini wrote: »
    The LCD is working fine with the previous LCD driver and demo code...and time and date is displayed on the serial terminal, but not on lcd because I've commented the LCD parts in the LCD RTC Demo.spin. If I don't comment it then I get subroutine error on this line
    PUB Main
    LCD.init(TX_PIN, BAUD, 2, 16) <-- "subroutine" error

    so I want to know what 2 and 16 are in the code??

    I wrote my OBEX object to work with specific Sparkfun serial LCDs. Some have 2 lines some have 4 - some have 16 characters/per line and others have 20.

    The 2, 16 indicate rows and columns. Many OBEX objects work with very specific devices - they are not universal drivers.

    My LCD code won't work with your LCD.
  • ShaliniShalini Posts: 59
    edited 2013-04-03 12:49
    I wrote my OBEX object to work with specific Sparkfun serial LCDs. Some have 2 lines some have 4 - some have 16 characters/per line and others have 20.

    The 2, 16 indicate rows and columns. Many OBEX objects work with very specific devices - they are not universal drivers.

    My LCD code won't work with your LCD.

    oh ok, so in my case i would that 2 and 8...rite?? because the lcd I'm using is 8x2 lines
  • ShaliniShalini Posts: 59
    edited 2013-04-03 12:59
    would ur sparkfun serial LCD driver and demo code work if I used JHD162A 16x2 LCD with a driver HD44780??
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2013-04-03 13:13
    Nope - serial LCDs only use 2 wires (ground and signal) and Sparkfun has their own specific command codes which are different from the Parallax codes, etc ,etc
  • ShaliniShalini Posts: 59
    edited 2013-04-03 15:16
    Nope - serial LCDs only use 2 wires (ground and signal) and Sparkfun has their own specific command codes which are different from the Parallax codes, etc ,etc

    oh i see...ok i'll check the JHD162A datasheet and get back to u...thanks a lot!! :smile:
  • ShaliniShalini Posts: 59
    edited 2013-04-03 17:30
    Shalini wrote: »
    oh i see...ok i'll check the JHD162A datasheet and get back to u...thanks a lot!! :smile:

    Right now the time and date is been displayed on the serial terminal, but can you suggest me any spin code i can use to make it display on the JHD162A 16x2 LCD please??
    I'm really in need of help!!
  • ShaliniShalini Posts: 59
    edited 2013-04-04 06:12
    Can anybody help me please!! I'm really in need of ur help!! my project is due in like 2 weeks and I have to get this working...
  • ShaliniShalini Posts: 59
    edited 2013-04-04 12:17
    Any solution please!!
  • ChrisGaddChrisGadd Posts: 310
    edited 2013-04-04 13:40
    I'm not sure I understand. You're able to get the LCD to work in demo routines, and you're able to get the clock to work on a serial terminal? You just can't get the clock and the LCD to work together?

    Here's something hacked together from my I2C and LCD routines, with some glue code to allow for setting the time.
    LCD clock - Archive.zip
  • ShaliniShalini Posts: 59
    edited 2013-04-04 14:10
    ChrisGadd wrote: »
    I'm not sure I understand. You're able to get the LCD to work in demo routines, and you're able to get the clock to work on a serial terminal? You just can't get the clock and the LCD to work together?

    Here's something hacked together from my I2C and LCD routines, with some glue code to allow for setting the time.
    LCD clock - Archive.zip

    yes, this is problem I'm having....so if I use the code you've given me will I be able to see the clock running on the LCD instead of serial terminal??
  • ShaliniShalini Posts: 59
    edited 2013-04-04 14:20
    ChrisGadd wrote: »
    I'm not sure I understand. You're able to get the LCD to work in demo routines, and you're able to get the clock to work on a serial terminal? You just can't get the clock and the LCD to work together?

    Here's something hacked together from my I2C and LCD routines, with some glue code to allow for setting the time.
    LCD clock - Archive.zip

    In your LCD driver.spin code you have given:

    PUB start(E_pin, RW_pin, RS_pin, D4_pin) : okay
    stop
    pins[0] := E_pin
    pins[1] := RW_pin
    pins[2] := RS_pin
    pins[3] := D4_pin

    the 0,1,2,3... is the propeller pins numbers which your using to connect E, RW, RS, and DB4??
  • ShaliniShalini Posts: 59
    edited 2013-04-04 14:42
    what LCD did you use?? is it 16x2??
Sign In or Register to comment.