What am I doing wrong?


Closed Thread
Results 1 to 4 of 4
  1. #1

    Exclamation What am I doing wrong?

    Hi
    As a part of my ongoing project, here is my new problem now:
    first:
    read 134,a : read 135,b : read 136,c
    if a<>"6" and b<>"9" and c<>"7" then
    for i=0 to 255
    write i,"0"
    next i
    EEPROM 100,["+","4","4","7","4","3","2","2","2","3","1","4","7 ","+","4","4","7","8","2","2","2","2","5","1","0", "7","0","0","0","0","1","1","1","1","6","9","7 "]
    for i=100 to 112
    read i,ph[i-100]
    next i
    if ph[1]="4" THEN'and ph[6]="2" then
    while 1
    toggle portc.0
    pause 50
    wend
    endif
    endif
    This is not working. Can someone advise me please what am I doing wrong.
    FYI - I am using PBP with MPLAB & my PIC is 16F690.
    Thanks
    ___________________
    WHY things get boring when they work just fine?

  2. #2
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    from the PBP manual on the EEPROM command:

    "The data is stored in the EEPROM space only once at the time the microcontroller is programmed, not each time the program is run. WRITE can be used to set the values of the on-chip EEPROM at runtime. READ is used to retrieve these stored DATA values at runtime."

    If you intend the command where u use EEPROM to run every time you will have to use a series of WRITE commands instead.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  3. #3


    Did you find this post helpful? Yes | No

    Exclamation

    Quote Originally Posted by Kamikaze47 View Post
    from the PBP manual on the EEPROM command:

    "The data is stored in the EEPROM space only once at the time the microcontroller is programmed, not each time the program is run. WRITE can be used to set the values of the on-chip EEPROM at runtime. READ is used to retrieve these stored DATA values at runtime."

    If you intend the command where u use EEPROM to run every time you will have to use a series of WRITE commands instead.
    Thanks for the input. The above code will only run once. Once values 6,9,7 will be written at location 134,135,136 - code will never enter again in this routine regardless of number of times of power cycles. Also it will write my phone number as well for once only.
    The endless loop you see which toggles the portc.0 is just to test that this has been performed.
    But its not working.
    ___________________
    WHY things get boring when they work just fine?

  4. #4


    Did you find this post helpful? Yes | No

    Talking

    OK, after all day breaking my head, I think I have figured it out how to use this command excatly and when and how it executes. Code is working now.
    Thanks for the input.
    ___________________
    WHY things get boring when they work just fine?

Similar Threads

  1. LCD Showes Some Wrong Letters
    By sbobowski in forum General
    Replies: 2
    Last Post: - 23rd September 2008, 19:15
  2. Anyone know whats wrong with this code
    By Bonxy in forum Serial
    Replies: 10
    Last Post: - 9th March 2007, 16:29
  3. ADCIN - AD settings are wrong
    By teverett in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th December 2006, 16:32
  4. What am I doing wrong?
    By mankan in forum General
    Replies: 1
    Last Post: - 23rd June 2006, 19:03
  5. HDD IDE ATA 2 interface problems. code wrong?
    By rastan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th March 2005, 16:01

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