[SOLVED !] Problem with 3.7.2.8 and 18F25K50


Closed Thread
Results 1 to 10 of 10

Thread: Problem with 3.7.2.8 and 18F25K5059 days old

  1. #1
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,232
    Thumbs Up
    Received: 75
    Given: 181
    Total Downloaded
    5.15 GB

    0 Not allowed!

    Default Problem with 3.7.2.8 and 18F25K50

    I have not raised an anomaly report because it seems very unfair to expect someone (Les) to hunt down bugs for free.




    If I compile code, which compiled unchanged under 3.7.2.6, under 3.7.2.8 it fails with the following -

    Symbol not previously defined (RCREG)
    Symbol not previously defined (TXREG)

    workaround

    Symbol RCREG = RCREG1
    Symbol TXREG = TXREG1

    This is purely for information. I can live with this, as I'm sure the rest of the user base can.
    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.

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

    0 Not allowed!

    Default Re: Problem with 3.7.2.8 and 18F25K50

    Probably bad form replying to my own post but it seems relevant

    Slightly weirder now, the following compiled under 3.7.2.6 and produced approx 33 (ie 10x VDD) under 3.7.2.8 it produces 3,

    Code:
    Proc GetVdd(), Word
      ADCON1 = 000000         ' pos = VDD NEG = VSS
      ADCON2 = 111110         ' right justified, acquisition time = 20TAD, Clock = FOSC/64
      ADCON0 = 000001         ' Select AN0, ADC on     see http://www.microchip.com/forums/m893671.aspx
      DelayMS 5                  ' AN0 tied to Gnd, discharge cap
    
      VREFCON0 = 010000       ' FVR Enable, 1.024v
      ADCON0 = 111101         ' Select FVR, ADC on
    
      While FVRST = 0 : Wend     ' Wait For 1.024v reference To stabilize
    
      DelayMS 5                  ' Wait for sample/hold capacitors to charge and VP6 to settle
      GO_DONE = 1                ' Start conversion
      While GO_DONE = 1 : Wend   ' Poll the GO_DONE flag for completion of conversion
      ADCON0 = 111100         ' Select FVR, ADC off
      VREFCON0 = 010000       ' FVR Disable, 1.024v
      Result = 10486/Ad_Result   ' convert input reading to VDD voltage *VDD must be a Word                         
                                 ' 1.024 * 1024 = 1048.6 - 10486 To get 1/10th's
    EndProc
    BTW Dim Ad_Result As ADRESL.Word ' Convert the ADRESL register into a WORD variable

    I know this worked before because I had is drive a silly blink x Vdd test prog.


    Perhaps a default has changed? Anyone
    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 Dompie's Avatar
    Join Date
    Apr 2012
    Posts
    123
    Thumbs Up
    Received: 14
    Given: 12
    Total Downloaded
    5.03 GB

    0 Not allowed!

    Default Re: Problem with 3.7.2.8 and 18F25K50

    ADCON0, 1 and 2 are 8 bit registers and in your listing I only see 6. Is there a website problem in the code window with% ????

    Johan

  • 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
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,427
    Thumbs Up
    Received: 296
    Given: 142
    Total Downloaded
    1.75 GB

    0 Not allowed!

    Default Re: Problem with 3.7.2.8 and 18F25K50

    Can you write the code again in the thread, but change the binary values to hex values please George. The forum has had a problem with the binary notation for many years.

    Can you write a small code snippet that will compiler and show the issue please. I can then examine the asm produced and do some testing and the already compilable code will save me a few hours.

    I will also require the VDD it is measuring. As much info a possible please.
    Last edited by top204; 13th October 2019 at 20:52.

  • 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
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,232
    Thumbs Up
    Received: 75
    Given: 181
    Total Downloaded
    5.15 GB

    0 Not allowed!

    Default Re: Problem with 3.7.2.8 and 18F25K50

    I thought switching from wysiwig sorted that

    Code:
    Proc GetVdd(), Word
      ADCON1 = %00000000         ' pos = VDD NEG = VSS
      ADCON2 = %10111110         ' right justified, acquisition time = 20TAD, Clock = FOSC/64
      ADCON0 = %00000001         ' Select AN0, ADC on     see http://www.microchip.com/forums/m893671.aspx
      DelayMS 5                  ' AN0 tied to Gnd, discharge cap
    
      VREFCON0 = %10010000       ' FVR Enable, 1.024v
      ADCON0 = %01111101         ' Select FVR, ADC on
    
      While FVRST = 0 : Wend     ' Wait For 1.024v reference To stabilize
    
      DelayMS 5                  ' Wait for sample/hold capacitors to charge and VP6 to settle
      GO_DONE = 1                ' Start conversion
      While GO_DONE = 1 : Wend   ' Poll the GO_DONE flag for completion of conversion
      ShadowADRESL = ADRESL
      ShadowADRESH = ADRESH
      ADCON0 = %01111100         ' Select FVR, ADC off
      VREFCON0 = %00010000       ' FVR Disable, 1.024v
      Result = 10486/Ad_Result   ' convert input reading to VDD voltage *VDD must be a Word                         
                                 ' 1.024 * 1024 = 1048.6 - 10486 To get 1/10th's
    EndProc
    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.

  • #6
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,232
    Thumbs Up
    Received: 75
    Given: 181
    Total Downloaded
    5.15 GB

    1 Not allowed!

    Default Re: Problem with 3.7.2.8 and 18F25K50

    that's better, as I said it runs under 3.7.2.6. If I find a window in my busy schedule I'll reinstall the earlier version and compare ASM. Believe it or not today (supposedly) I'm having 300Mbs fibre installed. Who would credit that somewhere as remote as this would ever get the interweb at that speed. Pretty good deal for the first year, E40.99 a month no quota, sucks after that but I'll move on to another provider.

    BTW Les I'm measuring Vdd, 3.3v. Previously it returned 33 now it returns 3, go figure. Obviously only using lower 8 bits but I see $FF in the high byte which is just wrong. Thanks for taking the time Les. Unless your curiosity gets the better of you, suggest you wait till I reinstall previous version (only to find no doubt that I made some subtle change and borked it).
    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.

  • #7
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,427
    Thumbs Up
    Received: 296
    Given: 142
    Total Downloaded
    1.75 GB

    0 Not allowed!

    Default Re: Problem with 3.7.2.8 and 18F25K50

    I've just ran some tests on the procedure and it returns 49 when the VDD is 5 Volts, because it is actually 49.933333333333333

    Which is a tenth of the voltage, not 4 or 5. I ran the code in versions 3.5.2.6 and 3.7.2.7 and 3.7.2.8 and they produce the same Asm code, apart for the Hex constants now used in it. And they produce the same value.

    The RCREG and TXREG issue is yet another issue with Microchip changing SFR names. The devices only have a single USART, so why have they now named them TXREG1 and RCREG1? Other devcies with only 1 USART do not have a number after the name, because why would they because there is not USART2!

    The change can be done in teh PPI files for the 18F24K50, 18F25K50 and 18F45K50 devices. Add the text:

    RCSTA EQU 0X0FAB
    TXSTA EQU 0X0FAC
    TXREG EQU 0X0FAD
    RCREG EQU 0X0FAE
    SPBRG EQU 0X0FAF
    SPBRGH EQU 0X0FB0

    After the SPBRGH1 EQU 0X0FB0 line.

    I'll alter the compiler to yet again examine if the SFR names are still valid for devices with a single USART, and change them internally if they are not there.

  • 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.

  • #8
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,232
    Thumbs Up
    Received: 75
    Given: 181
    Total Downloaded
    5.15 GB

    0 Not allowed!

    Default Re: Problem with 3.7.2.8 and 18F25K50

    Bloddy hell Les, where do you get the energy and commitment! All I managed was to uninstall .8, reinstall .6 and realize the problem still exists. It's part of a larger program, so I guess I'm going back to basics.

    The result you got is correct (or at least what I'd got earlier)


    BTB Firefox could be in for some jihad, if you mistype All with three L's you'll see what I mean. What's the world coming to, I just did spelling correction on the word jihad.
    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.

  • #9
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,232
    Thumbs Up
    Received: 75
    Given: 181
    Total Downloaded
    5.15 GB

    0 Not allowed!

    Default Re: Problem with 3.7.2.8 and 18F25K50

    Well something is horribly wrong but I don't know what it is. I've reinstalled everything, compiled and manually burned .HEX file and verified. I've ran old versions, stripped down the latest but whatever I do it returns 3 (actually any number between 0 and 15 - 15 would roundup to 20). Whenever I try to monitor it, it shows 3.


    Here's my stripped down version
    Code:
    '********************************************************************
    '*  Name    : 25K50_Blinky                                          *
    '*          :                                                       *
    '*          : 18F25K50 set to Internal clock and LVP                *
    '********************************************************************
      Device = 18F25K50
      Declare Xtal = 48
    
      Declare All_Digital = True            ' try to disable analogue peripherals
      Declare Optimiser_Level = 0           ' where n = 0 thro 3 with 0 being off
    
      TRISA  = %11101111    ' A7=        A6=       A5=       A4=LED    A3=        A2=       A1=         A0=
    
      Dim ForCount        As Byte               ' must be first variable (for Snapshot)
      Dim Dummy           As Byte               ' se
      Dim Timer1REG       As TMR1L.Word         ' Alias Timer1REG as a word = TMR1L & TMR1H
      Dim Ad_Result       As ADRESL.Word        ' Convert the ADRESL register into a WORD variable
      Dim VDD             As Word               ' VDD as tenths of a volt
      Dim ResultHi        As Byte               ' 
      Dim ResultLo        As Byte
      
      Symbol LED = PORTA.4 
      Symbol PLLEN = OSCCON2.4            ' software PLL Enable Bit
      Symbol SPLLMULT = OSCTUNE.7         ' software PLL multiplier select bit
      Symbol PLLRDY = OSCCON2.7           ' PLL Run Status Bit
      Symbol GO_DONE = ADCON0.1           ' A/D Conversion STATUS Bit
      Symbol ADON = ADCON0.0              ' ADC Enable Bit
      Symbol FVREN = VREFCON0.7           ' Fixed Voltage Reference Enable Bit
      Symbol FVRST = VREFCON0.6           ' Fixed Voltage Reference Ready Flag Bit
      Symbol ADFM = ADCON2.7              ' ADC Right justified
      DelayMS 100 
    
      ConfigPic()                                            ' configure the PIC device 18F25K50
    Main:
      LED = 0
    
      While 1 = 1                                 ' super blinky
        VDD = GetVdd()
        
        'VDD = 33
        
        Dummy = VDD // 10                         ' get remainder into dummy for 4.9V
        VDD = VDD / 10                            
        If Dummy > 4 Then
          Inc VDD                                 ' round VDD up
        End If
    
        For ForCount = 1 To VDD
          LED = 1
          DelayMS 200
          LED = 0
          DelayMS 200
        Next  
    
        DelayMS 2000    
      Wend
      
      Stop              ' jic
    
    '**************************  S U B R O U T I N E S  ****************************
    
    '*******************************************************************************
    ' PROCEEDURE: GetVdd
    ' PURPOSE   : measure VDD
    ' REQUIRES  : nothing
    ' RETURNS   : value in VDD in 1/10ths. of volts
    ' DESTROYS  : nothing
    '*******************************************************************************
    Proc GetVdd(), Word
      ADCON1 = %00000000         ' pos = VDD NEG = VSS
      ADCON2 = %10111110         ' right justified, acquisition time = 20TAD, Clock = FOSC/64
      ADCON0 = %00000001         ' Select AN0, ADC on     see http://www.microchip.com/forums/m893671.aspx
      DelayMS 5                  ' AN0 tied to Gnd, discharge cap
    
      VREFCON0 = %10010000       ' FVR Enable, 1.024v
      ADCON0 = %01111101         ' Select FVR, ADC on
    
      While FVRST = 0 : Wend     ' Wait For 1.024v reference To stabilize
    
      DelayMS 5                  ' Wait for sample/hold capacitors to charge and VP6 to settle
      GO_DONE = 1                ' Start conversion
      While GO_DONE = 1 : Wend   ' Poll the GO_DONE flag for completion of conversion
      ADCON0 = %01111100         ' Select FVR, ADC off
      VREFCON0 = %00010000       ' FVR Disable, 1.024v
      Result = 10486/Ad_Result   ' convert input reading to VDD voltage *VDD must be a Word                         
                                 ' 1.024 * 1024 = 1048.6 - 10486 To get 1/10th's
    EndProc
    
      
    '******************** P I C    D E V I C E    C O N F I G U R A T I O N  ****************************
    
    Proc ConfigPic()
      PLLEN = 0                           ' turn off PLL for safety while we setup clock
      SPLLMULT = 1                        ' SPLLMULT 3xPLL
      OSCCON = %01111000                  ' Oscillator Control Register
      OSCCON2 = %00010000                 ' Oscillator Control Register 2
      ACTCON = %10010000                  ' Active Clock Tuning Control Register
      While PLLRDY = 0
        DelayMS 1                         ' wait a bit for the clock to stabilize
      Wend
    
      Clear
      DelayMS 500
    EndProc
    
    
    ' internal clock 48MHz, LVP
    Config_Start
      PLLSEL = PLL3X	  ; 3x clock multiplier
      CFGPLLEN = OFF	  ; PLL Disabled (firmware controlled)
      CPUDIV = NOCLKDIV	; CPU uses system clock (no divide)
      LS48MHZ = SYS48X8	; System clock at 48 MHz, USB clock divider is set to 8
      FOSC = INTOSCIO	  ; Internal oscillator
      PCLKEN = On 	    ; Primary oscillator on
      FCMEN = Off	      ; Fail-Safe Clock Monitor disabled
      IESO = Off	      ; Oscillator Switchover mode disabled
      nPWRTEN = On	    ; Power up timer enabled
      BOREN = Off	      ; BOR controlled by firmware (SBOREN is enabled)
      BORV = 285	      ; BOR set to 2.85V nominal
      nLPBOR = OFF	    ; Low-Power Brown-out Reset disabled
      WDTEN = off 	    ; WDT controlled by firmware (SWDTEN enabled)
      WDTPS = 32768	    ; 1:32768
      CCP2MX = RC1	    ; CCP2 input/output is multiplexed with RC1
      PBADEN = OFF	    ; PORTB<5:0> pins are configured as digital I/O on Reset
      T3CMX = RC0	      ; T3CKI function is on RC0
      SDOMX = RB3	      ; SDO function is on RB3
      MCLRE = On	      ; RE3 input pin enabled; external MCLR disabled
      STVREN = On	      ; Stack full/underflow will cause Reset
      LVP = On	        ; Single-Supply ICSP disabled
      ICPRT = OFF	      ; ICPORT disabled
      XINST = OFF	      ; Instruction set extension and Indexed Addressing mode disabled
      Debug = OFF	      ; Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
      Cp0 = OFF	        ; Block 0 is not code-protected
      CP1 = OFF	        ; Block 1 is not code-protected
      CPB = OFF	        ; Boot block is not code-protected
      CPD = OFF	        ; Data EEPROM is not code-protected
      WRT0 = OFF	      ; Block 0 (0800-1FFFh) is not write-protected
      WRT1 = OFF	      ; Block 1 (2000-3FFFh) is not write-protected
      WRTC = OFF	      ; Configuration registers (300000-3000FFh) are not write-protected
      WRTB = OFF	      ; Boot block (0000-7FFh) is not write-protected
      WRTD = OFF	      ; Data EEPROM is not write-protected
      EBTR0 = OFF	      ; Block 0 is not protected from table reads executed in other blocks
      EBTR1 = OFF	      ; Block 1 is not protected from table reads executed in other blocks
      EBTRB = OFF	      ; Boot block is not protected from table reads executed in other blocks
    Config_End
    '
    ' end of 25K50_Blinky.bas
    Les, could I impose on you to post you test program? I'm begin to doubt sanity here.
    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.

  • #10
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,232
    Thumbs Up
    Received: 75
    Given: 181
    Total Downloaded
    5.15 GB

    0 Not allowed!

    Default Re: Problem with 3.7.2.8 and 18F25K50

    Can't edit - LED should light then blink Vdd times, wait a bit and loop. Not rounding for Vdd = 4.9




    “Ford's in his flivver; all's well with the world.”

    It all becomes clear. For no particular reason I change the jumper to select Vdd=5 and low and behold [drum roll] 5 blinks. Looks like I borked the 3.3 supply which is why everything was so odd.

    Well the 3.3v rail measures 3.28 so I'm only a little less confused than I was before. At least it's not code.

    Well I solved it. I had a ttl to USB CDC doohickey attached and somehow (can't possibly be me) the 5/3.3v jumper get set to 5v.
    Last edited by towlerg; 15th October 2019 at 15:06.
    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.

    Thread Information

    Users Browsing this Thread

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

       

    Similar Threads

    1. CWRITE and 18F25K50
      By See_Mos in forum Proton Plus Compiler v3
      Replies: 9
      Last Post: 5th September 2019, 15:56
    2. PoortC problem with 18F25K50
      By Hemsys in forum Absolute Beginners Section
      Replies: 6
      Last Post: 29th August 2017, 07:28
    3. Unable to get 18F25K50 and new USB stack working
      By See_Mos in forum USB Module
      Replies: 8
      Last Post: 2nd March 2017, 18:17

    Members who have read this thread : 39

    Actions :  (Set 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