CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

MPLAB SIM - PORTB can not be stimulated due to being control

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
adesport



Joined: 03 Apr 2008
Posts: 18
Location: France

View user's profile Send private message

MPLAB SIM - PORTB can not be stimulated due to being control
PostPosted: Tue Jul 28, 2009 9:58 am     Reply with quote

Hi all,

I'm facing a strange issue. I try to simulate my program compiled with PICC for a 18F25K20 with MPLAB SIM with asynchronous signal on RB0.
In my program I've configured all the register to enable digital input on RB0 and put a breakpoint just before a forever loop.
Unfortunately when I'm running the program (it's in the forever loop) I'm not able to simulate I/O on RB0, I have this error:

IOPORT-W0001: Pin(s) (0x01) on PORTB can not be stimulated due to being controlled by the A/D converter

So I double checked my program since it may come from a bad PORTB digital configuration, but I can't see what's wrong, here my configuration in a watch window before the forever loop :

Code:
ANSELH= 0000 0000  //Digital input buffer of RB0 is enabled
ADCON0= 0000 0000  //ADC is disabled and consumes no operating current
TRISB=  1111 1111  //All input
WPUB=   0000 0001  //Pull up ON
INTCON2bit7 = 0

FUSES :
PortB A/D enable bit is disabled


Everything is fine while my program runs directly on the board.

I can't figure it out!

Thanks,
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jul 28, 2009 10:34 am     Reply with quote

You already asked it on the MPLAB simulator forum. That's the best
place to ask about it.
http://www.microchip.com/forums/tt.aspx?forumid=18
adesport



Joined: 03 Apr 2008
Posts: 18
Location: France

View user's profile Send private message

PostPosted: Tue Jul 28, 2009 10:39 am     Reply with quote

you're right but MPLAB SIM forum seems to be a little bit sleepy Smile and I guess some PICC users may have seen the same behavior...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jul 28, 2009 10:52 am     Reply with quote

Post a very short test program that shows the problem. Don't include
any lines of code in it that are irrelevant to the problem (i.e., most
Wizard generated code). Test the short program to verify that it shows
the problem. The program must be compilable with errors.
Also post your MPLAB version and your compiler version.
adesport



Joined: 03 Apr 2008
Posts: 18
Location: France

View user's profile Send private message

PostPosted: Wed Jul 29, 2009 1:38 am     Reply with quote

Here a test code without any CCS PICC macro and MPLAB screeshots.

MBLAB v8.30.00.00
CCS C Compiler 4.0.68


Code:
#include <18f25K20.h>

#BYTE ADCON0 = 0xFC2
#BYTE ANSEL = 0xF7E
#BYTE ANSELH = 0xF7F
#BYTE OSCCON = 0xFD3
#BYTE PORTB = 0xF81
#BIT RB0 = PORTB.0
#BYTE WPUB = 0xF7C
#BYTE TRISB = 0xF93
#BYTE INTCON2 = 0xFF1
#BIT _RBPU = INTCON2.7
#BYTE TRISA = 0xF92


//NOPBADEN: PORTB A/D Enable BIT = Disabled
#fuses INTRC_IO,NOPROTECT,NOLVP,NOBROWNOUT,NOSTVREN,NOWDT,NOPBADEN
#use delay(clock=16000000)

void main(){
   
   OSCCON = 0x74;  //OSC_16MHZ|OSC_INTRC   
   ADCON0 = 0x00;  //ADC is disable
   ANSEL = 0;      //Digital input buffer RA & RE enabled
   ANSELH = 0;       //Digital input buffer of RB0-4 is enabled
   TRISA = 0x00;   //All output
   TRISB = 0xFF;   //All input
   _RBPU = 0;       //Enable PORTB pull-ups
   WPUB = 0x01;    //Enable only RB0 pull-up
   while(1);

}


When I set RB0 high through a asynch stimulus i still get the plethy message :

Quote:
(17877123) SIM-N0001 Note: Asynchronous Stimulus Set High RB0 fired.
IOPORT-W0001: Pin(s) (0x01) on PORTB can not be stimulated due to being controlled by the A/D converter




An other test is to write directly on PORTB in the program :

Code:
#include <18f25K20.h>

#BYTE ADCON0 = 0xFC2
#BYTE ANSEL = 0xF7E
#BYTE ANSELH = 0xF7F
#BYTE OSCCON = 0xFD3
#BYTE PORTB = 0xF81
#BIT RB0 = PORTB.0
#BYTE WPUB = 0xF7C
#BYTE TRISB = 0xF93
#BYTE INTCON2 = 0xFF1
#BIT _RBPU = INTCON2.7
#BYTE TRISA = 0xF92


//NOPBADEN: PORTB A/D Enable BIT = Disabled
#fuses INTRC_IO,NOPROTECT,NOLVP,NOBROWNOUT,NOSTVREN,NOWDT,NOPBADEN
#use delay(clock=16000000)

void main(){
   
   OSCCON = 0x74;  //OSC_16MHZ|OSC_INTRC   
   ADCON0 = 0x00;  //ADC is disable
   ANSEL = 0;      //Digital input buffer RA & RE enabled
   ANSELH = 0;       //Digital input buffer of RB0-4 is enabled
   TRISA = 0x00;   //All output
   TRISB = 0x00;   //All output
   _RBPU = 0;       //Enable PORTB pull-ups
   WPUB = 0x01;    //Enable only RB0 pull-up
   PORTB = 0x00;
   PORTB = 0xFF;
   
   while(1);

}


When PORTB = 0xFF is execute by the simulator, a watch window tell me that PORTB = 0xE0. Only PORTB pins without analogue feature are set!

adesport



Joined: 03 Apr 2008
Posts: 18
Location: France

View user's profile Send private message

PostPosted: Wed Jul 29, 2009 2:35 am     Reply with quote

MPLAB v8.33 solves the problem!
I didn't test before since the release note doesn't talk bout this bug, the only solved problem which could be related is:
Quote:
SIM-551
Some bits in PORTA, PORTB, and PORTE are always 0. Even though multiplexed peripherals are disabled for 18F44K20 and 18F45K20.


And still, I found this in "Known Problems" section (v8.33):
Quote:
SIM-572:
Invalid message "Pin(s) (0x4000) on PORTB can not be stimulated due to being controlled by the A/D converter" generated when INT1 is mapped to certain RP (RB) pins


Which is not the case in my test program.

So now with this upgrade everything works fine, I should have test before posting!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group