![]() | ![]() |
| 07 May 2008 00:42:49 |
| comm problem |
Hi all, I am working on led display project, i am using AT89S53(8051) for programming(keil C) . from last three days i am facing serious problem with communication. I want to communicate PC to LED there is another IC on board provided me, that is MAX1487 and there are only two wire conneting(RXD,TXD) to it. iam connectint only two wire from com port. problem is that i am not able to read or write data from SBUF even keil debugger is going write but there is no hardware response. my progamme setting for this is as follows: void main(void) { SCON=0X50; ET2=1; TCLK=1; RCLK=1; C_T2=0; RCAP2H=0XFF; //baud rate 9600 RCAP2L=0XB2; TR2=1; TR1=1; PS=0; ES=1; EA=1; RI=0; SM2=0; } void rxd(void) interrupt 4 { unsigned char UART_DATA; if(RI==1) { RI=0; TR2=0; UART_DATA=SBUF; } } is this write??????? SBUF is not working well. is there any programmatic error plese help me to right it I have additional code for displaying charcter on led in function main() as well as in rxd(). i am sending you only the settings. is there any requirment of reg52.h ,reg53.h,regs58.h i have included first two in code. there is no right response from led. I think there is communication error from PC to MAX1487 or MAX1487 to microcontroller!!!!!!! plese help me if you have idea of MAX1487 pins connection with microcontroller. i am using 9600,N,8,1. |
| 07 May 2008 10:08:52 |
| sprocket |
| Re: comm problem |
ermtariq@gmail.com wrote: > I am working on led display project, > .. from last three > days i > am facing serious problem with communication. Learn to debug. Start at the beginning, not half way though. Use logic. (1) Forget about interrupts, too much to go wrong. Poll for the character ready bit. (2) Use a scope and a simple terminal program. Make sure handshaking isn't expected. Does anything come through when you press a key? If you haven't got a scope, tack a LED/ resistor on the receive buffer output. Does it blink? Then go out and get a scope. (3) When nothing happens, check that the port is connected the right way round, the ground to the right pin etc. (4) Only when you are sure bits are getting though (and back- tack in a loopback link, but remember to take it off again later) should you bother with software. Get it to transmit a continuous stream of somethings - U's say, because that's alternating bits so you can see the baud rate on a scope. Do they go out, at the right speed? Can you see them on the terminal screen? (5) Then change the program to send back whatever is received. Get that bit working, NOW change to interrupt and get that working. Spend some time writing naughty words to make sure it works. (6) Then you are ready to control whatever you wanted to. This is so general that I'm amazed that everyone needs to be taught it, I would have thought that the first thing you do in school, or the beginner's project, would start with this. Start from the hardware, make sure that's right, then bring in the software a bit at a time, working from simple to complicated. Only populate the bits of board that are necessary to get the thing working- and if you are doing a PSU, only populate that so when the full 24V comes out because you've buggered it up, it doesn't unstitch all the other expensive ICs on the board. JS |
| 07 May 2008 12:18:59 |
| mpm |
| Re: comm problem |
On May 7, 3:42=EF=BF=BDam, ermta...@gmail.com wrote: > Hi all, > > I am working on led display project, > i am using AT89S53(8051) for programming(keil C) . from last three I don't have the S53 datasheet handy, but make sure there's not a bit in one of the Special Function registers to enable the serial port / Timer 2 clock (T2CON would be a good place to start). A similar 8051 derivative had this feature and it nearly drove me crazy until I spotted it. On a legacy 8051 device, the serial ports generally don't have separate enable bits for the receivers.... Otherwise, it's worth mentioning that you might have the serial logic (voltages) inverted. Depends on your circuit. I did not verify your capture/reload as I would need to know the crystal/timebase for that. So double-check that, as needed. Good luck. -mpm |
| 07 May 2008 20:04:52 |
| Hot Jock |
| Re: comm problem |
On 07/05/2008 ermtariq@gmail.com wrote: . . > there is another IC on board provided me, that is MAX1487 and there > are only two wire conneting(RXD,TXD) to it. iam connectint only two > wire from com port. . . It doesn't matter how much code you write, either good or bad. If you don't have a ground reference between the com port and your system, nothing will work. Try asking in 'sci.electronics.basics' for an explanation of the term 'Ground Reference'. -- The Force is dark on one side, light on the other and holds the world together. Hmmm, just like Gaffer Tape then. |
| 07 May 2008 22:21:23 |
| Martin Griffith |
| Re: comm problem |
On Wed, 7 May 2008 12:18:59 -0700 (PDT), in sci.electronics.design mpm <mpmillard@aol.com > wrote: >On May 7, 3:42?am, ermta...@gmail.com wrote: >> Hi all, >> >> I am working on led display project, >> i am using AT89S53(8051) for programming(keil C) . from last three > > >I don't have the S53 datasheet handy, but make sure there's not a bit >in one of the Special Function registers to enable the serial port / >Timer 2 clock (T2CON would be a good place to start). > >A similar 8051 derivative had this feature and it nearly drove me >crazy until I spotted it. >On a legacy 8051 device, the serial ports generally don't have >separate enable bits for the receivers.... > >Otherwise, it's worth mentioning that you might have the serial logic >(voltages) inverted. >Depends on your circuit. I did not verify your capture/reload as I >would need to know the crystal/timebase for that. So double-check >that, as needed. > >Good luck. >-mpm > > > On the atmel 1995 ed book of the 89xxx it's the REN in SCON, 0x10 martin |