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

RA4/TOCKI readout hangs

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



Joined: 04 Jun 2007
Posts: 27

View user's profile Send private message

RA4/TOCKI readout hangs
PostPosted: Mon Jun 18, 2007 4:08 am     Reply with quote

I have a problem with RA4/TOCKI Sad
I have a switch on RA4 which switches RA4 to high or low. I try`d my programm with the switch on RA3/AN3 und it works without a problem, but as soon as i connect the switch to ra4 und press it my programm stops and i have no reaction on my RS232 imputs anymore.
Do i have to set RA4 in analog mode or something like this?
Ive allready done: "setup_adc_ports(AN0)"
and my programm works with RA3/AN3 - i suggest the problem must be something with the TOCKI function of RA4 - how can I set RA4/TOCKI to work as a normal digital input? (I already try`d the search function...)
inservi



Joined: 13 May 2007
Posts: 128

View user's profile Send private message

PostPosted: Mon Jun 18, 2007 4:23 am     Reply with quote

Hello,

What device do you use ?
With some pic as 18f252, the RA4 is different than other RA.

Here is the description from Microchip data sheet
Quote:
The RA4 pin is multiplexed with the Timer0 module
clock input to become the RA4/T0CKI pin. The RA4/
T0CKI pin is a Schmitt Trigger input and an open drain
output. All other RA port pins have TTL input levels and
full CMOS output drivers.


Your problem is probably the way you pull up the pin.
As the A4 pin is a Schmitt Trigger input, it need 4V for logic 1.

How did you connected you switch ?

Best regards,
dro.
_________________
in médio virtus
cyberant



Joined: 04 Jun 2007
Posts: 27

View user's profile Send private message

PostPosted: Mon Jun 18, 2007 6:05 am     Reply with quote

My switch works correctly - switches between 0-4V (works without problems in AN3).
I use the PIC 16F877
Looks like I found the problem:
enable_interrupts(GLOBAL);
if i enable global interrupts the problem happens. Without this it works fine. But I didn`t write any interrupt routine - so its strange that it doesn`t jump out of the interrupt - or??
inservi



Joined: 13 May 2007
Posts: 128

View user's profile Send private message

PostPosted: Mon Jun 18, 2007 8:43 am     Reply with quote

Hello,

Could-you send the complete configuration ?


dro
_________________
in médio virtus
cyberant



Joined: 04 Jun 2007
Posts: 27

View user's profile Send private message

PostPosted: Mon Jun 18, 2007 11:49 am     Reply with quote

What complete Configuration do u need? I have try`d the switch - works fine on AN3(its no Hardware Problem) but not on AN4 with enable_interrupts(GLOBAL);
I think because it jumps into the interrupt and dont go back into the normal Programm - but Ive not wrote a Interrupt Service Routine or something...
Ttelmah
Guest







PostPosted: Mon Jun 18, 2007 12:54 pm     Reply with quote

Er.
If you enable interrupts, you _must_ have an interrupt handler (there is no point in enabling interrupts, unless you do have a handler, and without a handler present, with the interrupts enabled, the _hardware_, will jump to the handler, _which is not there..._).

Best Wishes
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