View previous topic :: View next topic |
Author |
Message |
Eakle Guest
|
How to reading data from RS232 via Hyper Terminal |
Posted: Mon Mar 13, 2006 8:12 am |
|
|
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
|
|
Posted: Mon Mar 13, 2006 8:17 am |
|
|
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
|
|
Posted: Mon Mar 13, 2006 6:58 pm |
|
|
Thanks very much
I'll try this code.
Regards,
Eakle |
|
|
Ahmed
Joined: 07 Mar 2006 Posts: 19
|
Re: How to reading data from RS232 via Hyper Terminal |
Posted: Mon Mar 13, 2006 8:11 pm |
|
|
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
|
|
Posted: Tue Mar 14, 2006 12:32 am |
|
|
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 |
Posted: Thu Mar 16, 2006 2:29 am |
|
|
Can anybody help me to find a circuit diagram for PC to PIC16F877A |
|
|
CCSADDiCT Guest
|
|
|
|