• AVR Freaks

Hot!I need help with a simulator quirk

Author
CraigDee
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2019/10/24 01:58:02
  • Location: 0
  • Status: offline
2019/10/30 10:31:12 (permalink)
0

I need help with a simulator quirk

I am using the MPLAB X V5.05 simulator for the PIC16F18325. I have set up the ADC to read the FVR (2.048 V). The result I got is zero. The required modules are on and enabled. The ADC references are set to Vdd and Vss. If I change the ADC channel to a pin (ANA4 in this case), and set a voltage as stimulus, I get a correct result. I would like to know if there is a known issue in this regard. Will updating my version fix the issue? 
FVRCON: 11000010
ADCON0: 11111101
ADCON1: 11110000
PMD0: 00000111
PMD2: 01000110
 
I have checked and rechecked bank-selection. All okay. Thanks for any help.
#1

8 Replies Related Threads

    Aussie Susan
    Super Member
    • Total Posts : 3636
    • Reward points : 0
    • Joined: 2008/08/18 22:20:40
    • Location: Melbourne, Australia
    • Status: offline
    Re: I need help with a simulator quirk 2019/10/30 18:14:02 (permalink)
    +3 (3)
    I know that George (the simulator guru) sometimes looks here but you can also try asking in the "MPLAB Simulator' forum.
    If anyone can answer your question then George can!
    Susan
    #2
    GeorgePauley
    Moderator
    • Total Posts : 1184
    • Reward points : 0
    • Joined: 2009/12/01 13:59:30
    • Location: Chandler AZ
    • Status: offline
    Re: I need help with a simulator quirk 2019/10/31 08:36:53 (permalink)
    +2 (2)
    OK, FVR IS implemented in simulator but...  Looking at the ADC code, use of the FVR is explicitly commented out.  To make matters worse this must have happened at least 4 years ago, before a version control system switch, which means we have lost of version control history about WHY FVR was commented out.

    I will create a trouble report against this issue and we'll take a look into why and try to get FVR back into ADC.  Unfortunately all the simulator engineers are pretty busy right now, so it might be a week or two before anyone gets to this.  Hopefully we can have it fixed by MPLAB X 5.35.

    If I can think of a work-around I'll come back and post it.
    post edited by GeorgePauley - 2019/10/31 08:49:24
    #3
    Jim Nickerson
    User 452
    • Total Posts : 6365
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: I need help with a simulator quirk 2019/10/31 08:39:36 (permalink)
    +1 (1)
    GeorgePauley
    MPLAB X 3.35

    edit I see you fixed the typo :)
    post edited by Jim Nickerson - 2019/10/31 08:52:56
    #4
    GeorgePauley
    Moderator
    • Total Posts : 1184
    • Reward points : 0
    • Joined: 2009/12/01 13:59:30
    • Location: Chandler AZ
    • Status: offline
    Re: I need help with a simulator quirk 2019/10/31 08:51:05 (permalink)
    +4 (4)
    Don't pick on elderly, somewhat forgetful, programmers lest they put "if (user=="Jim.Nickerson")" lines into their code.  mr green: mr green
    #5
    Jim Nickerson
    User 452
    • Total Posts : 6365
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: I need help with a simulator quirk 2019/10/31 08:55:48 (permalink)
    +1 (1)
    thank you george, Smile: Smile
    #6
    GeorgePauley
    Moderator
    • Total Posts : 1184
    • Reward points : 0
    • Joined: 2009/12/01 13:59:30
    • Location: Chandler AZ
    • Status: offline
    Re: I need help with a simulator quirk 2019/11/20 13:22:51 (permalink)
    0
    Well I now know what FVR was commented out.  The simulators code for this ADC covers several score datasheets.  Pretty much each datasheet has it's own way of interpreting ADCON1.CHS.  Heck, the actual size of the field changes from device to device.  Short of hard-coding how to decode every datasheet's CHS field (and every future datasheet's CHS field), the simulator doesn't have a good way of knowing how to decode CHS. 
     
    In fact we're already engaged in some risky behavior by assuming that CHS value equates to the ANx pin to read.  (With a check to verify that that ANx pin actually exists on the device.)  This seems to be true for all devices so far.
     
    Anyway, simulator doesn't support FVR input for ADC on these devices.  Sorry.
    #7
    GeorgePauley
    Moderator
    • Total Posts : 1184
    • Reward points : 0
    • Joined: 2009/12/01 13:59:30
    • Location: Chandler AZ
    • Status: offline
    Re: I need help with a simulator quirk 2019/11/20 13:37:48 (permalink)
    0
    I did add a warning message for when CHS is set to an unsupported value (not an ANx pin.)
    #8
    ric
    Super Member
    • Total Posts : 24593
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: I need help with a simulator quirk 2019/11/20 14:16:22 (permalink)
    0
    GeorgePauley
    ...
    Short of hard-coding how to decode every datasheet's CHS field (and every future datasheet's CHS field),

    I think this is what the users assume you ARE doing.
    They kind of trust the Microchip tools to actually simulate the Microchip device they have selected...
     
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #9
    Jump to:
    © 2019 APG vNext Commercial Version 4.5