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 support@ccsinfo.com

Timer1 on PIC18F24J11 does not work in MPLAB SIM

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



Joined: 10 May 2011
Posts: 15

View user's profile Send private message

Timer1 on PIC18F24J11 does not work in MPLAB SIM
PostPosted: Sun May 15, 2011 8:41 am     Reply with quote

Hello!

I have been trying to start the timer1 on PIC18F24J11 and searching for solution on the internet for a couple of hours now but with no success. I have written a simple program:

Code:
#include "18F24J11.h"
#FUSES INTRC_IO
#FUSES NOXINST

int i;
int16 tmp;

void main()
{
   setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
   while (1)
   {
      tmp=get_timer1();
      i++;
      i--;
   }

}


If I simulate this with MPLAB SIM the timer does not increment. Not even the low byte (I read in the data sheet that the higher byte can only be read by first reading the lower one but in my case, the lower one is not even incrementing). In the watch window I can see the T1CON register is set properly to 0b00000111. The T1GCON is 0.

The weird thing is, that if I program a real PIC with the same program, it works. Timer1 increments nicely, every instruction cycle. But I would really need it to do that in the MPLAB simulator.

In the Simulator Settings window in MPLAB, under Limitations tab it is written, that Not all peripherals have support for simulation with PIC18F24J11, but the detailed explanation does not mention any problems with simulating timer1.

Hoping to solve the problem I even downloaded the latest version of MPLAB (8.7) but that did not work as well.

Does anyone have any ideas what could be wrong?
Thank you in advance for all your help.

Cheers!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun May 15, 2011 1:02 pm     Reply with quote

Quote:
The weird thing is, that if I program a real PIC with the same program, it works.

That means its not the compiler.

I was going to suggest that you post it in the Microchip forum, since it's
obviously a problem with MPSIM. But I checked and you already did
that. Microchip are ones to fix it, not CCS. I don't know why you posted
it here.
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