ds1307 from f877 to f452 not work


Closed Thread
Results 1 to 24 of 24

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Can you try it with a variable instead of a constant in the I2C Address... eg...

    RTC var Byte

    RTC=$D0
    I2CWRITE DPIN,CPIN,RTC,0,[0,0,0,0,0] ' intilization of ds1307

    and likewise in reading...

    I2CREAD DPIN,CPIN,RTC,0,[B0] 'ds1307 read

    there is no need to change between $D0 and $D1 when reading or writing, because PBP manipulates bit zero for you automatically. You only need to concern yourself with the upper seven bits of the address.

    Nobody reads FAQ's... makes me wonder why I spent the time doing them in the first place...http://www.picbasic.co.uk/forum/showthread.php?t=587

  2. #2
    microkam's Avatar
    microkam Guest


    Did you find this post helpful? Yes | No

    Angry

    i edited my programe on the new defined and the ds1307 still not working
    ,i download the new programe on the 16f877 and all thing is ok
    whats the problem!!!
    mel, can you see the new programe and tell me whats the wrong
    Last edited by microkam; - 6th July 2005 at 13:39.

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


    Did you find this post helpful? Yes | No

    Default

    I interchange 18F252, 18F242, 18F2420, 18F2520 and 18F2620 with 16F876's all the time, on the same boards with a DS1307 installed (although I use different pins to you). From memory, other than CONFIG FUSES and the Weak Pull-Up's having a different Register, there's not too many other changes to look out for. Can you try another 18F PIC? what versions of PBP and MPLAB/MPASM are you using?

  4. #4
    microkam's Avatar
    microkam Guest


    Did you find this post helpful? Yes | No

    Unhappy

    i used picbasic pro 2.4
    microcode studio 2.0.5.2
    mpasm v02.80
    whats the state of fuses you use
    i used HS are this correct

  5. #5
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by microkam
    i used picbasic pro 2.4
    microcode studio 2.0.5.2
    mpasm v02.80
    whats the state of fuses you use
    i used HS are this correct
    There are newer Versions of all the packages available.
    (MicroCode Studio and MPASM are available for download)

    With regards to the Fuses and Config Bits:
    The Loader.HEX usually has all this preset, so you don't have to worry.
    (As long as your programmer doesn't alter them)
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  6. #6
    microkam's Avatar
    microkam Guest


    Did you find this post helpful? Yes | No

    Unhappy

    ok NavMicroSystems , whats the soluation i tested all thing and no result

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    PBP version 2.42 introduced some timing changes to I2CREAD/I2CWRITE for
    the 18F series. That may be why you're having problems if you're using
    version 2.40.

    I've compiled your code as-is with PBP v2.46. See if this works for you.
    Attached Files Attached Files
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  8. #8
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Melanie,

    you are absolutely right in:
    Quote Originally Posted by Melanie
    there is no need to change between $D0 and $D1 when reading or writing, because PBP manipulates bit zero for you automatically. You only need to concern yourself with the upper seven bits of the address.
    However,
    all variants listed should work:
    (I would always prefer the first one)

    Code:
    RTC CON $D0
    I2CWRITE DPIN,CPIN,RTC,0,[0,0,0,0,0]
    Code:
    RTC var Byte
    RTC=$D0
    I2CWRITE DPIN,CPIN,RTC,0,[0,0,0,0,0]
    Code:
    I2CWRITE DPIN,CPIN,$D0,0,[0,0,0,0,0]
    and even this one
    (Bit0 set with I2CWRITE)
    works since PBP takes care of Bit0:
    Code:
    I2CWRITE DPIN,CPIN,$D1,0,[0,0,0,0,0]
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  9. #9
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Since microkam has connected the I2" lines to C.4 and C.5
    and there is nothing special with PortC on the 877 or 452
    it should actually be "Plug&Play"
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



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


    Did you find this post helpful? Yes | No

    Default

    Ralph:

    I have had instances (back in PBP ver 2.42) where a constant in the Device Address (eg $D0) didn't work. I've had a constant work on a 16F628, yet fail on an 16F872. Since switching to using variables, I've not experienced any problems. I've not botherd doing any in-depth studies on versions beyond 2.42 since if I don't get problems then I don't go out of my way looking for them.

    Microkam:

    XT for 4MHz or less, HS for greater than 4MHz.
    Which sub-version of 2.4... there's big differences between say 2.40 and 2.46.

  11. #11
    microkam's Avatar
    microkam Guest


    Did you find this post helpful? Yes | No

    Unhappy

    i want to change the HS to XT and i well reply to you

Similar Threads

  1. pls help me verify my code not work, why???
    By chai98a in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th January 2010, 09:19
  2. Can't get switch to work
    By JeffnDana in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th April 2007, 20:44
  3. DS1307 on fire
    By brid0030 in forum General
    Replies: 6
    Last Post: - 25th November 2006, 02:44
  4. How to set ICD-2 clone to work with PBP?
    By G-R-C in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th October 2006, 02:50
  5. Pin RA4 doesn't work
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 15th July 2004, 12:03

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