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

Problem pin2 pic12f519

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



Joined: 14 Nov 2017
Posts: 7

View user's profile Send private message

Problem pin2 pic12f519
PostPosted: Tue Nov 14, 2017 10:13 am     Reply with quote

Hi,

I want to toggle some pins.
I did the following:
Code:

output_toggle(LIFELED);
output_toggle(SERVO);
output_toggle(LIGHTOUTPUT);

And my header:
Code:
#use delay(internal=8MHz)
#use FIXED_IO( B_outputs=PIN_B5,PIN_B4,PIN_B2 )
#define PULSE   PIN_B0
#define BUTTON   PIN_B1
#define SERVO   PIN_B2
#define LIFELED   PIN_B4
#define LIGHTOUTPUT   PIN_B5


I see pins 4 and 5 toggling, but pin 2 doesn't do anything. Does someone know why?
alan



Joined: 12 Nov 2012
Posts: 280
Location: South Africa

View user's profile Send private message

PostPosted: Tue Nov 14, 2017 11:19 am     Reply with quote

A quick look at the datasheet says that if bit T0CS are set (default value) then it overrides the TRIS registers anf the pin are an input. Try clearing the T0CS bit in the OPTIONS register.

Regards
Ttelmah



Joined: 11 Mar 2010
Posts: 13663

View user's profile Send private message

PostPosted: Tue Nov 14, 2017 11:43 am     Reply with quote

setup_timer_0(T0_INTERNAL);

Does this for you.
tysie



Joined: 14 Nov 2017
Posts: 7

View user's profile Send private message

solved
PostPosted: Tue Nov 14, 2017 12:15 pm     Reply with quote

I solved it with the options register.
Thanks
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