B butters Member Jun 3, 2009 #1 i have this code for uart receiving... it is not working.. can somebody help me? im trying to send bits from hyperterminal to usart... hence the uart is in receiving side... Code: #include <p18C452.h> #include <usart.h> char readUSART(void); void main(void){ // configure USART OpenUSART( USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH,25 ); firstCh = ReadUSART(); nextCh = ReadUSART(); while (!DataRdyUSART()) /* busy wait*/; firstCh = ReadUSART(); while (!DataRdyUSART()) /* busy wait*/; nextCh = ReadUSART(); //CloseUSART(); }
i have this code for uart receiving... it is not working.. can somebody help me? im trying to send bits from hyperterminal to usart... hence the uart is in receiving side... Code: #include <p18C452.h> #include <usart.h> char readUSART(void); void main(void){ // configure USART OpenUSART( USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH,25 ); firstCh = ReadUSART(); nextCh = ReadUSART(); while (!DataRdyUSART()) /* busy wait*/; firstCh = ReadUSART(); while (!DataRdyUSART()) /* busy wait*/; nextCh = ReadUSART(); //CloseUSART(); }
P Pommie Well-Known Member Most Helpful Member Jun 3, 2009 #2 Try putting semi colons on the while lines, Code: while (!DataRdyUSART())[COLOR="red"];[/COLOR] /* busy wait*/; firstCh = ReadUSART(); while (!DataRdyUSART())[COLOR="Red"];[/COLOR] /* busy wait*/; nextCh = ReadUSART(); What you have at the moment is the equivalent of, Code: while (!DataRdyUSART()){ /* busy wait*/; firstCh = ReadUSART(); } while (!DataRdyUSART()){ /* busy wait*/; nextCh = ReadUSART(); } Mike.
Try putting semi colons on the while lines, Code: while (!DataRdyUSART())[COLOR="red"];[/COLOR] /* busy wait*/; firstCh = ReadUSART(); while (!DataRdyUSART())[COLOR="Red"];[/COLOR] /* busy wait*/; nextCh = ReadUSART(); What you have at the moment is the equivalent of, Code: while (!DataRdyUSART()){ /* busy wait*/; firstCh = ReadUSART(); } while (!DataRdyUSART()){ /* busy wait*/; nextCh = ReadUSART(); } Mike.
P Pommie Well-Known Member Most Helpful Member Jun 4, 2009 #4 butters said: is the closeusart(); necessary? Click to expand... I doubt it. Mike.
B butters Member Jun 4, 2009 #5 i am able to build my programme but when i want to run it, theres an error... ICD0083: Debug: Unable to enter debug mode. Please double click this message for more information.
i am able to build my programme but when i want to run it, theres an error... ICD0083: Debug: Unable to enter debug mode. Please double click this message for more information.
P Pommie Well-Known Member Most Helpful Member Jun 4, 2009 #6 That error is generated by the ICD2 not being able to enter debug mode. Click the error message to see the most common reason. Mike.
That error is generated by the ICD2 not being able to enter debug mode. Click the error message to see the most common reason. Mike.