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.

Reply to
ermtariq
Loading thread data ...

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

Reply to
sprocket

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.