??? 03/08/04 19:45 Read: times |
#66285 - RE: I think this should be okay Responding to: ???'s previous message |
Deepak Kash wrote:
------------------------------- okay now back to your queries SERIAL: JNB TI,$ what will it do if TI not set, first thing unless TI is set ,since REN is disabled, no interrupt would occur and hence no ISR will be executed. If still TI is not set it keeps looping the same add till it is set. If ti set it goes to clear TI , yes as I write this I can reduce a cycle by using JBC TI,$ As you have enabled the serial interrupt, what will happen if you receive a character? You will enter your ISR and the TI-bit is NOT SET. you wait forever until the TI-bit get's set, which is never as there was nothing to transmit. Can you please ...Please make changes and send it back to me I am tired of going round the bush I need to complete my college project by 15th atleast give them a demo.. I have tried my level best . I am not doing the 'give me' thing but I have reached a limit of my understanding capacity...People have to tell me exactly what is wrong so I can further analyse and understand. 1) read, no, study the following info http://www.8052.com/tutint.ph...Interrupts It says clearly: Serial Interrupts are slightly different than the rest of the interrupts. This is due to the fact that there are two interrupt flags: RI and TI. If either flag is set, a serial interrupt is triggered. As you will recall from the section on the serial port, the RI bit is set when a byte is received by the serial port and the TI bit is set when a byte has been sent. So what you have to do is: set up your pointers interrupts and the lot. If you want to start transmitting your main program (NOT your ISR) will have to fill the buffer wth chars and set the TI-flag. The tutorial says very clearly that If either flag (RI or TI) is set, a serial interrupt is triggered Your ISR should check the TI-bit, if not set, return, else put char in sbuf and return. If you want to test start with an isr like check TI-bit if clear RETI else move 'r' to sbuf reti above will only send 'r', nothing else... if this works, try replacing the code for "move 'r' to sbuf" by the code for reading from a buffer That's all I can do for now, as I cannot give you the actual code, I'm new at 8051 too... and don't panic... you still have 7 days (and nights) if you need it by the 15th. My advice: forget what you wrote, study the tutorial, and start again. It's better to "lose" two days learning the tutorial and bible. You will be more productive. Writing up the assembler code is the lesser part of programming. Make sure that _before_ you start you know what you need to know. (I mean the basic principles and basic info...). regards Patrick |