Ok I see, but now on my computer now proteus, mikroc, mikroc pro and hi-tech are working and also the other programs. I'm confused. Let's make last thing. I will send you my program (my real program). Please help me to make last changes. the code is below..
------------------------------------------------------------------------------------------------------
/*
This code file was compiled with
mikroC, mikroElektronika C compiler
for Microchip PIC microcontrollers
Version: 8.2.0.0 (Demo Version)
Note: In Demo version, hex output is limited to 2k of program words.
*/
/*
Microchip PIC18F2520 @ 125kHZ Internal RC Oscillator
*/
/* Configuration Words (FUSES)
CONFIG1: (Word 1)
INTIO 0xF8FF INT RC-Port on RA6,Port on RA7
FCMDIS 0xBFFF Fail-Safe Clock Monitor Disabled
IESODIS 0x7FFF Internal External Switch Over Mode Disabled
CONFIG2: (Word 2)
PWRTDIS 0xFFFF Power Up Timer Disabled
BORDIS 0xFFF9 Brown Out Detect Disabled
WDTDIS 0xFEFF Watchdog Timer Disabled
CONFIG3: (Word 3)
CCP2RC1 0xFFFF CCP2 Mux RC1
PBDIGITAL 0xFDFF PortB A/D Disable, PORTB Digital Port
LPT1DIS 0xFBFF Low Power Timer1 Osc Disable
MCLRDIS 0x7FFF MCLR Disabled,RE3 Enabled
CONFIG4: (Word 4)
XINSTDIS 0xFFBF Extended CPU Disabled
STVRDIS 0xFFFE Stack Overflow Reset Disabled
LVPDIS 0xFFFB Low Voltage Program Disabled
DEBUGDIS 0xFFFF Background Debug Disabled
CONFIG5: (Word 5)
UNPROTECT 0xFFFF Code Protection Disabled
CONFIG6: (Word 6)
UNPROTECT 0xFFFF Table Write Protection Disabled
CONGFIG7: (Word 7)
UNPROTECT 0xFFFF Table Read Protection Disabled
*/
volatile unsigned char counter;
volatile unsigned char push=1;
unsigned char ky=0;
int syn=0;
#define us100 PORTB.F3
#define svic PORTC.F0
void interrupt()
{
counter++;
Delay_ms(150);
if(counter == 10)
counter=0;
while(PORTB.F0=0);
Delay_ms(20);
push=1;
PORTA.F0=0; PORTA.F1=0; PORTA.F2=0; PORTA.F3=0;
PORTB.F4=0; PORTB.F5=0; PORTB.F6=0; PORTB.F7=0;
svic=0;
us100=0;
INTCON=0xD0;
}
void sth(int eth)
{
for(syn=0;syn<eth;syn++)
{
if(syn==0)
PORTB.F7=1;
if(syn==5)
PORTB.F7=0;
if(push == 1)
break;
Delay_ms(10);
}
}
void leds_off()
{
// a-->RB5 , f-->RB4 , dot-->RB7 , g-->RB6
// c-->RA0 , e-->RA1 , b-->RA3 , d-->RA2
/*
Vss-- --a ---a---
d-- --f d| |f
b-- --g |__b__|
e-- --dot | |
c-- --Vss e| |g
---c---
*/
PORTA.F0=0; PORTA.F1=0; PORTA.F2=0; PORTA.F3=0;
PORTB.F4=0; PORTB.F5=0; PORTB.F6=0; PORTB.F7=0;
}
void pwm_signal(unsigned char j)
{
for(ky=0;ky<j;ky++)
{
if(push == 1)
break;
us100=1;
Delay_us(100);
if(push == 1)
break;
us100=0;
Delay_us(9900);
}
}
void main()
{
INTCON=0x10;
INTCON2=0x05;
INTCON3=0xC0;
PIR1=0x00;
PIR2=0x00;
PIE1=0x00;
PIE2=0x00;
IPR1=0x00;
IPR2=0x00;
RCON=0x80;
TRISB=0x01;
TRISC=0x00;
TRISA=0x00;
PORTA=0x00;
PORTB=0x01;
PORTC=0x00;
INTCON.GIE=1;
ADCON0=0x00;
ADCON1=0x0F;
ADCON2=0x00;
OSCCON=0x1E;
Pwm_Init(20000);
Pwm_Start();
Pwm_Change_Duty(128);
push=1;
for(;
{
if(push==1)
{
push=0;
if(counter == 0)
{
//6000 ms toplam periyot, 2000 ms on + 4000 ms off
PORTA.F0=1; PORTA.F1=1; PORTA.F2=1; PORTA.F3=0;
PORTB.F4=1; PORTB.F5=1; PORTB.F6=1; PORTB.F7=0;
svic=1;
pwm_signal(66);
svic=0;
us100=0;
leds_off();
pwm_signal(134);
sth(400);
}
if(counter == 1)
{
//4990 ms toplam periyot, 1660 ms on + 3330 ms off
PORTA.F0=0; PORTA.F1=0; PORTA.F2=0; PORTA.F3=0;
PORTB.F4=1; PORTB.F5=0; PORTB.F6=1; PORTB.F7=0;
svic=1;
pwm_signal(66);
svic=0;
us100=0;
leds_off();
pwm_signal(100);
sth(333);
}
if(counter == 2)
{
//4240 ms toplam periyot, 1410 ms on + 2830 ms off
PORTA.F0=1; PORTA.F1=1; PORTA.F2=0; PORTA.F3=1;
PORTB.F4=1; PORTB.F5=1; PORTB.F6=0; PORTB.F7=0;
svic=1;
pwm_signal(66);
svic=0;
us100=0;
leds_off();
pwm_signal(75);
sth(283);
}
if(counter == 3)
{
//3990 ms toplam periyot, 1330 ms on + 2660 ms off
PORTA.F0=1; PORTA.F1=0; PORTA.F2=0; PORTA.F3=1;
PORTB.F4=1; PORTB.F5=1; PORTB.F6=1; PORTB.F7=0;
svic=1;
pwm_signal(66);
svic=0;
us100=0;
leds_off();
pwm_signal(67);
sth(266);
}
if(counter == 4)
{
//3750 ms toplam periyot, 1250 ms on + 2500 ms off
PORTA.F0=0; PORTA.F1=0; PORTA.F2=1; PORTA.F3=1;
PORTB.F4=1; PORTB.F5=0; PORTB.F6=1; PORTB.F7=0;
svic=1;
pwm_signal(66);
leds_off();
svic=0;
us100=0;
pwm_signal(59);
sth(250);
}
if(counter == 5)
{
//3240 ms toplam periyot, 1080 ms on + 2160 ms off
PORTA.F0=1; PORTA.F1=0; PORTA.F2=1; PORTA.F3=1;
PORTB.F4=0; PORTB.F5=1; PORTB.F6=1; PORTB.F7=0;
svic=1;
pwm_signal(66);
leds_off();
svic=0;
us100=0;
pwm_signal(42);
sth(216);
}
if(counter == 6)
{
//3000 ms toplam periyot, 1000 ms on + 2000 ms off
PORTA.F0=1; PORTA.F1=1; PORTA.F2=1; PORTA.F3=1;
PORTB.F4=0; PORTB.F5=1; PORTB.F6=1; PORTB.F7=0;
svic=1;
pwm_signal(66);
svic=0;
us100=0;
leds_off();
pwm_signal(34);
sth(200);
}
if(counter == 7)
{
//2740 ms toplam periyot, 910 ms on + 1830 ms off
PORTA.F0=0; PORTA.F1=0; PORTA.F2=0; PORTA.F3=0;
PORTB.F4=1; PORTB.F5=1; PORTB.F6=1; PORTB.F7=0;
svic=1;
pwm_signal(66);
leds_off();
svic=0;
us100=0;
pwm_signal(25);
sth(183);
}
if(counter ==
{
//2490 ms toplam periyot, 830 ms on + 1660 ms off
PORTA.F0=1; PORTA.F1=1; PORTA.F2=1; PORTA.F3=1;
PORTB.F4=1; PORTB.F5=1; PORTB.F6=1; PORTB.F7=0;
svic=1;
pwm_signal(66);
leds_off();
svic=0;
us100=0;
pwm_signal(17);
sth(166);
}
if(counter == 9)
{
//1990 ms toplam periyot, 660 ms on + 1330 ms off
PORTA.F0=1; PORTA.F1=0; PORTA.F2=1; PORTA.F3=1;
PORTB.F4=1; PORTB.F5=1; PORTB.F6=1; PORTB.F7=0;
svic=1;
pwm_signal(66);
leds_off();
svic=0;
us100=0;
sth(133);
}
leds_off();
}
else
{
if(counter == 0)
{
//6000 ms toplam periyot, 2000 ms on + 4000 ms off
svic=1;
pwm_signal(200);
svic=0;
us100=0;
sth(400);
}
if(counter == 1)
{
//4990 ms toplam periyot, 1660 ms on + 3330 ms off
svic=1;
pwm_signal(166);
svic=0;
us100=0;
sth(333);
}
if(counter == 2)
{
//4240 ms toplam periyot, 1410 ms on + 2830 ms off
svic=1;
pwm_signal(141);
svic=0;
us100=0;
sth(283);
}
if(counter == 3)
{
//3990 ms toplam periyot, 1330 ms on + 2660 ms off
svic=1;
pwm_signal(133);
svic=0;
us100=0;
sth(266);
}
if(counter == 4)
{
//3750 ms toplam periyot, 1250 ms on + 2500 ms off
svic=1;
pwm_signal(125);
svic=0;
us100=0;
sth(250);
}
if(counter == 5)
{
//3240 ms toplam periyot, 1080 ms on + 2160 ms off
svic=1;
pwm_signal(108);
svic=0;
us100=0;
sth(216);
}
if(counter == 6)
{
//3000 ms toplam periyot, 1000 ms on + 2000 ms off
svic=1;
pwm_signal(100);
svic=0;
us100=0;
sth(200);
}
if(counter == 7)
{
//2740 ms toplam periyot, 910 ms on + 1830 ms off
svic=1;
pwm_signal(91);
svic=0;
us100=0;
sth(183);
}
if(counter ==
{
//2490 ms toplam periyot, 830 ms on + 1660 ms off
svic=1;
pwm_signal(83);
svic=0;
us100=0;
sth(166);
}
if(counter == 9)
{
//1990 ms toplam periyot, 660 ms on + 1330 ms off
svic=1;
pwm_signal(66);
svic=0;
us100=0;
sth(133);
}
}
}
}
-------------------------------------------------------------------
Last thing for change is writing the value of the counter to EEPROM. Now I just want to add your kernel code file to mine. If I finish this my work will end.