View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Dec 08, 2008 2:48 pm |
|
|
Use this program. Any characters that are typed into the terminal
program will be sent to the PIC, and the PIC will then send them
back to the terminal program where they will be displayed.
Code: |
#include <18F452.H>
#fuses HS, NOWDT, NOPROTECT, PUT, BROWNOUT, NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
//=================================
void main()
{
char c;
printf("Start: ");
while(1)
{
c = getc();
putc(c);
}
} |
|
|
|
Nora
Joined: 23 Mar 2008 Posts: 50
|
|
Posted: Mon Dec 08, 2008 3:08 pm |
|
|
Thanks for the program, PCM.
With your program copied and pasted exactly, I get "p" back from my typed character. If I check echo local characters, I get for example "yp". If I uncheck this setting I get "p".
*forgot to mention: ICD 2 is unplugged as is laptop mouse. Nothing attached but USB to serial cable. The ICD 2 was def interfering in some way too, I got LED blinks just from plugging and unplugging it.
The PICDEM board is separately powered from power supply.
So it is probably not the code.
Could either be the cable or the PICDEM board.
I can possibly eliminate/identify the PICDEM board. I have an old Olimex P-40 proto board. RX and TX on the MAX are not connected to the PIC. Does RX go to TX from PIC to the MAX or RX to RX? Does the inverting happen inside the MAX chip or is it how I wire it? I am going to try this with that board, if I can get it running.
Maybe the cable is supposed to be inverted...like a crossover cable where 2 goes to 3 and vice versa. I never wrapped my head around the converter cable hardware.
Thanks very much!
N_N |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Dec 08, 2008 3:23 pm |
|
|
I don't know. I have a USB-to-RS232 converter cable from Siig.
I connected it between my PicDem2-Plus board and an XP machine.
I started up Hyperterminal and set it for COM3 (on that computer,
that's where the USB cable is allocated). I set Hyperterminal for
9600, N, 8, 1, and no handshaking. It worked. It works fine. |
|
|
Nora
Joined: 23 Mar 2008 Posts: 50
|
|
Posted: Mon Dec 08, 2008 3:56 pm |
|
|
It must be the PICDEM Plus. I have the ROHS version, PCM, as I remember you have an older version.
I tried the same setup on another computer, one with a true serial port, so I just used a regular straight through serial cable.
Same thing with the "p".
BBL
Nora |
|
|
Nora
Joined: 23 Mar 2008 Posts: 50
|
|
Posted: Mon Dec 08, 2008 4:38 pm |
|
|
SUCCESS.
With an Olimex proto board, all is well.
Thanks very much for help today.
~Nora |
|
|
|