??? 04/02/07 19:39 Modified: 04/02/07 19:41 Read: times |
#136440 - system froze when connected to hyperterminal Responding to: ???'s previous message |
thank you very much everyone's response, it's very much appreciated. i have start working on the software now but i stumbled across a problem where the 8051 hang once i tried to connect it to Hyperterminal, in another word the whole system stop responding until i disconnected the hyperterminal connection. The reason i was doing this is to make sure that the microcontroller can succesfully send a byte of character out to the hyperterminal. where is my mistake?
void initialize(void){ . . . . TMOD = 0x21; // T0=16-bits, T1=8-bits auto reload //set up timer 0 for other interrupts, i.e : sensors routine TH0 = 0xFC; TL0 = 0x65; ET0 = 1; TR0 = 1; //set up timer 1 for UART bauding. SCON = 0x40; // Serial Mode 1 TH1 = 0xFF; // 19200 BAUD @ 11,059,000 Hz TR1 = 1; EA = 1; . . . } void putch(char val) // function to output a single byte character to SBUF { TI = 0; // transmit flag = 0 SBUF = val; // place the character on SBUF while (TI == 0); //wait for the completion of transmission } void main(void) { initialize(); while(1){ //LCD Display function call here //Keypad scanning/decoding function here if(button pressed) putch('A'); } } //If button 1 is pressed I create the program such that if a certain button is pressed, character 'A' will be sent to the Hyperterminal. The LCD Display was working fine and the keypad is working to scroll through a pre-defined menu, but once the Hyperterminal is connected, everything simply froze until i disconnected the connection again. Please help! |