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 support@ccsinfo.com

Voltage level/ serial communications general Q
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Dec 08, 2008 2:48 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Dec 08, 2008 3:08 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Dec 08, 2008 3:23 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Dec 08, 2008 3:56 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Dec 08, 2008 4:38 pm     Reply with quote

SUCCESS.
With an Olimex proto board, all is well.

Thanks very much for help today.
~Nora
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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