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

Embedded ethernet kit port b

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



Joined: 18 Oct 2009
Posts: 14

View user's profile Send private message

Embedded ethernet kit port b
PostPosted: Wed Nov 11, 2009 8:45 am     Reply with quote

Ok so if using the tcp/ip stack, all i/o is set to fast io. I set trisb=0x00,
all output, and port_b_pullups to true.
Code:

   for(i=0;i<200;i++)
   {
         output_low(PIN_B4);
         output_high(PIN_B0);
         delay_us(500);
         
         output_high(PIN_B4);
         output_low(PIN_B0);
         delay_us(500);
   }

In the above loop pin_b4, which is connected to the boards led, flashes.
I check with a scope. All is nice but on pin_b0 I simply get a high/low,
not a square wave.

This worked great on my 18f4550.

Any ideas?
chrispol



Joined: 18 Oct 2009
Posts: 14

View user's profile Send private message

PostPosted: Wed Nov 11, 2009 12:44 pm     Reply with quote

If I move set_trisb & enable pullups to after
Code:

   lcd_init();
   StackInit();
   TCPInit();

the port behaves as it should. If I place it before, the port does not work.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Nov 11, 2009 1:39 pm     Reply with quote

Look at the code in those routines, and see it changes the TRIS on Port B.


Also, enabling Port B pull-ups doesn't do anything if the TRIS is set to
outputs. Look in the PIC data sheet. It says:
Quote:

10.2 PORTB, TRISB and LATB Registers PORTB.

The weak pull-up is automatically turned off
when the port pin is configured as an output.
chrispol



Joined: 18 Oct 2009
Posts: 14

View user's profile Send private message

PostPosted: Wed Nov 11, 2009 2:57 pm     Reply with quote

Using port b for mixed input always worked fine, will take a look at the init sequences, if the stack is not using port_b why would it reset it?

Didn't think to look there....
chrispol



Joined: 18 Oct 2009
Posts: 14

View user's profile Send private message

PostPosted: Wed Nov 11, 2009 9:18 pm     Reply with quote

PIN_ENC_MAC_WOL & PIN_ENC_MAC_INT are listed for use in hardware.h and trisb is set via mac_enc_spi_tris_init but I cannot find any reference to these pins being used.
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