Nguyên văn bởi kiemkhach10
Xem bài viết

//------------------------// cai nay thi chạy tot.
char i;[COLOR="#0000FF"]//ko khoi tao gia tri dau cho i[/COLOR]
void main()
{
while(1)
{
if( ++i >10)
i=0;
}
}
//-----------------------------
//------------------------// cai nay thi ko chạy
char i=0;[COLOR="#0000FF"]// khoi tao gia tri ban dau cho i=0;[/COLOR]
void main()
{
while(1)
{
if( ++i >10)
i=0;
}
}
//-----------------------------
. với htech hay c18 thì hiển thị bình thường còn Mikroc lại hiển thị lung tung 
bạn xem lại những biểu thức sau ++i >10, x1+=x2; bạn cứ viết rõ ràng ra nhé.



char i=0;
void main()
while(1)
{
i++;
if(i>10) i=0;
}

char i=0;
void main()
while(1)
{
i++;
if(i>10) i=0;
}



void interrupt CAO (void)
{
//xử lý mức cao
}
void interrupt THAP (void)
{
//xử lý mức thấp
}
void interrupt low_priority foo(void) {
if (TMR1IE && TMR1IF) {
TMR1IF=0;
tick_count = 0;
return;
}
// process any other low priority sources here
}
void interrupt bar(void) {
}
void interrupt low_priority foo(void) {
if (TMR1IE && TMR1IF) {
TMR1IF=0;
tick_count = 0;
[COLOR="#0000CD"][SIZE=3][SIZE=3][COLOR="#0000FF"][COLOR="#0000FF"][SIZE=4]return[/SIZE][/COLOR][/COLOR][/SIZE];[/SIZE][/COLOR]
}
// process any other low priority sources here
}
#ifndef __18F46K22_H
#define __18F46K22_H
extern volatile far unsigned char ANSELA;
extern volatile far struct {
unsigned ANSA0:1;
unsigned ANSA1:1;
unsigned ANSA2:1;
unsigned ANSA3:1;
unsigned :1;
unsigned ANSA5:1;
} ANSELAbits;
#ifndef __18F46K22_H
#define __18F46K22_H
extern volatile far unsigned char ANSELA;
extern volatile far struct {
unsigned ANSA0:1;
unsigned ANSA1:1;
unsigned ANSA2:1;
unsigned ANSA3:1;
unsigned :1;
unsigned ANSA5:1;
} ANSELAbits;

...
Comment