View previous topic :: View next topic |
Author |
Message |
apl01
Joined: 18 Dec 2007 Posts: 18
|
|
Posted: Sun Dec 23, 2007 7:10 pm |
|
|
Yes i have. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Sun Dec 23, 2007 7:41 pm |
|
|
Replace
Code: |
if(getc()==0x10) // DLE (¿....?)
|
for
Code: |
if(getc()==10) // CR Carriage Return
|
then your code will be expecting the Enter key (CR+LF) sending from your PC.
Did you made all the modifications suggested by PCM Programmer?
Humberto |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Dec 24, 2007 7:03 am |
|
|
Quote: | i can recieve data from the PIC to the PC with the program below but garbage appears on the termianl rather than Hello World? | Sounds like a hardware or configuration problem.
- Check the output voltage levels of the MAX232. Especially the negative voltage, it should be between -3V and -15V.
- Check the baudrate settings in your terminal program.
If these checks didn't help it is possible your PIC is not running at exactly 4MHz, for example because the calibration value of the internal oscillator is deleted. This is harder to check and a good digital oscilloscope or frequency counter comes handy. Alternatively try running the PIC with an external crystal. |
|
|
apl01
Joined: 18 Dec 2007 Posts: 18
|
|
Posted: Wed Dec 26, 2007 3:42 am |
|
|
I tried:
if(getc()==10) // CR Carriage Return
but same problem.
The output voltages and baudrate settings are ok. Unfortunantly i cant use a crystal in my circuit. Has anyone been able to print Hello world to the terminal without a crystal??
I have a couple of questions:
-What are the wire colours Tx, Rx and gnd pins on a serial cable?
-In the terminal window am i suppose to open my program?
-Do the configuration tab or control line tabs need to be set to something specific?
Thanks for your help. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Dec 26, 2007 1:07 pm |
|
|
I tested the following program and it works. It displays this in the
terminal window. I turned the power on/off four times to get this result.
Quote: |
Hello World
Hello World
Hello World
Hello World
|
This program was compiled with vs. 4.064.
Code: | #include <12F675.h>
#fuses INTRC_IO, NOWDT, NOMCLR, PUT, BROWNOUT
#use delay(clock=4000000)
#use rs232(baud=9600,xmit=PIN_A0, rcv=PIN_A1)
//===========================
void main()
{
printf("Hello World \n\r");
while(1);
} |
Quote: | What are the wire colours Tx, Rx and gnd pins on a serial cable? |
It could be any colors. You can't tell the pins that way. You must use
an ohmeter and measure the resistance between the DB9 pins and the
the ends of the wires. Then you can make a list of which color wire
goes to which pin. Use a magnifier to look closely at the plastic on
the DB9 connector. You can see the pin numbers. Example:
http://rocky.digikey.com/WebLib/Norcomp/Web%20Photos/171-009-203L001.jpg
(You may need to increase the brightness and/or gamma on your
monitor to see the pin numbers).
Quote: | In the terminal window am i suppose to open my program? |
No. A "terminal window" is a program by itself. You just run it.
Microsoft Windows has a terminal program included in it, called
HyperTerminal. This thread has instructions on how to use it: http://www.ccsinfo.com/forum/viewtopic.php?t=9253 |
|
|
apl01
Joined: 18 Dec 2007 Posts: 18
|
|
Posted: Thu Dec 27, 2007 3:18 am |
|
|
I could not get the 12f675 to work but i tried my 12f683s and had no problem. I have no idea why since i did everything the same as the 12f683. Thanks for your help. |
|
|
|