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

Turning outputs on and off

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



Joined: 17 Nov 2003
Posts: 7

View user's profile Send private message

Turning outputs on and off
PostPosted: Wed Jan 21, 2004 12:27 pm     Reply with quote

What I want to do is to make the PIC seem like it's turned off to the outside world i.e. output pins low and a high output impedance.

I'm talking to a phone using the UART (FBUS on the phone) and every now and then the phone 'hangs' and won't communicate any more. The only solution is to turn the PIC off and back on again and everything starts up again fine.

There's a conflict happening somewhere but what I would like would be to have a timer watching out for this occurence and when it senses that communications have stopped:

simulate turning the PIC off
simulate it coming back on again

run as normal.

It would be good as a backup strategy even if I get the conflict resolved.

Thanks

Ken
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jan 21, 2004 1:41 pm     Reply with quote

Quote:
What I want to do is to make the PIC seem like it's turned off to the outside world i.e. output pins low and a high output impedance

Those two states are mutually exclusive. If a PIC pin is in a
high impedance state, it cannot also be driving the pin low.

You're using the PIC to talk to a cell phone, and you said the phone
hangs, sometimes. If you reset the PIC, then it cures the problem.

I'm wondering if it's the PIC that is locking up, due to errors
in the USART receiver ? Try adding the ERRORS parameter
to your #use rs232 statement. Example:

#use rs232(baud = 9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
This only works with the hardware USART.


Quote:
There's a conflict happening somewhere but what I would like would be to have a timer watching out for this occurence and when it senses that communications have stopped:

The watchdog timer could be used for this. It's intended to reset
the PIC if the program locks up for some unknown reason. When
you use it, you have to be careful to put a restart_wdt() statement
in your main loop, and make sure that statement is normally
executed at a rate which is faster than the WDT timeout period.

However, I would concentrate on finding the real cause of the lockups
rather than trying to paper it over. You will learn more by doing do.
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