Real time clock ICs


Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 40 of 67
  1. #1
    Eng4444's Avatar
    Eng4444 Guest

    Exclamation Real time clock ICs

    Hello,

    i'm again search for Real time clock but this time, not for DS1307.

    Could anyone provide me with any PicBasic Pro program for any real time clock IC used with any PIC?

    i'll just buy both ICs and make my life easier... because i'm about to break my head with this DS1307 and PIC16F876A ...

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Post

    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eng4444
    Hello,

    i'm again search for Real time clock but this time, not for DS1307.

    Could anyone provide me with any PicBasic Pro program for any real time clock IC used with any PIC?

    i'll just buy both ICs and make my life easier... because i'm about to break my head with this DS1307 and PIC16F876A ...
    This one is for the PCF8583 from Philips. Perhaps you can use this as a starting point to talk to either this device or a DS1307.

    ' Read the time in BCD format
    RTC_GetTime:
    I2Cread i2sda, i2scl, $A3, 2, [Second, Minute, Hour]
    return

    Jerson

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


    Did you find this post helpful? Yes | No

    Smile

    Hello Eng444,

    What's the problem? This forum has many examples of using RTC's including one back in Oct 2004 by Tonigalea that uses a DS1337. Paul Borgmier (sp? sorry) put 2 really nice RTC programs on this site last year that don't even use a separate RTC chip. I have tried them and they work very nice. They even have an alarm time example in them. I am on my 3rd project now using the DS1337 RTC. I use this as my projects need to keep accurate timing with a battery backup. I have even done routines to handle daylight savings time. I have used this RTC with a 16F88, 16F877A, and a 18F452. They are easy to work with but with everything else in life there is a learning curve. I found it very worth the time I invested.

    There are also several examples of elapsed time counters here on this site from Darrel Tayor. Melanie has given us the Olympic Timer based on the 1302 RTC. She also has a clock program posted on the MELabs website.

    Your post did not say specifically what your problem is. Some RTC's require converting data from the RTC from BCD to decimal. Paul Borgmier's clocks don't use this conversion. Tonigalea's DS1337 program doesn't use it.

    Read through the posts here on this site and try a few things. Let us know more about the problem so we can help you! The people here are great and willing to help!

    BobK.

  5. #5
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Exclamation Thank you BobK

    I am working on a certain project and do not have any knowledge in RTC, nor how to program them. In fact, i just learned PicBasic Pro...

    I have Pic16F876A and i am trying to manage to make my DS1307 work.

    I Have read all the examples but as i am new to this thing, i didn't understand them...

    i do not need alarms...etc etc i do not need it sophisticated at all. i am to calculate Energie which is given by: Energy = Power * time.

    i already got power in a certain variable and now, i need to get the time elapsed in order to multiply by power...

    any help?

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


    Did you find this post helpful? Yes | No

    Smile

    Hi Eng 4444,

    If you aren't looking for a "time stamp" of time and date then what you should try is Darrel Taylor's "Elapsed Timer" program on this site. Your program can control when to start timing and when to stop timing. Melanie's "Olympic Timer" is another example of a start and stop timer. You should look at these two programs. Both of them output the result to an LCD display. Both of these programs use a background timer using the PIC's timers. You can have your PIC do the calculations based on the inputs and then display the results.

    The May 2006 issue of Nuts and Volts magazine has a nice tutorial on using PIC timers including a sample program that should help you out understanding how these timers are used. I believe this forum also has numerous posts relating to using PIC timers. I personally am just starting to use them so I wouldn't be much help in the actual design of one at this point. I just have a basic understanding of how they work.

  7. #7
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Lightbulb

    Also as BobK pointed in right direction, have the followings into consideration.

    If you use RTC to calculate the elapsed time, you will have difficulties when time passes from one minute to other, or from one hour to other. You will be lost in HEX conversions to come with elapsed time.

    I highly recommend using Melanie’s Olympic timer. It is already a timer just as you need, it is not an RTC.

    It is quite easy to implement it into your PIC; even if you can’t use it with your PIC, have your energy calculation in your PIC by getting a signal from a separate PIC in which the Olympic timer is implemented.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  8. #8
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Just checking

    Hi,

    If you dont use a backup battery for the 1307 make sure that the un-used leg for the backup function is tied to ground. You can find this in the datasheet but if this is not done the chip will not work properly (sometimes it doesn't, other times it does but never when you want it to).

    We are using the 1307 and it is doing fine.


    TRIS? = %00000000 ' all pins to output just replace ? with port name

    SDA var Port?.? 'define port for I2C communication replace ?.? with pin
    SCL var Port?.?

    Hours var Byte
    Minutes var Byte
    Seconds var Byte
    RTC var Byte
    I2C_Adr_B var byte


    RTC = % 11010000 ' Device adress on I2C bus
    I2C_Adr_B=0

    I2CWRITE SDA,SCL,RTC,I2C_Adr_B,[128,0,0,0,0,0,0,128] 'Reset time to 0 and stopped, 12 hour setting

    Start_RTC:
    I2C_Adr_B=0
    I2CWRITE SDA,SCL,RTC,I2C_Adr_B,[0,0,0,0,0,0,0,16] 'Start RTC if you put a resistor and LED between the "SEC" pin and 5V it should start flash 1/s
    return

    RTC_Read:
    I2C_Adr_B=0
    I2CREAD SDA,SCL,RTC,I2C_Adr_B,[seconds,minutes, hours] ' in bcd code
    return

    call each part with a GOSUB

    Good luck and enjoy
    Last edited by Jumper; - 1st June 2006 at 15:16.

  9. #9
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Thumbs up You are an excellent person!:-)

    Quote Originally Posted by Jumper
    Hi,

    If you dont use a backup battery for the 1307 make sure that the un-used leg for the backup function is tied to ground. You can find this in the datasheet but if this is not done the chip will not work properly (sometimes it doesn't, other times it does but never when you want it to).

    We are using the 1307 and it is doing fine.


    TRIS? = %00000000 ' all pins to output just replace ? with port name

    SDA var Port?.? 'define port for I2C communication replace ?.? with pin
    SCL var Port?.?

    Hours var Byte
    Minutes var Byte
    Seconds var Byte
    RTC var Byte
    I2C_Adr_B var byte


    RTC = % 11010000 ' Device adress on I2C bus
    I2C_Adr_B=0

    I2CWRITE SDA,SCL,RTC,I2C_Adr_B,[128,0,0,0,0,0,0,128] 'Reset time to 0 and stopped, 12 hour setting

    Start_RTC:
    I2C_Adr_B=0
    I2CWRITE SDA,SCL,RTC,I2C_Adr_B,[0,0,0,0,0,0,0,16] 'Start RTC if you put a resistor and LED between the "SEC" pin and 5V it should start flash 1/s
    return

    RTC_Read:
    I2C_Adr_B=0
    I2CREAD SDA,SCL,RTC,I2C_Adr_B,[seconds,minutes, hours] ' in bcd code
    return

    call each part with a GOSUB

    Good luck and enjoy
    __________________________________________________ _____________

    i wouldl ike to thank you so much! but now i returned home and far from my Lab. I will try it tomorrow. is it suitable for PIC16F876A? and by the way, how to set the date and time to: "10:15:30 01-06-2006 "? can you tell me how and in which part of your program?

    thank you again....

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


    Did you find this post helpful? Yes | No

    Smile

    Hi Eng4444,

    The simplest way is to set those values as the variables for hours, minutes, seconds, month, date, year and then write them into the RTC. Obviously the minutes setting should be a few minutes ahead of the actual start time to allow you time to program the PIC and then put it into your board and start the board up. That's what I do to start the clock on my boards.

    BobK

  11. #11
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default some more checking

    Hi,

    Just to be really sure. Don't forget to put pullup resistors 4k7 between [SDA --> 5V] and [SCL --> 5V].

    Another thing we have seen is that adding "DEFINE I2C_SCLOUT 1" (this makes the SCL line bipolar) can help if there is a lot of noice in your set up. This is not the solution for a bad design just a way to try to get the best possible chance to communicate with the 1307.

    I am sure that as soon as you get the chip to respond your learning curve will go thru the roof.

  12. #12
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Lightbulb Thanks again:-)

    I'll try all of this in 4 hours... i really hope it will work!!

  13. #13
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Exclamation

    Quote Originally Posted by BobK
    Hi Eng 4444,

    should try is Darrel Taylor's "Elapsed Timer" program on this site. Your program can control when to start timing and when to stop timing. Melanie's "Olympic Timer" is another example of a start and stop timer. You should look at these two programs.
    __________________________________________________ ______________

    Sorry but where to find those 2 programs on this website? in which section?

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


    Did you find this post helpful? Yes | No

    Smile

    Hi Eng4444,

    From this forum's main menu select CODE EXAMPLES. There you will find the following items:

    1) Olympic Timer
    2) Easy & Accurate Clocks without RTC ICs
    3) Elapsed Timer Demo

    Of the three, #2 is the only one that I personally have tried. But you should look at all three programs and decide which one you want to use. They are all easy to understand.

    BobK

  15. #15
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Arrow Assistance please..

    Quote Originally Posted by Jumper
    call each part with a GOSUB

    Good luck and enjoy
    ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++

    What do you mean by this?

    could anyone explain to me?

    of course i need it to show constantly the time and keep on incrementing seconds, minutes, hours, days...

    so what is this GOSUB? and how to use it?
    One more things, what to do if i want to set time and date as:
    02:10:00 3-6-2006?

    where to write them?in which sentence?

    urgent help is needed because i am working right now on this...

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


    Did you find this post helpful? Yes | No

    Smile

    Hi ENG4444,

    What Jumper is referring to with the GOSUB is that the routines "Start_RTC" and "RTC_Read" are called from your main program. Read the PBP manual referring to the word "GOSUB" for a further explanation.

    The clock setting portion is, as I stated in an earlier reply, is handled in the setup of the clock. You put these values in the variables for the clock, meaning "seconds", "minutes", "hours", etc then write them into the RTC.

    It really sounds to me that you are in such a panic to get this project done by 9am Monday morning that you can't slow down and pay attention to what we are trying to say to you. You have posted on several sections of this forum with different requests. One request is for an RTC for a clock. Another post says you need elapsed time. Several of us have provided you with the information you requested. So now what do you want? We are here to help you but from your ongoing statements you aren't learning anything or really don't understand what is being given to you.

    Sit back and put your feet up in the air and relax for a few minutes. Re-look at the information we have provided. Try a few of the example programs that have been provided to you and see what they may or may not do for you.

    Maybe you should post some of the code you have so far and give us a schematic to look at. I can feel the panic in your requests. We want to help but can only go so far here!

    BobK

    The example programs are documented as to what each portion of the program is doing. Look at them and they will show you where to enter the values for setting the clock.

  17. #17
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Default you guessed right..i'm so squeezed by time..

    Quote Originally Posted by BobK

    Maybe you should post some of the code you have so far and give us a schematic to look at. I can feel the panic in your requests. We want to help but can only go so far here!
    __________________________________________________ _______________

    To tell you the truth, i have right now 15 programs related to real time clock and elapsed time and i'm not able to use any of them...

    as i said before, i don't know anything about PicBasic Pro, nor PIC, nor RTC. I just got stuck with this situation and should make it pass.. i'm simply a biomedical engineer..

    so for example, i'll tell you what i did yesterdsay night. This is a program from Melanie (thanks Melanie for providint such important program) :

    http://www.melabs.com/resources/samp...ted/MN1307.txt

    i will not paste it here because it's too long...
    but she's using PIC16F628. For me, i didn't find it; i found 16F628A which must be similar.... right?

    i did the circuit as she was saying (bought 2 Lines LCD), connetions to PIC and for DS1307, there was a suspicious part in some lines she wrote:

    ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++
    " ' 10K Resistors required from PORTB.1 and PORTB.2 to Vdd
    ' PORTB.0 relies on weak pull-up's (for future use)
    '
    SQWpin var PORTB.0
    ' You don't actually need to wire this pin... but...
    ' If you're observant, you'll notice I've wired the DS1307's
    ' SQW to RB0. Rather than 'poll' and display the time/date
    ' as in this example code, you can have an interrupt
    ' on RB0 each second to do this. In fact if you look at
    ' my code for setting the DS1307 you'll see I've already
    ' programmed it for a 1 second 'Tick' for exactly this
    ' purpose...
    SCLpin var PORTB.1
    SDApin var PORTB.2
    '
    ' Setting Buttons
    ' ---------------
    ' Buttons are connected between PORTB.4, 5 & 6 down to Vss
    ' No Resistors required - we're using weak pull-up's
    '
    DecButton var PORTB.4 ' Press to Decrement Button
    SetButton var PORTB.5 ' Press to Set/memorise Button
    IncButton var PORTB.6 ' Press to Increment Button
    "

    ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++

    so i just "connected": SQWpin of DS to PORTB.0
    SCLpin to PORTB.1
    SDApin to PORTB.2
    and for ports B.4 ,B.5 and B.6, i have put "push buttons" to ground.
    and also i have put 10K resistors as she said.

    so i got the same unused ports that she mentioned and was happy because i felt that it will work!

    now the programming section came....

    i just copied and pasted the whole program on PicBasic Pro, compiled it, things were fine.

    Then, using the programmer (i'm using ICPROG), i put the PIC, chose 16F862A and programmed but it gave:
    "verify error at location 0000xH"

    so i retuend to the program and paid attention to some sentences Melanie wrote in the beginning:
    ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++
    @ DEVICE pic16F628, INTRC_OSC_NOCLKOUT
    ' System Clock Options
    @ DEVICE pic16F628, WDT_ON
    ' Watchdog Timer
    @ DEVICE pic16F628, PWRT_ON
    ' Power-On Timer
    @ DEVICE pic16F628, BOD_ON
    ' Brown-Out Detect
    @ DEVICE pic16F628, MCLR_OFF
    ' Master Clear Options (Internal)
    @ DEVICE pic16F628, LVP_OFF
    ' Low-Voltage Programming
    @ DEVICE pic16F628, CPD_OFF
    ' Data Memory Code Protect
    @ DEVICE pic16F628, PROTECT_OFF
    ' Program Code Protection
    ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++
    i tried to add "A" near each "8" but didn't work... so i noticed that i am already doing these setting from ICPROG (by checking what i need) so i removed all this section and programmed without it. It worked.

    it was time to test..

    LCD is just giving black rectangles.. nothing else :-( :-( !!!!

    i don't know what to do... i downloaded all this program to PIC... we do not program DS1307 also? no program should be inserted inside it?

    i also used a crystal for it... 32.768 as i remember...

    so here it is, i explained one case...and i previously fell in many previous similar cases... no one here around me is ready to help so i just thought that maybe i can find help on the internet. This is why i am sending many posts.... i should finish this whole work by next friday... i'm working on the biomedical part and do not have too much time to sit, read manual, try exercises, build more circuits and test.... i can't lay my legs Bob! i'm working on this project 20 hours a day since 3 months! can you beleive it? so i "really" cannot sit and just be in the mood to learn PicBasic Pro and I2c and RTC.....

    in case someone would be able to help i'll be grateful..

  18. #18
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Exclamation By the way BobK,

    you said:

    "
    "What Jumper is referring to with the GOSUB is that the routines "Start_RTC" and "RTC_Read" are called from your main program. Read the PBP manual referring to the word "GOSUB" for a further explanation.

    The clock setting portion is, as I stated in an earlier reply, is handled in the setup of the clock. You put these values in the variables for the clock, meaning "seconds", "minutes", "hours", etc then write them into the RTC. "
    __________________________________________________ ______________

    So do you mean that i should write all the program:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    TRIS? = %00000000 ' all pins to output just replace ? with port name

    SDA var Port?.? 'define port for I2C communication replace ?.? with pin
    SCL var Port?.?

    Hours var Byte
    Minutes var Byte
    Seconds var Byte
    RTC var Byte
    I2C_Adr_B var byte


    RTC = % 11010000 ' Device adress on I2C bus
    I2C_Adr_B=0

    I2CWRITE SDA,SCL,RTC,I2C_Adr_B,[128,0,0,0,0,0,0,128] 'Reset time to 0 and stopped, 12 hour setting

    Start_RTC:
    I2C_Adr_B=0
    I2CWRITE SDA,SCL,RTC,I2C_Adr_B,[0,0,0,0,0,0,0,16] 'Start RTC if you put a resistor and LED between the "SEC" pin and 5V it should start flash 1/s
    return

    RTC_Read:
    I2C_Adr_B=0
    I2CREAD SDA,SCL,RTC,I2C_Adr_B,[seconds,minutes, hours] ' in bcd code

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    in the PIC16F876A directly and it works?

    let's say i want to chose port B and pin 22 which is RB1
    23 which is RB2
    so i write:
    TRISB = %00000000
    SDA var PortB.1
    SCL var PortB.2
    true?
    and i wire b.1 to sda of DS, B.2 to SCL DS.... right?



    Now tell me, if i just connect PIC16F876A to this DS1307 and a 4 lines LCD (or 2 lines). and let's say i just want to use this whole PIC just for the DS (it's stupidity i know but let's say i will keep all ports not used) would this program, as he gave it to me, be enough to begin displaying time and date on LCD? or i should write more things that he didn't write thinking that i should know them..... ?

  19. #19
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Since my original program was configured for a 4-Line LCD (which extensively used the LCDOut command), and you're using a 2-Line LCD which does not, unless you make significant changes to the program to compensate for the difference it's not exactly going to work, is it?

    You might need to be aware, that a 2-Line LCD communicates by SERIAL asynchronous. For reliability your PIC will ideally need to be driven by an Xtal or Resonator and not rely on the Internal Oscillator. See Thread...

    http://www.picbasic.co.uk/forum/show...nal+Oscillator

    A 4 or 8-wire connected LCD does not have this limitation.

    You obviously haven't a clue as to what you're doing. With your level of expertise, unless you EXACTLY replicate programs and hardware examples that are posted - without changes, your chances of success are slim to none.

    Let me put this into perspective... I catch a Cold. I therefore go into a BioMed Lab to devise a cure. I only need to cure my Cold, and then I will never set foot in a BioMed Lab ever again. I give myself a week to accomplish this... I am not a Doctor or a Scientist or even a BioMed Technician. All I know is that the Plasma they drip into your arm is the same stuff that drives the Starship Enterprise...

  20. #20
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Exclamation Dear Melanie,

    I already said that i have no clue...

    i have LCD 4 lines so i will try it....

  21. #21
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Exclamation By the way...

    This DS1307... we do not program it? just access it from PIC?

    A Professor here said that i am obliged to program it... one of us is stupid so who is it?


    for me, i have read so many examples but i never noticed that i should program a DS1307.... i just have to connect it to PIC and then access it by the program..

    Am i mistaken?

  22. #22
    Join Date
    Feb 2006
    Posts
    89


    Did you find this post helpful? Yes | No

    Default Program it

    I think that the professor is using "program" loosely. You will write the time and date therby "programming it".

    Travin

  23. #23
    Join Date
    May 2004
    Location
    New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    There are also a few control bits that might need configuring - 12/24 hour mode, square wave output & rate, and a whopping 56 bytes of "NV"RAM for you to use... guess those could also fall into the "program" category :-)

    Arch

  24. #24
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    >A Professor here said that i am obliged to program it... one of us is stupid so who is it?

    Have you read the DS1307 Datasheet?

    If you haven't then GO DO IT before you ask questions like the one above.

    You will discover that when you first Power-Up a DS1307 for the first time (regardless if you have a Battery Backup connected or not), it sits there and DOES NOTHING until you enable it by clearing the CH (Clock Halt) bit in one of it's Registers (which Bit in which Register I leave you to discover by READING the device Datasheet). That Sir is called "programming" - apart from that, how's the chip supposed to know what the current Time and Date is from which to continue timing? Telepathy?

    People who can't be bothered to read Datasheets or Manuals and expect everyone else to do their work for them usually get short changed on this forum.

  25. #25
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Thumbs up You were wrong this time Melanie..

    He apologised today... he meant by "programming" the real meaning and not as many expected.. Simply, he meant that i should put all the program inside DS1307.... i think he didn't have any idea about this DS...

    anyway, life continues.... i'm about to present my project on friday.Still delaying this matter of timer because it makes me nervous! have i ever said that i designed a new instrument that analyzes blood, saliva and bones at the same time?

    It's so useful and i am working now on reducing it's size... i'm using MEMS technlogy in case anyone is interested.

    This is why i'm so squeezed by time and do not have time to read any discover new and silly datasheets.... time is treasure and i cannot lose it.

    So if this timer does not work it doesn't matter but i just hope it will work so that i can display time and date on the screen or maybe put a timer to be used by patients.

  26. #26
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Arrow One more thing about "Project MN1307"

    It is located at:

    http://www.melabs.com/resources/samp...ted/MN1307.txt

    for those who are interested.

    No more fabrication of PIC 16F628 or 16F876, and this is worldwide done. It's same case for other PICs. They are being replaced by 16F628A and 16F876A.

    so, can this program be used directly on a pic 16F628A without facing any problem or changing any code?

    I will try it on a 4-line LCD but i just want to know about the PIC... yesterday, Melanie gave me a way to stop the comparators on 16F876A. So should something be done for this 16F628A?

    thank you.

  27. #27
    Join Date
    May 2004
    Location
    New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    Somewhere at the Microchip website you'll find some 'silly' documents about migrating to new (or improved) devices. Oh no... one more thing to read =:-0

    Arch

  28. #28


    Did you find this post helpful? Yes | No

    Default Please explain!

    Eng4444:What kind of Engineer will you be if all you want to do is copy someone elses work as pass it off as your own?,Why would any company want to hire someone who has this mindset?...You are trying to run before you can walk.Melanie and others in this forum have bent over backwards trying to help you,a lack of preparation on your part has gotten you into this situation,As a Bio-med engineer you should have a little more enthusiasm about learning some basic programming techniques in order to complete your academic assignments.

    Get to Work!!!
    R.C

  29. #29
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Arrow My question was:

    In the program located at http://www.melabs.com/resources/samp...ted/MN1307.txt

    should i change something in the code if i wanna use PIC16F628A? because i already read somewhere in the forum a certain discussion that there shouldn't be difference but i just want to be sure.

    best regards.

  30. #30
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Lightbulb this program..

    i wonder how i was told that:

    " Since my original program was configured for a 4-Line LCD (which extensively used the LCDOut command), and you're using a 2-Line LCD which does not, unless you make significant changes to the program to compensate for the difference it's not exactly going to work, is it? "

    ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++

    But if somehow someone focused on what i was saying it would have been nicer..i'm not asking to just receive any answers...

    i was talking about the program located at:

    http://www.melabs.com/resources/samp...ted/MN1307.txt

    there, it is written that:
    "
    ' Written for 2 line 16 Character LCD
    "

    and i tried it like this but with a PIC16F628A and didn't work.

    This is why i will ask again if i should do some changes to the program; and what are they?

    thank you.

  31. #31
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Confused right?

    Hi,

    I think Melanie in her remarks in her program was reffering to a LCD with 2 rows and 16 characters on each row (2*16 LCD). Melanie usually uses as little special hardware as possible so she probably just pulled up the most common LCD from her magic drawer. This LCD is electrically connected to the PIC using 4 data lines (and some more) which are mentioned in the LCDOUT command.

    If you have 2 cables to the LCD (plus power) is is probably a serial LCD which can not be used using the LCDOUT command.

    Hard to tell without haveing the schematics and really understanding what you whish to do.

  32. #32
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Exclamation Here it is:

    i can have any LCD i want. This is not a problem.

    now i have 2:
    Winstar WH1602A ( 2 lines, 16 char) and WINSTAR WH160A (4 x 16).

    and they are both parallel as i think... right? to assure you, check:

    winstar.com.tw

    so this is the 2 lines 16 char LCD i used and the program didn't work.

    Still again asking: should i change something related to PIC16F628A?

    thank you.

  33. #33
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Eng4444
    LCD is just giving black rectangles.. nothing else :-( :-( !!!!
    Have you adjusted the contrast correctly.

    At one extreme it will display nothing, at the other extreme it will display black rectangles. Somewhere inbetween it will display the characters correctly.
    Keith

    www.diyha.co.uk
    www.kat5.tv

  34. #34
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    > Still again asking: should i change something related to PIC16F628A?

    If I don't know the answer to questions like will my program work on a 16F628 as well as a 16F628A... I would...

    1. Download both Datasheets and compare them...

    2. Create a simple program to display "I must learn to study Datasheets" on my LCD and compile it for a standard 16F628. I would then burn an 'A' version with that code and checked if it would still work.

    But that's me... you on the other hand would rather ask the same questions over and again on the forum... hint... if you tried option 2, you'd discover the answer in less than 15 minutes...

    Even Drugs and Chemicals have Datasheets - and you would use one of those without checking the Datasheet first?

    Code:
    	'
    	'	Device Programming Options
    	'	--------------------------
    	@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT
    			' System Clock Options	
    	@ DEVICE pic16F628, WDT_ON
    			' Watchdog Timer
    	@ DEVICE pic16F628, PWRT_ON
    			' Power-On Timer
    	@ DEVICE pic16F628, BOD_ON
    			' Brown-Out Detect
    	@ DEVICE pic16F628, MCLR_OFF
    			' Master Clear Options (Internal)
    	@ DEVICE pic16F628, LVP_OFF
    			' Low-Voltage Programming
    	@ DEVICE pic16F628, CPD_OFF
    			' Data Memory Code Protect
    	@ DEVICE pic16F628, PROTECT_OFF
    			' Program Code Protection
    
    	'
    	'	Hardware Defines
    	'	----------------
    		'
    		' 	LCD Display
    		'	-----------
    	Define LCD_DREG PORTB				' Port for LCD Data
    	Define LCD_DBIT 4				' Use upper 4 bits of Port
    	Define LCD_RSREG PORTB				' Port for RegisterSelect (RS) bit
    	Define LCD_RSBIT 3				' Port Pin for RS bit
    	Define LCD_EREG PORTB				' Port for Enable (E) bit
    	Define LCD_EBIT 2				' Port Pin for E bit
    	Define LCB_BITS 4				' Using 4-bit bus
    	Define LCD_LINES 2				' Using 2 line Display
    	Define LCD_COMMANDUS 2000			' Command Delay (uS)
    	Define LCD_DATAUS 50				' Data Delay (uS)
    
    	'
    	'	Software Defines
    	'	----------------
    	CounterA var BYTE
    	CounterB var BYTE
    	CounterC var BYTE
    	DataA var BYTE
    
    	'
    	'	EEPROM Contents
    	'	---------------
    	Data @0,"I must learn not to be lazy and to read Datasheets!"
    
    	'
    	'	Initialise PIC
    	'	--------------
    	TRISA=%00000000			' PortA all OUTPUT
    	TRISB=%00000000			' PortB all OUTPUT
    	CMCON=%00000111			' Comparators OFF
    
    	'
    	'	Main Program
    	'	------------
    	Pause 2000			' Timeout for LCD Hardware to wake-up...
    	LCDOut $FE,1			' Clear Display
    Loop:
    	For CounterA=0 to 35
    		Gosub DisplayMessage
    		Next CounterA
    	Pause 1000
    	For CounterA=35 to 0 step -1
    		Gosub DisplayMessage
    		Next CounterA
    	Pause 1000
    	Goto Loop
    
    	'
    	'	Subroutine Displays Scrolling Message
    	'	-------------------------------------
    DisplayMessage:
    	LCDOut $FE,$80
    	For CounterB=0 to 16
    		CounterC=CounterA+CounterB
    		Read CounterC,DataA
    		LCDOut DataA
    		Next CounterB
    	Pause 500		
    	Return
    
    	End
    If the above doesn’t work for you, then there are still career openings in Landscape Gardening…
    Attached Images Attached Images  

  35. #35
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Exclamation Landscape gardening..

    Well that's simple!

    Without landscape gardening, nobody would have remained alive!!

    and that's a "TRUTH".

    Perhaps you people eat PIC16F876, PIC16F876A, PIC16F628, PIC16F628A, PIC16F88...... several delicious different vegetables and fruits! yeah?

    Maybe if just one of you read well what i was writing withouth playing the intelligent, would have understood what i was saying each time...


    Thank you for your cooperation.
    Sam.

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


    Did you find this post helpful? Yes | No

    Smile

    Hello again Eng4444,

    It's nice to see that you are still here. Just to give a further example of what we are all trying to say to you, I just put the program that Melanie had just posted into an older project board of mine. Her program puts the LCD on PortB. Well my LCD is on PortA. So I made some minor changes to the program and tried it. It didn't work! Her program is for a 16F628 and I had a 16F872. I commented out the DEVICE setup and chose to set the configuration fuses through my programmer. Still didn't work. I only got blocks on line 1 of the LCD. So I opened the datasheet on the 16F872 and went to the section on the A/D module and found in the register explanation how to disable the A/D module and how to make the Analog pins all digital. Programmed the chip again and now the message scrolls across the screen!

    Now before you go and say what a smart ass you are let me explain that I do not have any degree in ANYTHING' I am a self employed alarm installer. I play with electronics for fun and once in a while I might make a few bucks making something to get the job done.

    I read this forum faithfully and pay attention to what the real pros like Melanie, Mister E, David Taylor, and the many other fine folks have to say when they offer their advise and expertise to someone. I really haven't gotten involved with anyone here to the extent that I have with you because I don't want to say or do something stupid. I don't think that you gave anyone here that has responded to you a fare shake. You say I dropped out. Well I didn't. I was reading everything. I read this forum at least twice a day and if I'm at a place that has internet access then I use my Dell handheld and go on to see what's up. If it wasn't for this forum and the fine people here I wouldn't have the knowledge I have today.

    By the way, I started at 7:15 this morning working on that little display program and was up and running including the troubleshooting in less than 1/2 hour. I keep the datasheets for the parts I use on my computer so that they are handy. The most frequently posted comment is read the datasheet. You don't have to read it like a novel, just refer to it once in a while. I know you are pressed for time so I won't hold you up. Good luck on you project! I have to goto work.

    Have a nice day!

    BobK
    Last edited by BobK; - 7th June 2006 at 13:02.

  37. #37
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Lightbulb Once again..

    i would say and repeat to you people:

    I DO NOT WORK WITH THIS TYPE OF TECHNOLOGY!!

    why no one understands??? i work with MEMS!!!!!!!! i already said it.....

    stop talking to me as if i'm a stupid intruder... you have your world and i have mine.. you are EXPERTS in PICs (this is why i came to you).

    and i am EXPERT in MEMS! ( in case someone needs anything related to MEMS i'll be ready!)

    Bobk, i checked your profile. I respect you very much but you made me nervous when you kept asking me to give details and schematics! So, i'm sorry to talk in a bad way to you.

    So here it is... a chematic! i did it with paint because with circuit builder it exceeds the attachement size. Those are the exact connections i did on Breadboard and then on PCB.

    And also, here is the program i used ( the same of Melanie):

    @ DEVICE pic16F628A, INTRC_OSC_NOCLKOUT
    ' System Clock Options
    @ DEVICE pic16F628A, WDT_ON
    ' Watchdog Timer
    @ DEVICE pic16F628A, PWRT_ON
    ' Power-On Timer
    @ DEVICE pic16F628A, BOD_ON
    ' Brown-Out Detect
    @ DEVICE pic16F628A, MCLR_OFF
    ' Master Clear Options (Internal)
    @ DEVICE pic16F628A, LVP_OFF
    ' Low-Voltage Programming
    @ DEVICE pic16F628A, CPD_OFF
    ' Data Memory Code Protect
    @ DEVICE pic16F628A, PROTECT_OFF


    Define LCD_DREG PORTA ' Port for LCD Data
    Define LCD_DBIT 0 ' Use lower 4 bits of Port
    Define LCD_RSREG PORTA ' Port for RegisterSelect (RS) bit
    Define LCD_RSBIT 6 ' Port Pin for RS bit
    Define LCD_EREG PORTA ' Port for Enable (E) bit
    Define LCD_EBIT 7 ' Port Pin for E bit
    Define LCB_BITS 4 ' Using 4-bit bus
    Define LCD_LINES 2 ' Using 2 line Display
    Define LCD_COMMANDUS 2000 ' Command Delay (uS)
    Define LCD_DATAUS 50 ' Data Delay (uS)


    SQWpin var PORTB.0
    SCLpin var PORTB.1
    SDApin var PORTB.2

    DecButton var PORTB.4
    SetButton var PORTB.5
    IncButton var PORTB.6

    Data @0,74,97,110,70,101,98,77,97,114,65,112,114
    ' Jan Feb Mar Apr
    Data 77,97,121,74,117,110,74,117,108,65,117,103
    ' May Jun Jul Aug
    Data 83,101,112,79,99,116,78,111,118,68,101,99
    ' Sep Oct Nov Dec
    Data 84,117,101,87,101,100,84,104,117,70,114,105
    ' Tue Wed Thu Fri
    Data 83,97,116,83,117,110,77,111,110
    ' Sat Sun Mon

    CounterA var byte
    CounterB var byte
    CounterC var byte
    CounterD var byte
    RTCSec var byte
    RTCMin var byte
    RTCHour var byte
    RTCWDay var byte
    RTCDay var byte
    RTCMonth var byte
    RTCYear var byte
    RTCCtrl var byte
    SetTime var byte
    SetSec var byte
    SetMin var byte
    SetHour var byte
    SetDay var byte
    SetMonth var byte
    SetYear var byte
    TimeOut var word

    ButtonRepeat con 200
    goto JumpStart

    ConvertBCD:
    CounterB=CounterA DIG 1
    CounterB=CounterB<<4
    CounterB=CounterB+CounterA DIG 0
    Return

    DisplayMonth:
    CounterB=CounterB*3-3
    DisplaySequence:
    For CounterA=CounterB to CounterB+2

    Read CounterA,CounterD
    LCDOut CounterD
    Next CounterA
    Return

    FindDays:
    LookUp SetMonth-1,[31,28,31,30,31,30,31,31,30,31,30,31],CounterA
    ' Above line gives the 'usual' days of the Month
    ' Section below adjusts for Leap-Year
    If SetMonth=2 then
    If (SetYear&$03)=0 then CounterA=29
    endif
    Return

    SetButtonRelease:
    LCDOut $FE,1
    While SetButton=0:Wend
    Pause 250 ' Small pause to kill any Key-Bounce
    Return

    JumpStart:
    CMCON=%00000111
    TRISA=%00000000
    TRISB=%11111111
    OPTION_REG.7=0
    Pause 200

    ReDisplay:
    LCDOut $FE,1
    ReDisplayLoop:

    I2CRead SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCY ear,RTCCtrl]

    If RTCSec.7=1 then goto SetUpPreset

    If SetButton=0 then
    Gosub SetButtonRelease
    goto Setup
    endif

    LCDOut $FE,$80
    If RTCHour.6=1 then

    CounterA=(RTCHour>>4)&$01
    else
    CounterA=(RTCHour>>4)&$03
    endif
    CounterA=CounterA*10+(RTCHour&$0F)
    If RTCHour.6=1 then

    LCDOut #CounterA
    else
    LCDOut #CounterA Dig 1,#CounterA Dig 0
    endif
    LCDOut ":",#(RTCMin>>4)&$0F,#RTCMin&$0F,":"
    LCDOut #(RTCSec>>4)&$0F,#RTCSec&$0F," "
    IF RTCHour.6=1 then
    If RTCHour.5=1 then
    LCDOut "PM"
    else
    LCDOut "AM"
    endif
    endif

    LCDOut " ",$FE,$C0
    CounterB=RTCWDay*3+33
    Gosub DisplaySequence

    LCDOut " ",#(RTCDay>>4)&$0F,#RTCDay&$0F," "
    CounterB=((RTCMonth>>4)&$0F)*10+(RTCMonth&$0F)
    Gosub DisplayMonth
    LCDOut " 20",#(RTCYear>>4)&$0F,#RTCYear&$0F,$FE,$80
    '
    Pause 250
    Goto ReDisplayLoop

    SetupPreset:
    RTCSec=$00
    RTCMin=$15
    RTCHour=$13
    RTCWDay=$01
    RTCDay=$12
    RTCMonth=$06
    RTCYear=$02
    RTCCtrl=$10

    Setup:
    SetTime=RTCHour.6
    If SetTime=1 then

    SetHour=(RTCHour>>4)&$01

    else
    SetHour=(RTCHour>>4)&$03

    endif
    SetHour=SetHour*10+(RTCHour&$0F)
    If SetTime=1 then
    If RTCHour.5=1 then
    If SetHour<12 then SetHour=SetHour+12

    else
    If SetHour=12 then SetHour=0
    endif
    endif
    SetMin=((RTCMin>>4)&$0F)*10+(RTCMin&$0F)
    SetSec=((RTCSec>>4)&$0F)*10+(RTCSec&$0F)
    SetYear=((RTCYear>>4)&$0F)*10+(RTCYear&$0F)
    SetMonth=((RTCMonth>>4)&$0F)*10+(RTCMonth&$0F)
    SetDay=((RTCDay>>4)&$0F)*10+(RTCDay&$0F)

    CounterC=0
    TimeOut=0
    SetupLoop:
    LCDOut $FE,1,"Set "

    If CounterC=0 then
    LCDOut "Mode"
    endif
    If CounterC=1 then
    LCDOut "Hours"
    endif
    If CounterC=2 then
    LCDOut "Minutes"
    endif
    If CounterC=3 then
    LCDOut "Seconds"
    endif
    If CounterC=4 then
    LCDOut "Year : 20"
    endif
    If CounterC=5 then
    LCDOut "Month"
    endif
    If CounterC=6 then
    LCDOut "Day"
    endif
    If CounterC<>4 then LCDOut " :"

    SetupDisplayLoop:
    If CounterC=0 then
    LCDOut $FE,$8B
    If SetTime=0 then
    LCDOut "24HR"
    else
    LCDOut "12HR"
    endif
    LCDOut $FE,$8B
    endif
    If CounterC=1 then
    CounterA=SetHour
    If SetTime=1 then
    LCDOut $FE,$8E
    ' Display AM/PM bit
    If CounterA<12 then
    LCDOut "AM"
    else
    LCDOut "PM"
    endif
    If CounterA=0 then CounterA=12
    If CounterA>12 then CounterA=CounterA-12
    endif
    LCDOut $FE,$8C,#CounterA
    If CounterA<10 then LCDOut " "
    LCDOut $FE,$8C
    endif

    If CounterC=2 then
    LCDOut $FE,$8E,#SetMin
    If SetMin<10 then LCDOut " "
    LCDOut $FE,$8E
    endif

    If CounterC=3 then
    LCDOut $FE,$8E,#SetSec
    If SetSec<10 then LCDOut " "
    LCDOut $FE,$8E
    endif

    If CounterC=4 then
    LCDOut $FE,$8D,#SetYear DIG 1,#SetYear Dig 0
    LCDOut $FE,$8D
    endif

    If CounterC=5 then
    LCDOut $FE,$8C
    CounterB=SetMonth
    Gosub DisplayMonth
    LCDOut $FE,$8C
    endif
    '
    ' Day
    ' ---
    If CounterC=6 then
    LCDOut $FE,$8A,#SetDay
    If SetDay<10 then LCDOut " "
    LCDOut $FE,$8A
    endif

    SetupEntryLoop:

    If DecButton=0 then

    If CounterC=0 then
    If SetTime=0 then
    SetTime=1
    else
    SetTime=0
    endif
    endif
    '
    ' Decrement Hours
    ' ---------------
    If CounterC=1 then
    If SetHour=0 then
    SetHour=23
    else
    SetHour=SetHour-1
    endif
    endif
    '
    ' Decrement Minutes
    ' -----------------
    If CounterC=2 then
    If SetMin=0 then
    SetMin=59
    else
    SetMin=SetMin-1
    endif
    endif
    '
    ' Decrement Seconds
    ' -----------------
    If CounterC=3 then
    If SetSec=0 then
    SetSec=59
    else
    SetSec=SetSec-1
    endif
    endif
    '
    ' Decrement Years
    ' ---------------
    If CounterC=4 then
    If SetYear=0 then
    SetYear=99
    else
    SetYear=SetYear-1
    endif
    endif
    '
    ' Decrement Month
    ' ---------------
    If CounterC=5 then
    If SetMonth=1 then
    SetMonth=12
    else
    SetMonth=SetMonth-1
    endif
    Gosub FindDays
    If SetDay>CounterA then SetDay=CounterA
    endif
    '
    ' Decrement Days
    ' --------------
    If CounterC=6 then
    Gosub FindDays
    If SetDay=1 then
    SetDay=CounterA
    else
    SetDay=SetDay-1
    endif
    endif
    Pause ButtonRepeat
    TimeOut=0
    Goto SetUpDisplayLoop
    endif

    If IncButton=0 then

    If CounterC=0 then
    If SetTime=1 then
    SetTime=0
    else
    SetTime=1
    endif
    endif
    '
    ' Increment Hours
    ' ---------------
    If CounterC=1 then
    If SetHour=23 then
    SetHour=0
    else
    SetHour=SetHour+1
    endif
    endif
    '
    ' Increment Minutes
    ' -----------------
    If CounterC=2 then
    If SetMin=59 then
    SetMin=0
    else
    SetMin=SetMin+1
    endif
    endif

    If CounterC=3 then
    If SetSec=59 then
    SetSec=0
    else
    SetSec=SetSec+1
    endif
    endif
    '
    ' Increment Years
    ' ---------------
    If CounterC=4 then
    If SetYear=99 then
    SetYear=0
    else
    SetYear=SetYear+1
    endif
    endif
    '
    ' Increment Month
    ' ---------------
    If CounterC=5 then
    If SetMonth=12 then
    SetMonth=1
    else
    SetMonth=SetMonth+1
    endif
    '
    Gosub FindDays
    If SetDay>CounterA then SetDay=CounterA
    endif
    If CounterC=6 then
    Gosub FindDays
    If SetDay=>CounterA then
    SetDay=1
    else
    SetDay=SetDay+1
    endif
    endif
    Pause ButtonRepeat
    TimeOut=0
    Goto SetupDisplayLoop
    endif
    '
    ' Set Button Pressed
    ' ------------------
    If SetButton=0 then
    CounterC=CounterC+1
    ' Increment Menu Item
    TimeOut=0
    If CounterC>6 then
    ' Save Data if all edit items exhaused
    LCDOut $FE,1,"Memorised"
    Attached Images Attached Images  

  38. #38
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Default Program continued...

    CounterA=SetHour
    If SetTime=1 then
    If CounterA>12 then CounterA=CounterA-12
    If CounterA=0 then CounterA=12
    endif
    Gosub ConvertBCD
    RTCHour=CounterB
    ' Save the Hours Value
    If SetTime=1 then
    RTCHour.6=1
    ' Save the 12 Hour Mode Flag
    If SetHour=>12 then RTCHour.5=1
    ' Save the 'PM' Flag
    endif
    '
    ' Save Minutes
    ' ------------
    CounterA=SetMin
    Gosub ConvertBCD
    RTCMin=CounterB
    '
    ' Save Seconds
    ' ------------
    CounterA=SetSec
    Gosub ConvertBCD
    RTCSec=CounterB
    '
    ' Save Year
    ' ---------
    CounterA=SetYear
    Gosub ConvertBCD
    RTCYear=CounterB
    '
    ' Save Month
    ' ----------
    CounterA=SetMonth
    Gosub ConvertBCD
    RTCMonth=CounterB
    '
    ' Save Day
    ' --------
    CounterA=SetDay
    Gosub ConvertBCD
    RTCDay=CounterB
    CounterA=SetYear+4
    CounterB=SetMonth
    If SetMonth<3 then
    CounterA=CounterA-1
    CounterB=CounterB+12
    endif
    CounterD=(SetDay+(153*CounterB-457)/5+365*CounterA+CounterA/4-CounterA/100+CounterA/400+2) MOD 7
    RTCWDay=CounterD+1
    '
    ' Do the Business
    ' ---------------

    I2CWrite SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCY ear,RTCCtrl]
    Pause 1000
    Gosub SetButtonRelease
    Goto ReDisplay
    endif
    Gosub SetButtonRelease
    Goto SetupLoop ' Loop for Next Menu Item
    endif


    Pause 1 ' Kill 1mS
    TimeOut=TimeOut+1
    If TimeOut>20000 then goto ReDisplay

    End

  39. #39
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Arrow To sum it up..

    i did the same connections shown in the shematic , downloaded the same program (that is displayed here) inside PIC16F628A, gave 5VDc and checked the connections again. But i didn't see anything on LCD.......

    I even added a variable resistor (10 K) for the contrast of LCD and fixed the light in the middle position.

    SO now, you will keep on saying that i have to read datasheets??

    or you will try to help me in an effective way?

    i finished my MEMS laboratory and sent it to canado to be manifactured :-D

    Friday i will present it in front of jury and MONDAY..... i'll graduate :-) and since then, i'll pass a whooooooole month in the Carribean!

    But right now, since i am used to pressure of work, i'll continue and work on this real time clock. But not now.... during the last month i was sleeping only 4 hours daily and then, working 20 hours on this project non-stop , with just 30 minutes of break for each day.... imagine this situation!!?

    so i will just sleep......

    Please guys, take it into consideration and check that schematic and program... tomorrow i'll be well awake so i'll concentrate on your replies and try to accomplish what you told me to do..

    But please, please , please........ stop talking about datasheets...

    By the way:

    "The California Dept of Fish and Game is advising hikers, hunters and fishermen to take extra precautions and keep alert for bears while in the Yosemite and Mammoth areas.

    They advise people to wear noise-producing devices such as little bells on their clothing to alert but not startle the bear unexpectedly. They also advise carrying pepper spray in case of an encounter with a bear. It is also a good idea to watch for fresh signs of bear activity and know the difference between black bear and grizzly bear droppings. Black bear droppings are smaller and contain berries and possibly squirrel fur. Grizzly bear droppings have little bells in them and smell like pepper spray." :-)

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


    Did you find this post helpful? Yes | No

    Smile

    Hi Eng4444,

    I wasn't trying to make you nervous by asking for drawings and code work. It just makes it easier to figure out what is going on. At first glance of the schematic I see the following:

    1) I think your LCD data lines are wrong. You should tie lines DB0 thru DB3 to ground then starting with DB4 tied to RA.0, DB5 to RA.1, DB.6 to RA.2 and DB7 to RA.3. The Read/Write pin on the LCD needs to go to ground. I tried to get the Datasheet (don't you just love it?) from Winstar but you have to signup with them to get these and I'm waiting to hear back from them so I can verify these connections when using a 4 bit bus. The couple of types of LCDs and VFDs I use start with DB4 when using 4 line bus connections.

    2) Pin 3 on the DS1307 needs to go either to a backup battery or tied to ground if you're not using the battery.

    3) You should change the pull up resistors on the SCL and SDA lines from 10K to 4.7K.

    4) I realize you had a hard time getting this drawn out but I don't see any capacitors. You need a .1uF on the power supply lines of EACH device as close to the device as possible. You should also have a .1uF and a 10uF on each side of the voltage regulator if that's how you are powering this project.

    You did mention that you have a potentiometer connected to the contrast pin of the LCD. I didn't see that on the drawing.

    Start with the above and try the program above. This may just take care of your problem. I have not sat down with the code. I trust that you have checked and rechecked that. Keep in mind that a single character wrong somewhere can keep it from working correctly. Someone recently had LCBOUT instead of LCDOUT. Big difference!

    Good luck!

    BobK
    Last edited by BobK; - 7th June 2006 at 19:56.

Similar Threads

  1. real time clock
    By maria in forum Code Examples
    Replies: 44
    Last Post: - 1st March 2022, 12:13
  2. Real Time Clock
    By in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 2nd June 2012, 04:52
  3. real time clock - PCF8583
    By maria in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 15th April 2010, 15:41
  4. Real Time Clock
    By savnik in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th December 2006, 02:02
  5. Real time clock... what a headache!
    By Eng4444 in forum mel PIC BASIC
    Replies: 2
    Last Post: - 8th June 2006, 21:56

Members who have read this thread : 1

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