Hello I'm new in this programming world and I had a simple application in C that was supposed to toggle a led and set some signals... The application was supposed to be emulated with an EPROM emulator but it doesn't work now... I'm not sure what the necessary options should be set to create at HEX file: I used Target/ Options for target.../Output and from the first frame selected Debug information + Browse information + Create HEX (HEX-80) file. Is this right? Was I supposed to do something else? Or decheck Debug information + Browse information?
way too fast, the LED will glow half bright. To observe a blink one in 100 can see it at 120Hz, all can see it at 25Hz Erik
Ok i've modified that. But my problem was that the led was NEVER ON. That wasn't supposed to be happening because 1. I initiated the TMOD,TCON registers... 2. I initiated IE 3. I specified the Timer0 ISR. And by measuring with an osciloscope I saw a continuous signal at the pins...and at the XTAL...so I'm not even sure if the processor is being fed with clock signal...:( #include <REG52.H> void main(void) { unsigned int c1=0; unsigned char c2=0; P1 = 0x00; //light up leds while (1) { /* 1.8 mhz */ c1++; if (c1==30000) /* 60 hz */ { c1=0; c2++; if (c2==12) { c2=0; P1 ^= 0xFF; //blink led and toggle all pins } } } } I'm not sure how can I test if the Oscilation from the XTAL is ok (or if there is a component failiure). The schematic is the usual: gnd-10pf---------+------------+-----|X1 | XTAL=22MHz R=10MOhms | +-10pf--------+------------+-----|X2
And by measuring with an osciloscope I saw a continuous signal at the pins...and at the XTAL...so I'm not even sure if the processor is being fed with clock signal...:( Nothing you do with the software can ever, possibly fix a problem with the hardware like that. If you don't see the XTAL oscillating, that means either you fritzed the CPU, or you're not feeding it correctly, or you don't have a working reset circuit. Fix the hardware before you begin worrying about details of your software! And just for the record: processors aren't usually "fed" with a clock signal, if all you attach is an XTAL. They generate that signal themselves, with the XTAL being part of the generator, determining the frequency.