View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jan 19, 2007 10:43 pm |
|
|
Try a simple program below, that echoes back the characters that
you type in to the terminal window. It should work.
Code: |
#include <16F876A.h>
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
//============================
void main()
{
char c;
while(1)
{
c = getc();
putc(c);
}
} |
|
|
|
lsteele
Joined: 02 Jan 2007 Posts: 18
|
|
Posted: Sat Jan 20, 2007 3:24 am |
|
|
Ok, that worked! Thanks.
I'm now going to go step by step adding to your program until I locate the difference that's preventing my version from working. |
|
|
canuck Guest
|
hyperterminal vs. B&B COM test |
Posted: Sat Feb 10, 2007 10:34 am |
|
|
I have also been having problems using getc() with Hyperterminal. When I press a key it seems to bog down, but nothing is echoed back to the screen. Other print statements work fine.
When I use "B&B COM Test" v1.0 everything works fine.
code:
#include <16F877.h>
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
//============================
void main()
{
char c;
while(1)
{
c = getc();
putc(c);
}
} |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Sat Feb 10, 2007 5:39 pm |
|
|
I've had many communication problems related to Hyperterminal. Please save yourself a lot of time and get a decent terminal emulator program.
For example use Siow.exe, provided with your CCS compiler. |
|
|
meereck
Joined: 09 Nov 2006 Posts: 173
|
|
Posted: Sat Feb 10, 2007 7:05 pm |
|
|
ckielstra wrote: | I've had many communication problems related to Hyperterminal. Please save yourself a lot of time and get a decent terminal emulator program.
For example use Siow.exe, provided with your CCS compiler. |
I really like this one : http://bray.velenje.cx/avr/terminal |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Feb 10, 2007 11:44 pm |
|
|
There are improved versions of HyperTerminal.
http://www.hilgraeve.com/htpe/index.html
Readme file:
Scroll down to the versions list.
http://www.hilgraeve.com/support/readmes/htpe.html
I've used version 5.0. It looks like they now have a later version.
I'm not saying it's better than the other terminal programs. It's
probably not. But if you did want to have HyperTerminal on your
system and use it occasionally, it's probably better to use this improved
"Private Edition" version. |
|
|
canuck Guest
|
Thanks |
Posted: Tue Feb 13, 2007 4:59 pm |
|
|
Thanks for your suggestions everyone. |
|
|
Guest
|
Hmmm... |
Posted: Mon Mar 26, 2007 5:15 pm |
|
|
I'm using a PIC18F4550, and neither gets() or getc() work at all. They continue to just hang.
I've tried everything mentioned here.
I have the proper line driver, etc. For some reason, sometimes it works while other times it won't work. Output is no problem, it's just the input.
Even something as simple as this doesn't work:
#include <18F4550.h>
#device adc=8
#FUSES HS,NOLVP,NOWDT,PUT
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
void main(void)
{
char key;
printf("This works.\n\r");
key=getc();
putc(key);
printf("We've finally allowed you to get here.\n\r");
} |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Mar 26, 2007 5:31 pm |
|
|
If putc() works and getc() doesn't work, check the wiring.
Is this a board that you built yourself, or is it a manufactured demo board ? |
|
|
michellelicious
Joined: 15 Apr 2007 Posts: 3
|
To PCM programmer |
Posted: Tue May 08, 2007 8:45 pm |
|
|
PCM programmer wrote: | Try a simple program below, that echoes back the characters that
you type in to the terminal window. It should work.
Code: |
#include <16F876A.h>
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
//============================
void main()
{
char c;
while(1)
{
c = getc();
putc(c);
}
} |
|
This does not work for me!!! But why? The code is simple. I can only receive FROM PIC but the pic itself is not getc()ing anything.
CCS 4.013
PIC16f877 and 16f877a
Max232
Hyperterminal and Serial Port monitor
Thanx for any response |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue May 08, 2007 9:40 pm |
|
|
I don't have 4.013, but I do have 4.014. I tested it just now with that
verison, with a 16F877 and a PicDem2-Plus board. It works. It probably
also works with 4.013, because this type of simple program is likely what
CCS used to do some sort of pass-fail test on the version.
If you built your own board, then buy a pre-made board from some company. If you're using Proteus, then buy a real hardware board.
If you built your own serial cable, then buy a cable. |
|
|
|