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

Reading and writing to TIMER1 in asynchronous mode

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



Joined: 13 Jan 2007
Posts: 91

View user's profile Send private message Visit poster's website

Reading and writing to TIMER1 in asynchronous mode
PostPosted: Thu Jul 08, 2010 8:23 pm     Reply with quote

I expect to see a continuous stream of values to flow.

Each value should be the number of ticks in timer1 over a 10uS period:

Code:

void main()
{
   delay_ms(5000);

   while(true)
   {
      setup_timer_1( T1_DISABLED );
      set_timer1(0);
      printf("TMR1 = %lu\n\r", get_timer1());
      setup_timer_1( T1_EXTERNAL );
      delay_us(10);   
      setup_timer_1( T1_DISABLED );
      printf("TMR1 = %lu\n\r", get_timer1());

      delay_ms( 1000 );
     
      }
}


However - all I get is one value and then, nothing!

Obviously no interrupts are enabled.
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Fri Jul 09, 2010 2:05 am     Reply with quote

Quite possibly your rs232 interface is hanging but as you don't show your fuses we can not be sure.
vsmguy



Joined: 13 Jan 2007
Posts: 91

View user's profile Send private message Visit poster's website

what gave away from just then was a cheap USB <-> RS23
PostPosted: Fri Jul 09, 2010 10:30 am     Reply with quote

Wayne_ wrote:
Quite possibly your rs232 interface is hanging but as you don't show your fuses we can not be sure.


My RS232 port is working fine - what gave away from just then was a cheap Chinese USB <-> RS232 convertor, and this lead me to believe I had messed up.

Reading 33023a.pdf set my ideas straight but now I have some questions:

1. Why would anyone want to enable T1SYNC?

An example scenario would be great

2. I am also intrigued by an old practice of "self-clocking" TMR0 by toggling T0SE to extract the timer0 prescaler value - but I do not get how toggling that bit increments the counter - any insights in this?
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