| ??? 06/21/09 08:21 Read: times |
#166306 - AT89C51ED2 changing speed on its own |
I've connected a LED on port P2.3 and
have a piece of code that turns it on and off. After programming the part with FLIP and hitting "Start Application" the code works as it should. (ie. the LED blinks) I can switch the power supply on and off, and it always works. If, howewer, I disconnect the programming cable (RES and PSEN, actually, leaving RXD,TXD,VCC,GND connected), and then turning it on and off, the LED does start to blink, but really, really fast. I have a crystal osc on 48MHz. RES pin is left floating. What should I do? Here is the code: (the error label is never reached, the LED always blinks) mov IEN0,#0 ;disable all INTs jmp prog org 100h error: jmp $ ;to signal ERROR/INT, if I get it anyway prog: mov a,CKCON0 ;is X2 on? jb acc.0, error mov a,CKRL ;clock prescaler? cjne a, #0FFh, error loop: clr P2.3 acall delay setb P2.3 acall delay jmp loop delay: mov r1,0 acall delayMS mov r1,0 acall delayMS mov r1,0 acall delayMS mov r1,0 acall delayMS mov r1,0 acall delayMS mov r1,0 acall delayMS ret delayMS: mov r2,#26 dms1: mov r3,#32 djnz r3,$ djnz r2,dms1 djnz r1,delayMS ret |
| Topic | Author | Date |
| AT89C51ED2 changing speed on its own | 01/01/70 00:00 | |
| apply proper reset | 01/01/70 00:00 | |
| apply proper reset | 01/01/70 00:00 | |
| then that's R0 not R1 | 01/01/70 00:00 | |
| MAX1232 + 4k7 pull-up | 01/01/70 00:00 | |
| I beliebe this chip has a built-in watchdog and thus ... | 01/01/70 00:00 | |
| I don't like those on-chip watchdogs and Vcc monitors | 01/01/70 00:00 | |
| Should be always on | 01/01/70 00:00 | |
| external vs internal | 01/01/70 00:00 | |
| .. | 01/01/70 00:00 | |
| Ground plane? | 01/01/70 00:00 | |
| no ground plane | 01/01/70 00:00 | |
| choose a "magic" frequency crystal ... | 01/01/70 00:00 | |
20MHz and 57600 | 01/01/70 00:00 |



