I know, this is basic but I am having trouble getting this to work. I want to do it in C and am using the PIC C compiler. I also am using a PIC18F452 micro controller.
In the I/O tab in setup i selected ports D0-D7 and C0-C7 as outputs.
everything else I left default. here is the code i made:
and here is the header:
Yet I can not get a led to blink on any of those ports. What am I doing wrong? thanks
In the I/O tab in setup i selected ports D0-D7 and C0-C7 as outputs.
everything else I left default. here is the code i made:
Code:
#include "H:\windowsdata\Desktop\Embedded\blink\blink.h"
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
set_tris_c(0);
set_tris_d(0);
while(1) {
OUTPUT_HIGH(PIN_D0);
delay_ms(100);
OUTPUT_HIGH(PIN_D1);
delay_ms(100);
OUTPUT_HIGH(PIN_D2);
delay_ms(100);
OUTPUT_HIGH(PIN_D3);
delay_ms(100);
OUTPUT_HIGH(PIN_D4);
delay_ms(100);
OUTPUT_HIGH(PIN_D5);
delay_ms(100);
OUTPUT_HIGH(PIN_D6);
delay_ms(100);
OUTPUT_HIGH(PIN_D7);
delay_ms(100);
OUTPUT_HIGH(PIN_C0);
delay_ms(100);
OUTPUT_HIGH(PIN_C1);
delay_ms(100);
}
}
and here is the header:
Code:
#include <18F452.h>
#device adc=8
#use delay(clock=20000000)
#fuses NOWDT,WDT128,RC_IO, NOPROTECT, NOOSCSEN, BROWNOUT, BORV20, NOPUT, STVREN, NODEBUG, NOLVP, NOWRT, NOWRTD, NOWRTB, NOWRTC, NOCPD, NOCPB, NOEBTR, NOEBTRB
Yet I can not get a led to blink on any of those ports. What am I doing wrong? thanks