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

1 us

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



Joined: 08 Oct 2005
Posts: 13

View user's profile Send private message Send e-mail

1 us
PostPosted: Wed Jun 13, 2007 2:54 pm     Reply with quote

Hello i am working with a GPS module that have 1 pps and the duration of it pulse is 1 MICRO SEG (1us).
The question is ....
Can i capture this little pulse with the RB0 of my 18f252, with an external interrupt as #INT_EXT???
How long must be the pulse, for capture on #INT_EXT of my pic???
THANKS
Excuse me but i speak spanish....
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 13, 2007 3:21 pm     Reply with quote

This information is in the PIC data sheet. Look near the end, in the
section on "Electrical Characteristics". In Table 22-6, it shows the Tinp
parameter: "INT pin high or low time". The minimum value is Tcy.

Tcy is 1/4 of the oscillator frequency. So for a 1 us pulse, you need
a minimum PIC oscillator frequency of 4 MHz. It's probably safer if
you ran the PIC at a higher frequency, because maybe your input
pulse is not always at 1 us. What if it's 0.9 us, sometimes ?

It's safer if you run the PIC at 8 MHz or more.
ccmcca



Joined: 08 Oct 2005
Posts: 13

View user's profile Send private message Send e-mail

PostPosted: Wed Jun 13, 2007 4:52 pm     Reply with quote

I have a 10 Mhz osc with 4xx - 40Mhz
But i cant detect this pulse.
I dont know whath's going on...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 13, 2007 4:57 pm     Reply with quote

What are the voltage levels of the pulse ? (high and low levels).
ccmcca



Joined: 08 Oct 2005
Posts: 13

View user's profile Send private message Send e-mail

PostPosted: Wed Jun 13, 2007 5:02 pm     Reply with quote

0v LOW
2.85V HIGH
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 13, 2007 5:21 pm     Reply with quote

What's the Vdd of your PIC ?

If it's +5v, the minimum Vih voltage for the INT_EXT pin is 4.0 volts.
ccmcca



Joined: 08 Oct 2005
Posts: 13

View user's profile Send private message Send e-mail

PostPosted: Wed Jun 13, 2007 5:40 pm     Reply with quote

Yes it is 5v.
What i have to do ....put some pullup or a transistor....?
THANK!!!!!!!!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 13, 2007 6:02 pm     Reply with quote

To convert a TTL level to a 5v CMOS level, you could use a 74HCT125
(with a Vcc voltage of +5v for the 74HCT125).

See this thread and the links in it.
http://www.ccsinfo.com/forum/viewtopic.php?t=30433&highlight=level+conversion
ccmcca



Joined: 08 Oct 2005
Posts: 13

View user's profile Send private message Send e-mail

PostPosted: Wed Jun 13, 2007 6:48 pm     Reply with quote

MUCHAS GRACIAS AMIGO

THANK A LOT!!!!!!!!!!!!!!!!!!!!!!!!1
RossJ



Joined: 25 Aug 2004
Posts: 66

View user's profile Send private message

PostPosted: Thu Jun 14, 2007 8:19 am     Reply with quote

Another solution you might consider is to simply use the port B interrupt on change capability of RB4-RB7. They have the same timing capability as INTx but are TTL input buffered instead of Schmitt Trigger. As a result, the minimum logic high level is only 2.0v instead of the 4.0v of a ST input (assuming Vcc is 5.0v).

The 2.85v you mention should be more than enough to directly drive RBx. The only thing to consider is whether the 2.85v output can ever be lower than 2.0v whilst driving high. Hopefully the GPS module datasheet can tell you this.
ccmcca



Joined: 08 Oct 2005
Posts: 13

View user's profile Send private message Send e-mail

Good
PostPosted: Thu Jun 14, 2007 9:46 am     Reply with quote

Ok I wil tried with the RB4....
Because less components is much better.
Thanks
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

Re: Good
PostPosted: Thu Jun 14, 2007 10:26 am     Reply with quote

ccmcca wrote:
Ok I wil tried with the RB4....
Because less components is much better.
Thanks
The problem with B4 to B7 is that a change on any of these pins configured as an input will trigger the interrupt-on-change event. This shouldn't be a problem as long as you take notice of this.

My datasheet for the PIC18F252 notes int-ext as a smitt-trigger input when configured for interrupt usage..... Am I missing something? Question
RossJ



Joined: 25 Aug 2004
Posts: 66

View user's profile Send private message

PostPosted: Thu Jun 14, 2007 7:49 pm     Reply with quote

You're not missing anything... that's exactly the point. Because ext0/1/2 pins are Schmitt triggered they are incompatible. Only pins with TTL inputs are suitable.

I have this problem when connecting 3.3v radio comms modules to the PIC because the USART RXD pin is always Schmitt Trigger buffered. So I need a level converter. When I use a 'software UART', I can use TTL pins and no level converter is required.

/Ross.
RossJ



Joined: 25 Aug 2004
Posts: 66

View user's profile Send private message

PostPosted: Thu Jun 14, 2007 8:05 pm     Reply with quote

Also, your point about the RB4-7 all triggering interrupt on change events is a good one. The best solution is to configure the remaining 3 pins as outputs (whether you use them or not). This ensures they have no impact on the GPS module pulse detection.

One more thing... since RB4-7 is 'on change' and not rising/falling edge triggered, you may get an interrupt for both edges. This is unlikely to be the case with a pulse of only 1us, even at 40MHz system clock. But it could be an issue if the pulse can be longer (or you poll the flag and clear it immediately). A simple solution to ensure this is never a problem is to wait for the pulse to finish before clearing the interrupt flag. This can be done regardless of whether you use polling or interrupts.

/Ross.
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