Aug 14, 2012 #1 H h.sharma Junior Member level 3 Joined Jun 16, 2012 Messages 30 Helped 1 Reputation 2 Reaction score 1 Trophy points 1,288 Activity points 1,455 hello everyone when I am simulating for pic18 mc in proteus it is not simulating expected, bt it is working perfect 4 pic16 my hex file is running perfect in pic simulator and also in debugging in mplab i am attaching my ckt simulating in proteus there is no prob with proteus for pic16 plz tell me whats wrong with this ckt and how to simulate for pic18 in proteus my code is Code: #include<p18f4550.h> #include<delays.h> int i,d; #define us(d) for(i=0;i<d;i++){Delay1TCY();} #define ms(d) for(i=0;i<d;i++){Delay1KTCY();} void main(void){ TRISB=0x00; TRISD=0X00; while(1){ PORTB=0XFF; PORTD=0XFF; } } Attachments 2.png 24.1 KB · Views: 68 Last edited: Aug 14, 2012
hello everyone when I am simulating for pic18 mc in proteus it is not simulating expected, bt it is working perfect 4 pic16 my hex file is running perfect in pic simulator and also in debugging in mplab i am attaching my ckt simulating in proteus there is no prob with proteus for pic16 plz tell me whats wrong with this ckt and how to simulate for pic18 in proteus my code is Code: #include<p18f4550.h> #include<delays.h> int i,d; #define us(d) for(i=0;i<d;i++){Delay1TCY();} #define ms(d) for(i=0;i<d;i++){Delay1KTCY();} void main(void){ TRISB=0x00; TRISD=0X00; while(1){ PORTB=0XFF; PORTD=0XFF; } }
Aug 14, 2012 #2 W wp100 Advanced Member level 6 Joined May 15, 2009 Messages 3,051 Helped 884 Reputation 1,783 Reaction score 733 Trophy points 113 Location Prime Meridian Activity points 0 Hi, Try pulling up Pin1 Mclre
Aug 14, 2012 #3 bigdogguru Administrator Joined Mar 12, 2010 Messages 9,821 Helped 2,350 Reputation 4,694 Reaction score 2,272 Trophy points 1,413 Location Southwest, USA Activity points 62,383 One issue is that the PORT pins RB0:RB4 are configured as ADC inputs, NOT digital I/O on device reset. Reference: PIC18F2455/2550/4455/4550 Datasheet, Section: 10.2 PORTB, TRISB and LATB Registers, Page 116 Note: On a Power-on Reset, RB4:RB0 are configured as analog inputs by default and read as ‘0’; RB7:RB5 are configured as digital inputs. By programming the Configuration bit, PBADEN (CONFIG3H<1>), RB4:RB0 will alternatively be configured as digital inputs on POR. Click to expand... Try the following port initialization: Code: LATB = 0x00; ADCON1 = 0x0E; TRISB = 0x00; BigDog
One issue is that the PORT pins RB0:RB4 are configured as ADC inputs, NOT digital I/O on device reset. Reference: PIC18F2455/2550/4455/4550 Datasheet, Section: 10.2 PORTB, TRISB and LATB Registers, Page 116 Note: On a Power-on Reset, RB4:RB0 are configured as analog inputs by default and read as ‘0’; RB7:RB5 are configured as digital inputs. By programming the Configuration bit, PBADEN (CONFIG3H<1>), RB4:RB0 will alternatively be configured as digital inputs on POR. Click to expand... Try the following port initialization: Code: LATB = 0x00; ADCON1 = 0x0E; TRISB = 0x00; BigDog
Aug 15, 2012 #4 H h.sharma Junior Member level 3 Joined Jun 16, 2012 Messages 30 Helped 1 Reputation 2 Reaction score 1 Trophy points 1,288 Activity points 1,455 thanx bigdogguru it worked after pulling up mclr very very thanx