+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: PIC16f690 Eread/Ewrite issues

  1. #11
    Super Moderator John Drew's Avatar
    Join Date
    Feb 2002
    Location
    Millicent, South Australia
    Posts
    911


    Default Re: PIC16f690 Eread/Ewrite issues

    Derych
    The only references to the 16F690 are in the general forum entries which you can see. Nothing in the BETA area that I can find with a search.
    A problem that has appeared in a small number of PICs is an error in a PPI file but I don't know if this is the issue here. Have you compared the contents of the PPI file for the 16F690 with the data sheet?
    Best wishes
    John

    Hi, its great to see you visiting our forum. Why not try Proton Compiler for FREE?

    Download the FREE version of Proton Compiler, Its called Amicus18 and its available from HERE

    Already using proton Compiler??? Get rid of these pesky messages... get LICENSED USER STATUS




  2. If you're a Licensed user of PROTON DEVELOPMENT SUITE, apply for Licensed User Status to remove these pesky messages
     and get access to additional forum areas, Beta test downloads and more!

  3. #12
    Licensed User captainslarty's Avatar
    Join Date
    Sep 2006
    Location
    A Marina in Portugal
    Posts
    3,064


    Default Re: PIC16f690 Eread/Ewrite issues

    Quote Originally Posted by deryckt View Post
    Hi all,

    I seem to have trouble reading & writing to PIC16f690 eeprom using Eread & Ewrite statements.
    Have been using these statements successfully with other PIC's i.e 12f675,16f676 etc.
    Does anyone know why this is happening? I desperately need a sulotion as I need to complete a urgent project a.s.a.p. Your help will be greatly appreciated.

    Here's a snippet of the way I use it.

    Dim Mintemp as word
    Dim Maxtemp as word
    .
    .
    .
    Mintemp = Eread 0
    Maxtemp = Eread 2
    .
    .
    .
    Ewrite 0, [Mintemp]
    Ewrite 2, [Maxtemp]

    The moment I include these read/write functions into my code, the whole program somehow becomes corrupt.


    Regards
    Deryck
    Look at the way it all works and best practice.
    For example -
    ;Variables
    Dim wMintemp as word
    Dim wMaxtemp as word

    ;EEprom data Index pointers
    eMintemp Edata As Word 10 ; or whatever Value you preset
    eMaxtemp Edata As Word 20 ; or whatever Value you preset

    ;Main Program

    wMintemp = Eread eMintemp ; Read from EEPROM index pointer
    wMaxtemp = Eread eMaxtemp ; Read from EEPROM index pointer

    ;Disable global interrupts here if used !
    Ewrite eMintemp, [wMintemp] ; Write to EEPROM index pointer
    Ewrite eMaxtemp, [wMaxtemp] ; Write to EEPROM index pointer
    ;Re - Enable global interrupts here if used !
    Last edited by captainslarty; 29th January 2012 at 08:35.
    Joe
    Civilisation is the limitless mutiplication of unecessary necessities ... (Mark Twain)

  4. #13


    Default Re: PIC16f690 Eread/Ewrite issues

    Quote Originally Posted by John Drew View Post
    Derych
    The only references to the 16F690 are in the general forum entries which you can see. Nothing in the BETA area that I can find with a search.
    A problem that has appeared in a small number of PICs is an error in a PPI file but I don't know if this is the issue here. Have you compared the contents of the PPI file for the 16F690 with the data sheet?
    Best wishes
    John
    Haven't done that yet, will definately have a look at it during course of day. Thanks a lot for your assistance. Greatly appreciated.
    Deryck

  5. #14


    Default Re: PIC16f690 Eread/Ewrite issues

    This looks like an option. Will make quick changes to this format and see if it works.
    Thanks Joe.
    P.S. Do you know if Button & Case statements make use of interrupts because my Ewrite statement is nested in a Select Case/ End Case routine.

  6. #15
    Licensed User captainslarty's Avatar
    Join Date
    Sep 2006
    Location
    A Marina in Portugal
    Posts
    3,064


    Default Re: PIC16f690 Eread/Ewrite issues

    Quote Originally Posted by deryckt View Post
    This looks like an option. Will make quick changes to this format and see if it works.
    Thanks Joe.
    P.S. Do you know if Button & Case statements make use of interrupts because my Ewrite statement is nested in a Select Case/ End Case routine.
    No they dont use interrupts Sir . no standard PDS command uses interrupts.

    Post or send me your code and I will test it and look at the ASM

    email is captainslarty at yahoo dot co dot uk.

    I use Edata , Eread and Ewrite all the time -
    no problems - do not refer to edata locations directly, use an index pointer as in a label.

    here is a brief of example of just one edata setup I am currently using -

    Code:
    'HEAD UNIT EEPROM ALLOCATIONS FOR MENU AND GENERAL CONDITIONING OF ALL OUTPUT !!! 
    'ALL USE WORDS as far simpler for lookup conversion !  
    
        'NB *************** CHANGE CHANNEL ORDER IN MAIN AND HEAD SO V1 = VCC - NOT !! V4   
        'CONFIRM HERE WHEN COMPLETED - NOT YET 20 08 2011 - 
    
    'EDATA index pointers  !
    'eChannel_Active_Flag EData As Word  255           'all channels active  - could be byte, but allow for more than 8 channels !
    
    eSCR                 EData As Word  0             '0 = on full, 1 = V only, 2 = Temps only, 3 = off (Manual step) - active channels
    'Voltage Channel High Alarm Limit   0 = off
    eHAL                 EData As Word  65535, 600, 051 'actual value off, high limit max 30.0 low limit min  5.1 (V1) 
                         EData As Word  65535, 600, 051 'actual value off, high limit max 60.0 low limit min  5.1 (V2) 
                         EData As Word  65535, 600, 051 'actual value off, high limit max 60.0 low limit min  5.1 (V3)
                         EData As Word  65535, 320, 051 'actual value off, high limit max 60.0 low limit min  5.1 (V4 VCC !!!)
                         EData As Word  65535, 490, 005 'actual value off, high limit min 00.5, low limit max  4.90 (V5 LV 5V)
    'Voltage Channel Low  Alarm Limit   0 = off
    eLAL                 EData As Word  65535, 600, 051 'actual value off, high limit max 30.0 low limit min 30.0
                         EData As Word  65535, 600, 051 'actual value off, high limit max 60.0 low limit min  5.1
                         EData As Word  65535, 600, 051 'actual value off, high limit max 60.0 low limit min  5.1
                         EData As Word  65535, 320, 051 'actual value off, high limit max 60.0 low limit min  5.1
                         EData As Word  65535, 490, 005 'actual value off, high limit max 4.90 low limit min 00.5
    'Temeperature Channel High Limit  >99.9 = off as we use 0 to read 0 C ! NOTE !
    eTAL                 EData As Word  65535, 099, 000   'actual value  85, high limit max 99 , low limit min 0
                         EData As Word  65535, 099, 000   'actual value  85, high limit max 99 , low limit min 0
                         EData As Word  65535, 099, 000   'actual value  85, high limit max 99 , low limit min 0
                         
    eDIS                 EData As Word  255'143'15
    eTCF                 EData As Word  0               '0 = degrees C , 1 = Degrees F Convertion needed
    
    
    eBLC                 EData As Word  1               '0 = Auto, 1 = Grn, 2 = Red, 3 = Blu, 4 = Off
    eBLT                 EData As Word  20              'in seconds
    eLED                 EData As Word  10              'in seconds  Button Backlight Time !
    eALA                 EData As Word  0               '0 OFF - 1 ON
    ;testing of new relay only !!
    eRRS                 EData As Word  1  ;relay reset after max time exceded -flag - 
    eRES                 EData As Word  0  ;relay state /status?  
    eREL                 EData As Word  256't3 'v5 '256 ' t3 'v1            'bit set points to channel !!! bit 0 = 1 = OFF ,bit 1 = 1 = chann 1 etc
    eRON                 EData As Word  4   ;trigger on value
    eROF                 EData As Word  5   ;trigger off value
    eRTO                 EData As Word  10 ' minutes time relay is on after off
    eRTM                 EData As Word  15 ' minutes timeout if off value nver reached             '
    
    eSLP                 EData As Word  0               '0 off - 1 on
    eCON                 EData As Word  6               'Contrast TEST from 05 01 2012 )1 to 8 where 1 is min and 8 is max - 
    eUID                 EData As Word  11              'Unit ID From Main ? - check with Kai !
    eUSV                 EData As Word  100             'HEAD Firmware Version Number
    eRSV                 EData As Word  101             'Main Firmware Version Number
    eLOC                 EData As Word  65535           'Lock off = 65535, otherwise (001 - 999)
    eRST                 EData As Word  0               ' 0 = ok, 1 = factory reset needed !!!
    
    eFTO                 EData As Byte  0               ' first time on ! else 1 - reset to 0 on factory reset
    eVCC                 EData As Byte  0               ' 0 = 12 , 1 = 24
    
    Menu_Lookup          EData As Word Menu_0, Menu_1, Menu_2, Menu_3, Menu_4, Menu_5, Menu_6    'SEL
                         EData As Word Menu_7, Menu_8, Menu_9, Menu_10,Menu_11,Menu_12,Menu_13,Menu_14,Menu_15,Menu_16,Menu_17 'BLT
                         EData As Word Menu_18,Menu_19,Menu_20,Menu_21,Menu_22,Menu_23,Menu_24,Menu_25,Menu_26  'BOTH 
    Edata_Lookup         EData As Byte eSCR,eLAL,eHAL,eTAL,eDIS,eTCF,0  'Sel
                         EData As Byte eBLC,eBLT,eLED,eALA,eRRS,eRES,eREL,eRON,eROF,eRTO,eRTM,0 'Blt
                         EData As Byte eSLP,eCON,eUID,eUSV,eRSV,eLOC,eRST,0 'Sel + Blt
    
    Edata_End            EData As Byte 0    ' 204 bytes used so far as of build 2_99 !   ' for testing only ! to see eeprom space used !
    ;New rel 1939 V2 edata end
    And some sample use -

    Code:
    bTMP_Var1 = ERead eFTO                        ' is this the first time ever on, or after factory reset ?
        INTCON.7=0 ; disable interrupts
        If bTMP_Var1 = 0 Then                     ' this IS the first time on or factory reset- 
                If wVolts[3] <  170 Then          ' VCC = 12V 
                    wTMP_Var2 = 155               ' 15.5V High Alarm
                    wTMP_Var3 = 119               ' 11.9V Low  Alarm
                    flgVCC_12_24 = 0              ' VCC = 12 flag
                ElseIf wVolts[3] > 170 Then       ' VCC = 24V  
                    wTMP_Var2 = 310               ' 32.0V High Alarm (Possibly 33V not available >>>??)
                    wTMP_Var3 = 238               ' 24.4V Low  Alarm 
                    flgVCC_12_24 = 1              ' VCC = 24 flag
                EndIf
            'endif
            EWrite eVCC,[flgVCC_12_24]            ' set eVCC to 0 (12v range) or 1 (24v range)
            EWrite eFTO,[1]                       ' now NOT first time on so set eFTO to 1 
            EWrite eHAL + 18 ,[wTMP_Var2]         ' write the range setting to eHAL V4 for 12 or 24 VCC
            EWrite eLAL + 18 ,[wTMP_Var3]         ' write the range setting to eLAL V4 for 12 or 24 VCC
        EndIf
        INTCON.7=1 ;re-enable interrupts

    Ignore the comments as they are from mostly outdated code - but is shows eread and ewrite and edata usage.

    Joe.

    edit - this is using 16F1939
    Last edited by captainslarty; 29th January 2012 at 10:01.
    Joe
    Civilisation is the limitless mutiplication of unecessary necessities ... (Mark Twain)

  7. #16


    Default Re: PIC16f690 Eread/Ewrite issues

    Thanks Joe, I sent it to you via e-mail. Let me know if for some reason it didn't reach you.
    Best regards
    Deryck

  8. #17
    Licensed User captainslarty's Avatar
    Join Date
    Sep 2006
    Location
    A Marina in Portugal
    Posts
    3,064


    Default Re: PIC16f690 Eread/Ewrite issues

    Quote Originally Posted by deryckt View Post
    Thanks Joe, I sent it to you via e-mail. Let me know if for some reason it didn't reach you.
    Best regards
    Deryck
    Got the email Sir
    Reply sent, please see button command !
    Joe.
    Joe
    Civilisation is the limitless mutiplication of unecessary necessities ... (Mark Twain)

  9. #18


    Default Re: PIC16f690 Eread/Ewrite issues

    Thanks again Joe,

    Got it to finally work. Nothing wrong with anything here. Turns out to be poor me using Button command incorrectly. Button command points to Gosub routines instead of Lables. Cunfused the poor PIC chip into going completely corrupt. Changed it, and now it works like a bomb. Only trouble now is that the LM35 gives a Zero readout, but I think I know why. I rolled back to the original packaged compiler yesterday evening and I know that a few people are having trouble with ADIN command using 16f690. I'll just search the forum and find the solution.

    Thanks again to everybody for their help & assistance. I'm new to this forum and my first impression definately is a good one.
    Will visit here soon and see if I can maybe offer some help to other users from time to time.

    Best regards
    Deryck

  10. #19


    Default Re: PIC16f690 Eread/Ewrite issues

    This seems to be one of Microchip's "never to be released Chip". Not only do I have endless problems with it, but it seems that a Google search brings up endless problems with it. Wish they would just stick their pride and give it to you straight.

+ Reply to Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. EWrite/ERead
    By t0pP8uZz in forum Proton Plus Compiler v3
    Replies: 7
    Last Post: 11th December 2009, 15:47
  2. ERead and EWrite execution times?
    By muskut in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 11th December 2007, 14:43
  3. Eread Ewrite 18f2320
    By andyb in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 24th January 2007, 14:08
  4. ewrite/eread clarification
    By Latex in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 21st September 2005, 10:09
  5. EREAD & EWRITE syntax
    By John Lawton in forum Wish List / Product Feedback
    Replies: 0
    Last Post: 22nd June 2004, 11:40

Members who have read this thread since 2nd May 2012, 20:19 : 2

Actions :  (Set Date)  (Clear Date)

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