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

Trouble with simple I/O on pic16f88

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







Trouble with simple I/O on pic16f88
PostPosted: Fri Mar 14, 2008 3:23 am     Reply with quote

Hi,

I´m newbie in programming pics, and I´m having some trouble with a pic16f88. As a first test, I wanted to see if I could make output pins in diferent ports toggle high and low.

What I have noticed is that everything works fine in portB but it does nothing on portA. I´m using an external cristal oscilator on ports A7 and A6, can this be the problem?

The version of the complier is 4.016.

Thanks for your help
Foppie



Joined: 16 Sep 2005
Posts: 138
Location: The Netherlands

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Fri Mar 14, 2008 3:34 am     Reply with quote

first: can you post your simple test program? The guys here can give you more useful hints and tips when they see your code.

second: the compiler v4.016 is known to be buggy, in fact all compiler before v4.020. Maybe you can update your compiler?
Guest








PostPosted: Fri Mar 14, 2008 4:34 am     Reply with quote

OK, here´s my code:

Code:

#include <16f88.h>
#fuses xt,NOWDT,noput,noprotect,nomclr,NOBROWNOUT,nolvp

#include <ctype.h>
#use DELAY(clock=4000000)
#use fast_IO(A)





main()
{
//port_a_pullups(true);
SETUP_ADC_PORTS(NO_ANALOGS);
SETUP_ADC(ADC_OFF);

set_tris_b(0x00);
output_high(PIN_A0);
output_high(PIN_A1);
output_high(PIN_A2);
 //set port b as outputs
while(1)
{

         output_low(PIN_A0);
         output_low(PIN_B7);
         delay_ms(1000);
         output_high(PIN_B7);
         output_high(PIN_A0);
         output_low(PIN_A1);
         delay_ms(1000);
         output_high(PIN_A1);
         output_low(PIN_A2);
         delay_ms(1000);
         output_high(PIN_A2);
}
}



So, for portB the pin toggles right but for portA it does nothing.

Thanks
Mike M
Guest







I solved it!
PostPosted: Fri Mar 14, 2008 5:23 am     Reply with quote

Finally I solved the problem.

It´s a RMW problem, I fixed it shadowing the port as it says in one of the old posts


Thanks to all!
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