element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Pic Microcontrollers Forum Can't Blink a LED In PIC 18F4550
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 3 replies
  • Answers 1 answer
  • Subscribers 193 subscribers
  • Views 612 views
  • Users 0 members are here
  • ccs
  • c
  • microchip
  • 18f
  • 18f4550
  • 50
  • microcontroller
  • 45
  • pic
  • bacon
Related

Can't Blink a LED In PIC 18F4550

brv64
brv64 over 11 years ago

I Don't know What I'm doing Wrong

I Have a 4M, 8M, 12M, and 20M Crystals

Tried with those crystals and Nothing.

What am I Missing?

 

#include <18F4550.h>   //Incluye Libreria del PIC

#FUSES NOWDT,NOPUT,NOPROTECT,BROWNOUT,NOMCLR,NOLVP,NODEBUG //Incluimos los fusibles

#use delay(clock=8000000) //Cristal

#byte PORTA=0x92 //Declara Direcciones de Puertos

#byte PORTB=0x93

#byte PORTC=0x94

#byte PORTD=0x95

#Byte PORTE=0x96

int16 time=1000; //Declaramos Variable tiempo como 500 Integer 16bits

void main()// Inicio del programa

{

   Set_Tris_D(0b00000000); //Declara las Salidas y entradas

   PORTD=0; //Limpia puerto

   while(1) //Bucle infinito

   {

      PORTD=255; //declaramos que el RD0 esta encendido

      delay_ms(time);//Retardo a la intruccion

      PORTD=0;

      delay_ms(time);

   }

}

  • Sign in to reply
  • Cancel
  • Former Member
    0 Former Member over 11 years ago

    Solicion I have for you I've been working with assembler and code for the LED would stay well.

    I hope you and serve.

     

    STATUS equ  03h

    TRISA equ  85h

    PORTA equ  05h

    ;

      bsf STATUS,5

      movlw  00h

      movwf TRISA

      bcf STATUS,5

    Inicio movlw  02h

      movwf PORTA

      movlw  00h

      movwf PORTA

      goto Inicio

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • brv64
    0 brv64 over 11 years ago in reply to Former Member

    Thanks a lot for your reply

    It Works Well, But I'm Looking for the correction in CCS C
    n_nU

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • brv64
    0 brv64 over 11 years ago in reply to Former Member

    Thanks a Lot For Your help
    I Made it Work with this code

    You can use it if you like

    Have fun

     

    #include <18f4550.h>  //archivo de cabecera

    #fuses HSPLL,MCLR,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,NOVREGEN,NOPBADEN // fuses  configurados

    // el fuse que configuramos anteriormente

    #use delay(clock=20000000)     // el clock que tendremos a la entrada del CPU

    #byte PORTA=0xF80

    #byte PORTB=0xF81

    #byte PORTC=0xF82

    #byte PORTD=0xF83 // RAM address

    #Byte PORTE=0xF84

    int16 M=1000;

    int i;

    byte Const a[10]={0b00111111,

                      0b00000110,

                      0b01011011,

                      0b01001111,

                      0b01100110,

                      0b01101101,

                      0b01111101,

                      0b00000111,

                      0b01111111,

                      0b01100111,};

     

     

    void main()

    {

       Set_Tris_B(0b00000000);

       PORTB=0;

       while(1)

       {

          for(i=0;i<10;i++)

             {

                PORTB=a[i];

                delay_ms(M);

             }

       }

    }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube