Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help in program pic18f4520 in c

Status
Not open for further replies.

qatar.engineer

Junior Member level 1
Joined
Nov 9, 2006
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,452
pic18f4520 programming

Hi
i program pic18f4520 to light a led but it did not work so can any one see my program and help me if there is any wrong with it.
#include <p18cxxx.h>
#include <delays.h>
#pragma config WDT = OFF
//void delay_ms(long t);
void main (void)
{
TRISB = 0;

/* Reset the LEDs */
PORTB = 0;

/* Light the LEDs */
PORTB = 0x5A;

Delay1KTCYx(15);


while (1)
;
}
is there any website for circuit because i think my circuit is wrong
 

led program code for pic18f4520

Salam!
Visit the site www.piclist.com. It is a nice site with many projects. Also take a look at www.microchip.com & www.microchipc.com.

Check the fuses that you have programmed in the microcontroller.
Some 18F series microcontrollers have a fuze bit that configures some pins of PORTB as analog inputs. Also check the oscillator configuration bits.
Simulating the software in MPLAB will also help you debug the problem.

Khuda hafiz.
 
programming pic18f4520

few simple steps..

1.Build the program and check for errors
2.simulate the program in the compiler and check the response of portb
3.as waseem said,check config bits
4.load the program
5.check whether the pic is getting supply at its vcc and also grnd is thru
6.check the crystal and associated caps.
7.see the port bit by isolating the led part and later with led.
see for step 2n3 carefully

still finding it difficult??
 
pic18f4520 c18

hi
i try the simulate and the program is working but i am not sure for the circuit so can any one help me and give me some sites about the circuit or at least the component of it .
thanks for your help

Added after 7 minutes:

hi
this is how my circuit is look like with 20MHz and 15p and what do you mean by configuration bit what do you mean check it.

76_1174214190.gif
 

delay program c in pic18f4520

there are lot of confuions!!
which controller r u using actually? u said earlier it is 18F4520 and ur circuit now shows a 16F series.which compiler r u using(C compiler)??is that all ut program? r u sure u've simulated it error-free?
circuit doesnt hav any probs..clarify my above q's bfore goin ahead.
 

delay c pic18f4520

Hi!

Your programme is basicly OK, but you maight consider using one aditional pragma directive:
#pragma config OSC=HS // if you are using at least 4MHz quarz

Try using this code, and you will soon se where are the mistakes!
void delay (void)
{
int i;

for (i = 0; i < 10000; i++)
;
}

void main (void)
{
/* Make all bits on the Port B (LEDs) output bits.
* If bit is cleared, then the bit is an output bit.
*/
TRISB = 0;

while (1)
{
/* Reset the LEDs */
PORTB = 0;

/* Delay so human eye can see change */
delay ();

/* Light the LEDs */
PORTB = 0x5A;

/* Delay so human eye can see change */
delay ();
}
}


This is the code from /examples directory in MCC18.

As far as I can see you are using C18 from Microchip. If you want to use the full power of PIC, then this is the right choice!

Best regards
ql000
 

pic18f4520 led delay

hi
i am using 18f4520 but my circuit is same as this one and i used c complier and yes try the simulation free error and there is no error
 

pic18f4520 4mhz crystal

Hi
Question on pic18f4520

i program pic18f4520 to light a led but it did not work so can any one see my program and help me if there is any wrong with it.
#include <p18cxxx.h>
#include <delays.h>
#pragma config WDT = OFF
//void delay_ms(long t);
void main (void)
{
TRISB = 0;

/* Reset the LEDs */
PORTB = 0;

/* Light the LEDs */
PORTB = 0x5A;

Delay1KTCYx(15);


while (1)
;
}
1-Does the plan can work in clk=20Mhz ?
2- You have recommended program?
With thanks
Jacob Matushviz
matush111@walla.co.il
 

pic18f4520 - *

qatar.engineer said:
Hi
i program pic18f4520 to light a led but it did not work so can any one see my program and help me if there is any wrong with it.
#include <p18cxxx.h>
#include <delays.h>
#pragma config WDT = OFF
//void delay_ms(long t);
void main (void)
{
TRISB = 0;

/* Reset the LEDs */
PORTB = 0;

/* Light the LEDs */
PORTB = 0x5A;

Delay1KTCYx(15);


while (1)
;
}
is there any website for circuit because i think my circuit is wrong

maybe you should try to use a different software..i recommend this software..try to download it,its free anyway..use this link https://www.mikroe.com/en/compilers/mikrobasic/pro/pic/

the ckt you showed..its actually working..ive tested it using pic16f877a..if you have question on how to use the software..feel free to ask me..bye, goodluck!:D
 

hi I need program of keypad access i have pic18f4520
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top