| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| Mike M Guest
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				| Trouble with simple I/O on pic16f88 |  
				|  Posted: Fri Mar 14, 2008 3:23 am |   |  
				| 
 |  
				| 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
 
 
			          
 
 | 
			
				|  |  
				|  Posted: Fri Mar 14, 2008 3:34 am |   |  
				| 
 |  
				| 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 
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				|  |  
				|  Posted: Fri Mar 14, 2008 4:34 am |   |  
				| 
 |  
				| 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! |  
				|  Posted: Fri Mar 14, 2008 5:23 am |   |  
				| 
 |  
				| 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!
 |  | 
	
		|  | 
	
		|  |