Inscrutable eeprom problem


+ Reply to Thread
Results 1 to 7 of 7

Thread: Inscrutable eeprom problem21 days old

  1. #1
    Member Peter Truman's Avatar
    Join Date
    Dec 2003
    Posts
    312
    Thumbs Up
    Received: 8
    Given: 7
    Total Downloaded
    406.61 MB

    0 Not allowed!

    Default Inscrutable eeprom problem

    Hi All

    I've run into a problem I'm struggling to understand - any help would be much appreciated

    IDE 2.0.3.3
    Compiler 3.6.1.6

    The code below (which is a fragment of a larger program - with everything else currently commented out) produces this eeprom dump at startup

    Eeprom
    DW_Slot_1 = 00000000
    W_Menu_Time_Out = 00000
    W_Flag = 11111111
    B_PS_Beeps = 006
    B_Srt_Pulse = 001
    B_Stp_Pulse = 005
    W_IStop_Timeout = 00120
    W_Log_Line_No = 00000

    so clearly not reading the first 2 variables from the eeprom properly. (others are ok)

    However, if I move the string variable definitions to the end of the variables list - then I get the following output.

    Eeprom
    DW_Slot_1 = 30111701
    W_Menu_Time_Out = 00120
    W_Flag = 11111111
    B_PS_Beeps = 006
    B_Srt_Pulse = 001
    B_Stp_Pulse = 005
    W_IStop_Timeout = 00120
    W_Log_Line_No = 00000

    which appears to be correct. What worries me is that, unless I understand what is happening here I'm likely to run into problems in the larger program!

    I've tried other locations for the string var definitions but the problem only seems to go away if I place the strings vars AFTER the byte vars - anywhere below that seems fine.


    Code:
    Device = 18F25K22
    
    
    
    Config_Start
      FOSC = INTIO67    ;Internal oscillator block
      PLLCFG = OFF    ;Oscillator used directly
      PRICLKEN = On    ;Primary clock enabled
      FCMEN = On    ;Fail-Safe Clock Monitor enabled
      IESO = OFF    ;Oscillator Switchover mode disabled
      PWRTEN = On    ;Power up timer enabled
      BOREN = SBORDIS    ;Brown-out Reset enabled in hardware only (SBOREN is disabled)
      BORV = 190    ;VBOR set to 1.90 V nominal
      WDTEN = off    ;WDT is always enabled. SWDTEN bit has no effect
      WDTPS = 1024    ;1:32768
      CCP2MX = PORTC1    ;CCP2 input/output is multiplexed with RC1
      PBADEN = OFF    ;PORTB<5:0> pins are configured as digital I/O on Reset
      CCP3MX = PORTB5    ;P3A/CCP3 input/output is multiplexed with RB5
      HFOFST = On    ;HFINTOSC output and ready status are not delayed by the oscillator stable status
      T3CMX = PORTC0    ;T3CKI is on RC0
      P2BMX = PORTB5    ;P2B is on RB5
      MCLRE = EXTMCLR    ;MCLR pin enabled, RE3 input pin disabled
      STVREN = On    ;Stack full/underflow will cause Reset
      LVP = OFF    ;Single-Supply ICSP disabled
      XINST = OFF    ;Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
      Debug = OFF    ;Disabled
      Cp0 = OFF    ;Block 0 (000800-001FFFh) not code-protected
      CP1 = OFF    ;Block 1 (002000-003FFFh) not code-protected
      CP2 = OFF    ;Block 2 (004000-005FFFh) not code-protected
      CP3 = OFF    ;Block 3 (006000-007FFFh) not code-protected
      CPB = OFF    ;Boot block (000000-0007FFh) not code-protected
      CPD = OFF    ;Data EEPROM not code-protected
      WRT0 = OFF    ;Block 0 (000800-001FFFh) not write-protected
      WRT1 = OFF    ;Block 1 (002000-003FFFh) not write-protected
      WRT2 = OFF    ;Block 2 (004000-005FFFh) not write-protected
      WRT3 = OFF    ;Block 3 (006000-007FFFh) not write-protected
      WRTC = OFF    ;Configuration registers (300000-3000FFh) not write-protected
      WRTB = OFF    ;Boot Block (000000-0007FFh) not write-protected
      WRTD = OFF    ;Data EEPROM not write-protected
      EBTR0 = OFF    ;Block 0 (000800-001FFFh) not protected from table reads executed in other blocks
      EBTR1 = OFF    ;Block 1 (002000-003FFFh) not protected from table reads executed in other blocks
      EBTR2 = OFF    ;Block 2 (004000-005FFFh) not protected from table reads executed in other blocks
      EBTR3 = OFF    ;Block 3 (006000-007FFFh) not protected from table reads executed in other blocks
      EBTRB = OFF    ;Boot Block (000000-0007FFh) not protected from table reads executed in other blocks
    Config_End
    
    
    
    ;**** End of Fuse Configurator Settings ****
    ;-------------------------------------------------------------------------------
    
    Optimiser_Level = 0                                                             ' NO optimisation  (? max 3)
    
    OSCCON.6=1
    OSCCON.5=1
    OSCCON.4=1
    OSCTUNE.6=0                                                                     'disable the 4x PLLEN
    
    Xtal = 16                                                                       'toggle test with 2000ms shows 2.0022s
    
    'Declare Create_Coff=True
    'setup the I2C comms
    Declare SDA_Pin PORTC.4                                                         '12C declares
    Declare SCL_Pin PORTC.3
    Declare Slow_Bus off
    
    
    All_Digital=True                                                                'start at digital
    Declare PORTB_Pullups=On                                                        'enable pullups
    Declare Adin_Res 10                                                             '10 bit result
    Declare Adin_Tad FRC                                                            'clock source
    Declare Adin_Stime 50                                                           'time to dx cap
    ADCON2.7=1                                                                      'make sure it is RIGHT justified  for a 10 bit result
    INTCON.7=0
    
    ;Calculated Baudrate = 19231 @ Xtal 16MHz, Error = 0.16%
    Declare Hserial_RCSTA = 144 ; Enable continuous receive
    Declare Hserial_TXSTA = 32  ; Enable transmit, BRGH = 0
    Declare Hserial_SPBRG = 12  ; Baud Rate Generator Value
    Declare Hserial_Clear = On  ; Clear overflow automatically
    BAUDCON.3             = 0   ; Disable the 16 bit Baud Rate Generator
    
    ;Calculated Baudrate = 1202 @ Xtal 16MHz, Error = 0.17%                         NBEK Chip
    Declare Hserial2_RCSTA = 144 ; Enable continuous receive
    Declare Hserial2_TXSTA = 32  ; Enable transmit, BRGH = 0
    Declare Hserial2_SPBRG = 207 ; Baud Rate Generator Value
    Declare Hserial2_Clear = On  ; Clear overflow automatically
    BAUDCON2.3             = 0   ; Disable the 16 bit Baud Rate Generator
    
    Declare RsOut_Pin=PORTA.3                                                       'LCD Data
    Declare RsOut_Mode=inverted
    Declare Serial_Baud 9600
    
    'rename the pins
    
    Symbol        _RSSI              PORTA.1
    Symbol        _LCDdat            PORTA.3                                        'serial data out to LCD
    Symbol        _Coil1             PORTA.4                                        'buttons
    Symbol        _Coil3             PORTA.5
    Symbol        _Coil2             PORTA.6
    
    Symbol        _Menu              PORTB.2
    Symbol        _Up                PORTB.3
    Symbol        _Dn                PORTB.4
    Symbol        _Enter             PORTB.5
    
    Symbol        _Piezzo            PORTC.2                                        'Buzzer drive
    Symbol        _NBEK              PORTC.5
    
    TRISA=%00000010
    TRISB=%00111100
    TRISC=%10000000
    
    TRISC.6=1
    TRISC.7=1
    TRISB.6=1
    TRISB.7=1
    
    'Confirm I/O
    
    Low _Piezzo
    Low _Coil1
    Low _Coil2
    Low _Coil3
    
    'Variables
    'Strings
    Dim S_UDX_Temp As String *8
    Dim S_Up_String As String *51
    Dim S_Pnt_Line As String *22 
    Dim S_Tmp As string*2
    Dim S_Val As String*3
    Dim S_Status_Strng As String * 15
    Dim S_Status_Err As String * 2
    
    
    
    'Floats
    Dim F_Pres_Slope As Float
    Dim F_Pres_Offset As Float
    Dim F_Pres As Float
    Dim F_Pres_Slope_A As Float
    Dim F_Pres_Slope_B As Float
    Dim F_Pres_Offset_B As Float
    Dim F_Pres_Offset_A As Float
    
    'Arrays
    Dim A_Rx_Buff[23] As Byte
    Dim A_Rx_Pkt[25] As Byte
    
    'Dwords
    Dim DW_Slot_1  As Dword
    Dim D_Rx_UDX As Dword
    Dim D_UDX_Temp As Dword
    
    'Words
    Dim W_Rx_Add As Word
    Dim W_Rx_an1 As Word
    Dim W_Rx_an2 As Word
    Dim W_Rx_an3 As Word
    Dim W_toffset As Word
    Dim W_MS_pause As Word
    Dim W__Rx_UDX_Hi As D_Rx_UDX.HighWord
    Dim W_Rx_UDX_Lo As D_Rx_UDX.LowWord
    Dim W_Rx_Control As Word
    Dim W_Rx_CRC As Word
    Dim W_OUT_CRC As Word
    Dim W_Data_DAC As Word
    Dim W_Menu_Time_Out As Word
    Dim W_Menu_Time As Word
    Dim W_Val As Word
    Dim W_ADaverage As Word
    Dim W_raw_pres As Word
    Dim W_Pres As Word
    Dim W_Flag As Word                             'word sized array of 1 bit flags
    Dim W_Valid_Rx_An As Word
    Dim W_IStop_Timeout As Word
    Dim W_IS_Time As Word
    Dim W_Log_Line_No As Word
    Dim W_Millis As Word
    Dim W_His_analog As Word
    Dim W_Serial_Outpt As Word
    Dim W_Status_chcksm As Word
    Dim W_Status_Pres As Word
    Dim W_Status_S_check As Word
    Dim W_G_Var As Word
    
    'Bytes
    Dim B_Load_RX_L1 As Byte
    Dim B_Sys_L1 As Byte
    Dim B_Sys_L2 As Byte
    Dim B_Main_L1 As Byte
    Dim B_Rx_Group As Byte
    Dim B_Rx_Mask As Byte
    Dim B_Rx_Dig As Byte
    Dim B_second As Byte
    Dim B_Rx_SN As Byte
    Dim B_Rx_Me As Byte
    Dim B_Rx_Hopcount As Byte
    Dim B_LOOP_CRC As Byte
    Dim B_IN_CRC As Byte
    Dim B_DAC_pnt As Byte
    Dim B_EX_Port As Byte
    Dim B_RTCsec_Temp As Byte
    Dim B_RTCseconds As Byte
    Dim B_Bin2BCD_Value As Byte
    Dim B_BCD2BIN_Value As Byte
    Dim B_RTCminute As Byte
    Dim B_RTChour As Byte
    Dim B_RTCdy As Byte
    Dim B_RTCdat As Byte
    Dim B_RTCmnth As Byte
    Dim B_RTCyr As Byte
    Dim B_Ctrol As Byte
    Dim B_Temp_1 As Byte
    Dim B_temp_2 As Byte
    Dim B_Dig_In As Byte
    Dim B_Byte_Rx As Byte
    Dim B_Rx_Bytecnt As Byte
    Dim B_S_Pos As Byte
    Dim B_Length As Byte
    Dim B__UP_G As Byte
    Dim B_CRC_LCD As Byte
    Dim B_Temp_Local_1 As Byte
    Dim B_Temp_Local_2 As Byte
    Dim B_Upld_Local_1 As Byte
    Dim B_PS_Beeps As Byte
    Dim B_Beep_Cnt As Byte
    Dim B_Srt_Pulse As Byte
    Dim B_Stp_Pulse As Byte
    Dim B_Temp_Local_3 As Byte
    Dim B_temp_clock As Byte
    Dim B_Strt_Beeps As Byte
    Dim B_Timer_Start As Byte
    Dim B_Timer_Stop As Byte
    Dim B_Status_RTClk As Byte
    Dim B_ISR_G_Var As Byte
    Dim B_10_Sec As Byte
    Dim B_UPLD_Cnt As Byte
    Dim B_Stat_Cnt As Byte
    
    'Bits
    Dim b_ESC_flg As Bit
    Dim b_Ok_Packet As Bit
    Dim b_Ok_CRC As Bit
    Dim b_dots As Bit
    Dim b_Col_flg As Bit
    Dim b_Pkt_Flag As Bit
    Dim b_100ms_Flg As Bit
    Dim b_1sec_flag As Bit
    Dim b_Timeot As Bit
    Dim b_Refrsh As Bit
    Dim b_P_Status As Bit
    Dim b_Rx_P_1 As Bit
    Dim b_E_Flag As Bit
    Dim b_T_flg As Bit
    Dim b_OK_Restart As Bit
    Dim b_YesNo As Bit
    Dim b_Esc_Menu As Bit
    Dim b_Using_Menu As Bit
    Dim b_status_arriving As Bit
    Dim b_His_Digital As Bit
    Dim b_His_Data_OK As Bit
    Dim b_Serial_Outpt As Bit
    Dim b_Status_Stat As Bit
    Dim b_My_Debug As Bit
    Dim b_Sig_OK As Bit
    
    'Alias
    Dim B_Hi_DAC As W_Data_DAC.HighByte                                                'alias the highbyte
    Dim B_Lo_DAC As W_Data_DAC.LowByte                                                'alias the lowbyte
    Dim b_Sig_LED As B_EX_Port.0
    Dim b_Pwr_LED As B_EX_Port.1
    Dim b_Out_LED As B_EX_Port.2
    Dim b_Error_LED As B_EX_Port.3
    Dim b_Back_LED As B_EX_Port.4
    Dim b_En_Pass As W_Flag.0                                                       'pass data to next unit ( 1= yes)
    Dim b_Last_Stp As W_Flag.1                                                        'last stop code (0 ok, 1=fault)
    Dim b_TO_Act As W_Flag.2
    Dim b_Sel_source As W_Flag.3                                                    'where are we getting the data (0=radio, 1 = serial)
    Dim b_Set_Source As W_Flag.4                                                    'record the fact we have set the source type
    Dim b_Silent As W_Flag.5                                                        'operate in silent mode
    
    
    
    'new avaerage vars for 12 bit ADC
    Symbol B_ADC_count=32
    Symbol B_FASpread=20
    
    Clear
    
    Symbol Display=%01000011                                                        'front display PCF8574
    Symbol Ad5315 =%00011000                                                        'DAC
    Symbol IO=%01000001                                                             'Digital I/O
    Symbol CRCPolynomial = $1021                                                    'CRC-CCIT
    Symbol Write_To_3231 = %11010000 'set the 1337 to receive data                  'RTC address write
    Symbol Read_From_3231 = %11010001 'set the 1337 to transmit data                'RTC address read
    Symbol ADC=%10011011                                                            'ADC
    
    Symbol C_Start_Chr="*"                                                          'propriatory to Waterwire
    Symbol C_End_Chr="~"
    Symbol C_Data_Start=">"
    Symbol C_Data_End="<"
    
    
    F_Pres_Slope_A=0.073206
    F_Pres_Offset_A=-0.21962
    F_Pres_Slope_B=0.073386
    F_Pres_Offset_B=0.583554
    
    
    b_Pwr_LED=1: b_Sig_LED=1: b_Out_LED=1: b_Error_LED=1                            'turn off front panel Leds  (set is off)
    
    EData Dword 30111701, Word 120, Word 65535, Word 120, Word 0, Byte 6, Byte 1, Byte 5
    
    DW_Slot_1 =                ERead 0                '00,01,02,03                               'This is the slot 1 address to recieve
    W_Menu_Time_Out =          ERead 4                '04,05
    W_Flag=                  ERead 6                '06,07
    W_IStop_Timeout=           ERead 8                '08,09
    W_Log_Line_No =          ERead 10            '10,11
    B_PS_Beeps=             ERead 12            '12
    B_Srt_Pulse   =         ERead 13            '13
    B_Stp_Pulse    =         ERead 14            '14
    
    'dump eeprom
    HRSOut "Eeprom",13
    HRSOut "DW_Slot_1          = ",Dec8 DW_Slot_1,13
    HRSOut "W_Menu_Time_Out    = ",Dec5 W_Menu_Time_Out,13
    HRSOut "W_Flag             = ",Bin8 W_Flag,13
    HRSOut "B_PS_Beeps         = ",Dec3 B_PS_Beeps,13
    HRSOut "B_Srt_Pulse        = ",Dec3 B_Srt_Pulse,13
    HRSOut "B_Stp_Pulse        = ",Dec3 B_Stp_Pulse,13
    HRSOut "W_IStop_Timeout    = ",Dec5 W_IStop_Timeout,13
    HRSOut "W_Log_Line_No      = ",Dec5 W_Log_Line_No,10,13
    Peter Truman

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,215
    Thumbs Up
    Received: 74
    Given: 180
    Total Downloaded
    5.15 GB

    0 Not allowed!

    Default Re: Inscrutable eeprom problem

    Is it a figment of the board are you missing radix indicators (%, $, etc.)?
    George.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    Member Peter Truman's Avatar
    Join Date
    Dec 2003
    Posts
    312
    Thumbs Up
    Received: 8
    Given: 7
    Total Downloaded
    406.61 MB

    0 Not allowed!

    Default Re: Inscrutable eeprom problem

    Hi George

    Not entirely clear what you mean (radix indicators - so Dec, Bin etc?) But the problem is not just in the display - the variables are genuinely empty!
    Peter Truman

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,215
    Thumbs Up
    Received: 74
    Given: 180
    Total Downloaded
    5.15 GB

    0 Not allowed!

    Default Re: Inscrutable eeprom problem

    No, I mean % and $. Just a guess
    George.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Member Peter Truman's Avatar
    Join Date
    Dec 2003
    Posts
    312
    Thumbs Up
    Received: 8
    Given: 7
    Total Downloaded
    406.61 MB

    0 Not allowed!

    Default Re: Inscrutable eeprom problem

    No one have any ideas?

    Cheers
    Peter
    Peter Truman

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #6
    Prolific Poster normnet's Avatar
    Join Date
    Jul 2004
    Posts
    2,361
    Thumbs Up
    Received: 78
    Given: 44
    Total Downloaded
    1.39 GB

    0 Not allowed!

    Default Re: Inscrutable eeprom problem

    Any Edata directives must be placed at the head of the BASIC program as is done with Symbols,
    so that the name is recognised by the rest of the program as it is parsed.
    I belive this means placing "Dim DW_Slot_1 As Dword" and others at the top along with the Symbols.

    Norm

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #7
    Member Peter Truman's Avatar
    Join Date
    Dec 2003
    Posts
    312
    Thumbs Up
    Received: 8
    Given: 7
    Total Downloaded
    406.61 MB

    0 Not allowed!

    Default Re: Inscrutable eeprom problem

    Hmmn. The variables seem to be being recognised ok - but if I place the String Variable definitions at the top of the list - they just don't get loaded at the EREAD (only the first two)

    Move them down below the Byte definitions and they do!

    I thought it might be a problem with the bank switching - but since this is an 18F25k22 that should not be an issue - should it?

    It's causing subtle problems (or at least something is)

    Works fine on the bench - but I'll be putting one of these in the field later today - so we'll see what happens.
    Peter Truman

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. EEprom in 18F46K22 problem
      By charliecoultas in forum Proton Plus Compiler v3
      Replies: 11
      Last Post: 6th June 2016, 11:05
    2. EEPROM Write problem
      By tbilliax in forum Proton Plus Compiler v3
      Replies: 6
      Last Post: 31st December 2011, 07:39
    3. stupid eeprom problem
      By bcans in forum Proton Plus Compiler v3
      Replies: 13
      Last Post: 15th September 2011, 12:51
    4. External EEPROM READ/WRITE Problem
      By CharlieBrown in forum Proton Plus Compiler v3
      Replies: 3
      Last Post: 23rd July 2010, 10:34
    5. EEPROM problem
      By CharlieBrown in forum Proton Plus Compiler v3
      Replies: 1
      Last Post: 5th November 2007, 05:22

    Members who have read this thread since 16th November 2019, 11:34 : 0

    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