![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #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();
}
| |
| |
| | #2 |
|
Try putting semi colons on the while lines, Code: while (!DataRdyUSART()); /* busy wait*/;
firstCh = ReadUSART();
while (!DataRdyUSART()); /* busy wait*/;
nextCh = ReadUSART();
Code: while (!DataRdyUSART()){ /* busy wait*/;
firstCh = ReadUSART();
}
while (!DataRdyUSART()){ /* busy wait*/;
nextCh = ReadUSART();
}
| |
| |
| | #3 |
|
is the closeusart(); necessary?
| |
| |
| | #4 |
| | |
| |
| | #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. | |
| |
| | #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. | |
| |
|
| Tags |
| correction, problem, receiving, uart |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| USART/UART data receiving problem | mbarren | Micro Controllers | 32 | 28th May 2009 01:24 AM |
| UART Transmitting Problem | winson | Micro Controllers | 9 | 20th January 2009 03:01 AM |
| USART Receiving a String Problem | Suraj143 | Micro Controllers | 13 | 17th June 2008 07:53 AM |
| PIC16F628A USART receiving problem | AWHF | Micro Controllers | 12 | 15th March 2008 05:26 PM |
| Real time freq correction problem | Rosco101 | Electronic Projects Design/Ideas/Reviews | 2 | 8th April 2005 12:02 PM |