problem in hyper terminal displaying character using pic18f452

Status
Not open for further replies.

engineer khan

Member level 3
Joined
Aug 31, 2012
Messages
66
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,833
I m using c18 compiler pic18f452 I wanna display a character on hyperterminal it dosent display,its okay on proteus virtual terminal but not on actual hardware
my code is
I tried it by different ways changing baudrate values config value but still it doesnt work,plz help

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<P18F452.h>
 
#pragma config OSCS=OFF
#pragma config OSC=HS
#pragma config WDT=ON
#pragma config BOR=ON
#pragma config BORV=45
#pragma config PWRT=OFF
#pragma config LVP=OFF
#pragma config DEBUG=OFF
 
void delay(unsigned int time);
 
void main(void){
TXSTA=0x20;
SPBRG=64;
TXSTAbits.TXEN=1;
RCSTAbits.SPEN=1;
TXSTAbits.BRGH=1;
while(1){
 
TXREG='G';
while(PIR1bits.TXIF==0);
delay(10);
}
}
void delay(unsigned int time){
int i,j;
for(i=0;i<135;i++)
for(j=0;j<time;j++);
}

 
Last edited by a moderator:

Turn the watch dog timer off? (WDT)
 

try replacing
Code:
while(PIR1bits.TXIF==0);
with
Code:
while(!TXSTAbits.TRMT);
does anything appear on the screen at all?
if not have you used an oscilloscope to look at the USART Tx line to see if anything is being transmitted?
 

You need to tick on the "Echo typed characters locally" box in the ASCII setup menu of hyperterminal to see the received data. Moreover , have u tested your TTL to RS232 circuit ? Is that working fine?
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…