On Board EEPROM Write Read


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2005
    Posts
    67

    Question On Board EEPROM Write Read

    Hello,
    Aim -
    To Read Status of Pins, A2 - A5 (4 bits)
    Display on Other Pins, B4 - B7
    Store Data in EEPROM Location 24 (Onboard)

    Program 16F628a 4 mhz
    *Usual Setups etc
    ID var Byte
    ID = 0
    ' Get Chip ID from PortA 2 - 5
    If PortA.2 = 1 Then
    ID = ID + 1
    High PortB.4
    EndIf
    If PortA.3 = 1 Then
    ID = ID + 2
    High PortB.5
    EndIf
    If PortA.4 = 1 Then
    ID = ID + 4
    High PortB.6
    EndIf
    If PortA.5 = 1 Then
    ID = ID + 8
    High PortB.7
    EndIf
    Write 24,ID

    If all ID were high I was expecting 0F in the location, however
    the data pins showed correct, ie all high, but eeprom showed 0C.

    Why?

    Peter
    Pete

  2. #2
    Join Date
    Feb 2005
    Posts
    67


    Did you find this post helpful? Yes | No

    Red face

    Oh Dear!!!! Got caught again !!!
    Trick for anyone reading this....
    If you use a PIC chip with on board Analogue Inputs, ie
    A0, A1, A2, A3 on PIC 16F628a,
    Make SURE you add the line
    CMCON = 7 ( Disable A-D, PortA = Digital)

    Adding this line resolved the problem.

    Actually I realised as I was typing the question before,
    added the line in the program, and yep! all working.

    Trust this will help.
    thnks
    Peter
    Pete

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    S.h.i.t. happen

    BTW PORTA is always a problem source... nothing new if i say
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Feb 2005
    Posts
    67


    Did you find this post helpful? Yes | No

    Talking

    Thnks Steve.

    Yep, the old saying R.T.F.M is always true.

    Peter
    Pete

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Hehe i try to stay as polite as i can
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Feb 2005
    Posts
    67


    Did you find this post helpful? Yes | No

    Talking

    Sorry Steve, I did not mean to offend.
    Pete

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I think it's the time to share that picture and laugh together... hehe i like it!!!
    Attached Images Attached Images  
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 14:46
  2. Cleaning up code
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd December 2009, 07:14
  3. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  4. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19
  5. word variable to 25lc640
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2004, 19:59

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