Hi,
I have made a simple program (Hello World) it working in simulation (ISIS) but not in real hardware. I hope the problem is come from OSC setting but have no idea about it, i have connected the 8 Mhz XT in proper pin and connected. I am newer in this world request your help regarding that. Incase any additional help required please let me know.
Program run in ISIS but not in real hardwar
Re: Program run in ISIS but not in real hardwar
How do you expect help if we can not se what you are doing?
post a screen print of your Configuration settings ,which microcontroller and you schematic then people can help you
we have no glass balll through which we can see what you are doing.
post a screen print of your Configuration settings ,which microcontroller and you schematic then people can help you
we have no glass balll through which we can see what you are doing.
P.Erasmus
Saratov,Russia
--------------------------------------------------------------
Saratov,Russia
--------------------------------------------------------------
Re: Program run in ISIS but not in real hardwar
Hi i am using PIC18F4520 with 8 Mhz cristal for clocking, 74595, 4017 and 7seg-CC
it is run fine in Protious but not in real HW
it is run fine in Protious but not in real HW
Code: Select all
unsigned char key, flag, temp,temp1, dis_dig, next;
unsigned short value, i, val,j,bit_val[3];
unsigned int cnt,no[4],k,no1;
void find_ip()
{
if(i==0)
{
if(temp==32)
{value=1;}
else if(temp==64)
{value=2;}
else if(temp==128)
{value=3;}
}
if(i==1)
{
if(temp==32)
{value=4;}
else if(temp==64)
{value=5;}
else if(temp==128)
{value=6;}
}
if(i==2)
{
if(temp==32)
{value=7;}
else if(temp==64)
{value=8;}
else if(temp==128)
{value=9;}
}
if(i==3)
{
if(temp==32)
{value=11;}
else if(temp==64)
{value=10;}
else if(temp==128)
{value=11;}
}
}
void scan_row()
{
switch(i)
{
case 0:
PORTB.RB0=1;
break;
case 1:
PORTB.RB1=1;
break;
case 2:
PORTB.RB2=1;
break;
case 3:
PORTB.RB3=1;
break;
}
}
void dec_cnvt(unsigned char vab)
{
switch(vab)
{
case 10:
dis_dig=0b00111111;
break;
case 1:
dis_dig=0b00000011;
break;
case 2:
dis_dig=0b01101101;
break;
case 3:
dis_dig=0b01100111;
break;
case 4:
dis_dig=0b01010011;
break;
case 5:
dis_dig=0b01110110;
break;
case 6:
dis_dig=0b01111110;
break;
case 7:
dis_dig=0b00100011;
break;
case 8:
dis_dig=0b01111111;
break;
case 9:
dis_dig=0b01110111;
break;
case 0:
dis_dig=0b00000000;
break;
}
}
void interrupt()
{
if(INTCON.RBIF)
{
no1=no1+1;
flag=3;
temp=PORTB;
INTCON.RBIF=0;
temp=PORTB;
//INTCON.RBIE=0;
// no[0]=no1;
if(no1>4)
{
no1=0;
j=1;
}
}
if(INTCON.TMR0IF)
{
cnt++;
if(cnt>30)
{
key=1;
cnt=0;
dis_dig=0b00011011;
INTCON=0b00001000;
T0CON=0b00000110;
// INTCON2.RBPU=0;
}
INTCON.TMR0IF=0;
TMR0L=0x00;
TMR0H=0xFF;
}
if(PIR1.SSPIF)
{
flag=2;
PIR1.SSPIF=0;
}
}
void main()
{
OSCCON=0b11110110;
INTCON=0b11101000;
INTCON2=0b10000000;
PIE1.SSPIE=1;
T0CON=0b10000110;
SSPSTAT.SMP=1;
SSPSTAT.CKE=0;
SSPCON1=0b00100001;
TMR0L=0xD0;
TMR0H=0xFF;
TRISB=0xF0;
PORTB=0x00;
TRISC=0x10;
PORTC=0x00;
TRISD=0x00;
while(1)
{
if(key==1)
{
key=0;
for(i=0;i<4;i++)
{
scan_row();
if(flag==3)
{
find_ip();
j=no1/2;
}
PORTB.RB0=0;
}
INTCON=0b11100000;
T0CON=0b10000110;
}
else if(key==0)
{
if(cnt>0)
{
bit_val[j]=value;
val=bit_val[k];
//val=j;
PORTC.RC0=0;
dec_cnvt(val);
SSPBUF=dis_dig;
if(flag==2)
{
while(dis_dig!=0)
{
dis_dig=dis_dig << 1;
}
}
if(k==0)
{PORTD=0b11111110;
}
if(k==1)
{PORTD=0b11111101;
}
if(k==2)
{PORTD=0b11111011;
}
k++;
if(k>2)
{k=0;}
PORTC.RC0=1;
//flag=0;
delay_ms(2);
}
}
}
}
- Attachments
-
- ckt.jpg (375.58 KiB) Viewed 1993 times
-
- Posts: 715
- Joined: 27 Dec 2006 14:33
- Location: Le Tréport , FRANCE
Re: Program run in ISIS but not in real hardwar
project / edit project screen to fill ...
Alain
Alain
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: Program run in ISIS but not in real hardwar
Hello,
Zip and attach project files in new post or attach screenshot of Project settings window.
Best regards,
Peter
Zip and attach project files in new post or attach screenshot of Project settings window.
Best regards,
Peter
Re: Program run in ISIS but not in real hardwar
Hi as per your requirement i update all, at this condition my circut is working but only one pin is lighted. Please Help me............
- Attachments
-
- Project window
- Project window.jpg (355.36 KiB) Viewed 1942 times
-
- Working_RBTEST.zip
- Total files of this project
- (41.14 KiB) Downloaded 94 times
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: Program run in ISIS but not in real hardwar
Hello,
Please try code from attachment.
Best regards,
Peter
Please try code from attachment.
Best regards,
Peter
- Attachments
-
- Working_RBTEST.zip
- (38.21 KiB) Downloaded 87 times