#include <p18cxxx.h>
#include <delays.h>
#include <stdlib.h>
#include <stdio.h>
#pragma config WDT = OFF, LVP = OFF, OSC = HS, DEBUG = OFF
void main(void)
{
ADCON1 = 0x0f; // make all AN (analog) pins digital (for bit ref)
TRISA = 0x00;
TRISD = 0;
TRISB = 0;
TRISC = 0;
PORTA = 0;
PORTB = 0x55;
PORTC = 0;
PORTD = 0x55;
while(1)
{
Delay10KTCYx(100);
PORTAbits.RA0 ^= 1;
PORTB ^= 0xFF;
PORTD ^= 0xFF;
Delay10KTCYx(100);
}
}
You have to start by putting in some instructions that turn on an output. Put a LED and resistor on the output.
Then add a delay and make the LED blink.
Then come back to us.
Check the oscillator & the MCLR whether its on or off.
Hi. I have written a small test program which burns successfully on the controller (have verified after read) but the code doesn't execute.
Has anyone faced this problem before?
I have LEDs attached to PORTB but nothing is on the output (The LEDs work with 5volts direct hence not burnt)
Code:#include <p18cxxx.h> #include <delays.h> #include <stdlib.h> #include <stdio.h> #pragma config WDT = OFF, LVP = OFF, OSC = HS, DEBUG = OFF void main(void) { ADCON1 = 0x0f; // make all AN (analog) pins digital (for bit ref) TRISA = 0x00; TRISD = 0; TRISB = 0; TRISC = 0; PORTA = 0; PORTB = 0x55; PORTC = 0; PORTD = 0x55; while(1) { Delay10KTCYx(100); PORTAbits.RA0 ^= 1; PORTB ^= 0xFF; PORTD ^= 0xFF; Delay10KTCYx(100); } }
Do i have to add this cap on both sides (11,12 and 31,32 pins) or is one side ok. Also i should you polar cap right ?Also place a 0.1uF capacitor between the Vdd and Vss pins of the PIC. Place it close as possible to the PIC
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?