Author Topic: MPLAB IDE simulator stimulus and FVR not "reading" correct voltage  (Read 862 times)

0 Members and 1 Guest are viewing this topic.

Offline PerranOakTopic starter

  • Frequent Contributor
  • **
  • Posts: 548
  • Country: gb
I noticed that when using the stimulus window to set AN0 to 234(mV) the figure read was in fact 47 not 234 as expected.
This is odd because I had set it up to use the FVR at 1.024V so the reading should have been 234. The figure of 47 looks like it's using 5V as the reference.
 
So, to cut a long story short, I found that the simulator was not setting bit 6 of FVRCON with the movwf command and even when I "went-to-town" and used bsf to set the bit as well, it just left this bit at zero though it set the others as instructed.
Can the simulator only use a 5V reference or should another register be setup differently somewhere?
 
Thank you.
(I'm using the 16F1827 and MPASM)
You can release yourself but the only way to go is down!
RJD
 

Offline cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: MPLAB IDE simulator stimulus and FVR not "reading" correct voltage
« Reply #1 on: July 16, 2018, 03:04:44 pm »
Quote
I found that the simulator was not setting bit 6 of FVRCON
The datasheet shows bit6 is FVRRDY, which is read only. The datasheet describes how it acts.
 

Offline PerranOakTopic starter

  • Frequent Contributor
  • **
  • Posts: 548
  • Country: gb
Re: MPLAB IDE simulator stimulus and FVR not "reading" correct voltage
« Reply #2 on: July 16, 2018, 05:46:03 pm »
Yes but the datasheet says:

FVRRDY is always '1' on devices with LDO (PIC16F1826/27)

whereas the simulator reports it as zero and, in fact, is behaving as if it is zero, i.e. not enabled.
You can release yourself but the only way to go is down!
RJD
 

Offline cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: MPLAB IDE simulator stimulus and FVR not "reading" correct voltage
« Reply #3 on: July 16, 2018, 06:46:30 pm »
Just pointing out that the bit is read-only, so don't expect it to change by writing to it.

Whether the simulator can simulate that peripheral on that particular micro, I don't know.  Would not be a big surprise if it cannot.

When possible, use the debugger to see what's going on- with the advantage you get to see the real hardware in action.


 

Offline PerranOakTopic starter

  • Frequent Contributor
  • **
  • Posts: 548
  • Country: gb
Re: MPLAB IDE simulator stimulus and FVR not "reading" correct voltage
« Reply #4 on: July 17, 2018, 11:42:21 am »
OK thank you.
You can release yourself but the only way to go is down!
RJD
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf