CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to reading data from RS232 via Hyper Terminal

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Eakle
Guest







How to reading data from RS232 via Hyper Terminal
PostPosted: Mon Mar 13, 2006 8:12 am     Reply with quote

Hello everyone,

First I'm very newbies in PIC and very sorry for my bad English.

My problem is I try to connect computer using 16F877A via RS232 to Hyper Terminal (Windows XP). I can send data normally but when I want to read data from Hyper Terminal, it's struck. Please see my code.

Code:

#include <16F877.h>            

#define TxD   PIN_C6            
#define RxD PIN_C7            
#define CLOCK_SP 20000000      
   
#define USED_EEPROM 20         

#fuses HS                  
#fuses NOLVP, NOWDT            
#fuses NOPROTECT            

#use delay (clock = CLOCK_SP) 
#use rs232(baud=9600, xmit=TxD, rcv=RxD)

#byte PORTA = 0x05
#byte PORTB = 0x06
#byte PORTC = 0x07
#byte PORTD = 0x08

void main()
{
      char ch;
      printf("1 key input number : \n");      <= THIS CODE  OK.
      ch = getc();                                     <= STRUCK ON THIS LINE.
      printf("Input = %c \n\r",ch );             <= NOT SHOW
}


HyperTerminal [baud 9600/ Data bits 8/Parity N/Stop bit 1/Flow Xon-Xoff]
Please teach me how to setup Hyper terminal sending data.
Or anyone have any programs which can debug serial connection code.

Thanks.
Eakle.
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Mon Mar 13, 2006 8:17 am     Reply with quote

change:

Code:
#use rs232(baud=9600, xmit=TxD, rcv=RxD, Errors)



Change Hyperterm to NO FLOW CONTROL (or add your own flow control to the PIC code).
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Eakle
Guest







PostPosted: Mon Mar 13, 2006 6:58 pm     Reply with quote

Thanks very much

I'll try this code.


Regards,
Eakle
Ahmed



Joined: 07 Mar 2006
Posts: 19

View user's profile Send private message

Re: How to reading data from RS232 via Hyper Terminal
PostPosted: Mon Mar 13, 2006 8:11 pm     Reply with quote

your code looks write and I tested it is working. adjust the hyper terminal by clicking on "Restore Defaults".

I think your problem is not in the code, so check your hardware.

I had similar problem before then i found that the problem was due to (USB to Srial) cable, was sending and not recieving.

wish u luck.
Eakle



Joined: 13 Mar 2006
Posts: 1

View user's profile Send private message MSN Messenger

PostPosted: Tue Mar 14, 2006 12:32 am     Reply with quote

Yeah!!! Finally I got it.......

Thanks very much to everyone.

After I changed my code as asmallri's comment, check my H/W and set Hyper terminal as Ahmed's comment, it's work.


Regards,
Eakle
_________________
PIC NEWBIES MAN....

Thanks everyone.
Guest








Circuit diagram
PostPosted: Thu Mar 16, 2006 2:29 am     Reply with quote

Can anybody help me to find a circuit diagram for PC to PIC16F877A
CCSADDiCT
Guest







PostPosted: Thu Mar 16, 2006 3:45 am     Reply with quote

dude...do some searching before u post...

http://ccsinfo.com/forum/viewtopic.php?t=25905&sid=9edce340a703d7aafca7114ba01cd7a0
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group