---
+ Post New Thread
Results 1 to 1 of 1
  1. #1
    Newbie level 2
    Points: 190, Level: 2

    Join Date
    Dec 2011
    Posts
    2
    Helped
    0 / 0
    Points
    190
    Level
    2

    PIC 18F4550 code on microC pro, simulation on Proteus not working!

    Hello every one, I have been facing a problem regarding my code for PIC for quite a few days now,
    I am new to PIC programming in microC since i have only worked on 8051 microcontrollers and keil,
    I would really appreciate it if some one can kindly tell me what am I doing wrong in the code given below!

    // code to switch on LED when push button at pin RA0 is pressed and off when it is released

    sbit LED at RB0_bit;
    sbit LED_Direction at TRISB0_bit;
    sbit SW at RA0_bit;
    sbit SW_Direction at TRISA0_bit;

    void main()
    {
    ADCON1= 0x0F;
    CMCON = 0x07;
    LED_Direction = 0; // setting pin B0 as output
    SW_Direction= 1 ; // setting pin A0 as input
    TRISD= 0; // setting port D as output
    while(1);
    {

    if (SW==0)
    {
    LED=1;
    }
    PORTD = 0xff;
    Delay_1sec;
    PORTD = 0x0f;
    if (SW==1)
    {
    LED=0;
    }
    }
    }

    its a simple code to switch on and Off an LED when button is pressed but its not simulating in proteus!
    thank you in advance

    here is the proteus design

    http://images.elektroda.net/27_1324276294.jpg
    Last edited by Uptech19; 19th December 2011 at 06:33.

    •   Alt19th December 2011, 06:22

      advertising

        
       

+ Post New Thread
Please login