??? 07/06/09 16:49 Read: times |
#166808 - Additional info about the board AT89S52 and ISP Responding to: ???'s previous message |
Per Westermark said:
No, he did not intend you to connect the button and the LED to UART pins.
Having a button on an otherwise unused processor pin, and a LED on another pin allows you to write helper code. You may for example have your program toggle the LED whenever it receives a UART interrupt, or receives a character. And you may teach your program to start a transmission every time you press the button. Such debugging tricks can help a lot when trying to find a hardware or software problem. You say you have seen a signal on the oscilloscope. Did it have the expected voltage levels, and the expected timing? Would you be able to manually decode a received character from the oscilloscope image? The scope test is something you have to do in both directions. Both to make sure that both sides tries to send (and hence receive) with the same baudrate, and to make sure that the transmitters on both sides will translate the signal correctly to the receiver on the other side. In the end, you must always try to split your problems into two smaller problems and then continue to split them further into even smaller problems until you have reached a level where you can prove - or disprove - the function of such a subdivision. Instead of starting with full-system debugging, you try one signal at a time, and verify levels and timing. See your system as an onion. Fix the layers from the inside and out. You can't see a rotten core, but it will spoil everything... Per is leading to the right direction. The AT89S52 microcontroller besides Port2 (P2) has another three ports P0, P1 and P3. Excluding P3.0(RXD), P3.1(TXD), P1.5(MOSI), P1.6(MISO) and P1.7(SCK) you have another 3x8=24 -5=19 pins free for any option. At any two of these pins try to connect a Button and a Led to another. I suggest to connect the Button to P3.2(INT0) so you may interrupt the running program of cource you have to setup the INT0_ISR, and the Led to P3.7 to show any flash on, off at situations helpfull like Per said If you remove the microcontroller from the socket while programming then this is not the ISP (In System Progmamming) method. The ISP concept is to programm the microcontroller on board on the running circuit using these line MOSI, MISO, SCK and RST. You have to make an ISP header on the target board and by that you use the ISP method. One of the typical ISP programmers is from ATMEL AT89SIP and costs about 25$. Don't try to make it, buy it. If you have to a. remove the microcontroller from the board, b.connect it to an other programmer, c.write/verify the flash, d.disconnect from the programmer and to e.connect to the target board, then after a few runs the pins will be ruined and random problems will appear. About serial communications Have done this before ? to connect a PC sending/receiving data to a board with '51 like AT89S52 ? The setup of serial communications at the microcontroller side have to do be done according to the applications' specifications. Are you using the Serial Interrupt or the polling method of the RI/TI ? What is the speed of transiming/receiving data ? Is the hardware about serial comms on the microcontroller setup with the right values and procedures ? How do you use the data received at the microcontroller side ? If you present formatted and documented pieces of your code it would be easy to find the missing part. Remeber to try to solve one issue at a time. K.L.Angelis |