View previous topic :: View next topic |
Author |
Message |
bdrmachine
Joined: 24 Jan 2010 Posts: 14
|
18F2550 porta problem |
Posted: Sun Jan 23, 2011 9:14 am |
|
|
I am having a problem understanding why my 18F2550 processor will not change port A pin states properly. PIN_A4 will not change using output_low(PIN_A4) or output_bit(PIN_A4, 0). The same is true if I try to set them high. Looking at the watch window in mplab (PORTA) I see the PIN_A1 bit change instead. Here are my setup statements :
Code: |
setup_port_a( AN0_ANALOG );
setup_adc( ADC_CLOCK_INTERNAL );
setup_spi(SPI_SS_DISABLED);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
set_tris_e(0x0f);
set_tris_a(0x0f);
|
What have I missed?
Thanks Much
Brian |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jan 23, 2011 3:36 pm |
|
|
Make a simple program that only toggles Pin A4, and it should work.
Example:
Code: |
#include <18F2550.h>
#fuses HS, NOWDT,BROWNOUT, PUT, NOLVP, CPUDIV1
#use delay(clock=20000000)
//======================================
void main(void)
{
while(1)
{
output_high(PIN_A4);
delay_ms(500);
output_low(PIN_A4);
delay_ms(500);
}
} |
|
|
|
|