View previous topic :: View next topic |
Author |
Message |
chrispol
Joined: 18 Oct 2009 Posts: 14
|
Embedded ethernet kit port b |
Posted: Wed Nov 11, 2009 8:45 am |
|
|
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
|
|
Posted: Wed Nov 11, 2009 12:44 pm |
|
|
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
|
|
Posted: Wed Nov 11, 2009 1:39 pm |
|
|
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
|
|
Posted: Wed Nov 11, 2009 2:57 pm |
|
|
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
|
|
Posted: Wed Nov 11, 2009 9:18 pm |
|
|
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. |
|
|
|