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

Printing out the info (printf) from your PIC using RS232

 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
sonicdeejay



Joined: 20 Dec 2005
Posts: 112

View user's profile Send private message

Printing out the info (printf) from your PIC using RS232
PostPosted: Mon Feb 06, 2006 1:55 pm     Reply with quote

The following code and example is tested successfully,,,hope it will speed up your process....

cheers
sonic

You will need additional hardware connections to your PIC to get it done... You have 2 ways you can do it,,Both ways working fine for me anyway..

Using MAX232 (mostly used I guess)




Using 2 MOFETs and 2 resistors

You can use 10K resistors in place of the 2.2K. Complete details at http://www.botkin.org/dale/rs232_interface.htm if you want to read it.



and finally here is the code for you to test...
Code:


#include <18F2525.h>

#device ADC=10
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=16000000)
#use rs232(baud=9600, parity=N, xmit=PIN_C6, rcv=PIN_C7, bits=8)  // Jumpers: 8 to 11, 7 to 12



void main() {

 

      {
      output_high(PIN_C4); // LED ON
      printf("\r\n-----HELLO-----");
     
      delay_ms(1000);
      output_low(PIN_C4); // LED OFF
      } while(TRUE)
   
}
pattousai



Joined: 23 Aug 2006
Posts: 37

View user's profile Send private message

PostPosted: Wed Sep 27, 2006 8:14 am     Reply with quote

well, i already see some example code for communication by the serial port. and i guess that you guys mean to connect the pic in the PC, am i right?

so, i always wondering, i don't need any program in the pc to do it?? i always see the pic part. its just connect to the serial port in the pc and the "hello" will show?? well, i guess not, sorry if i'm wrong.


thanks, hope that someone can help me to figure out!!
gs



Joined: 22 Aug 2005
Posts: 30
Location: Ioannina - Greece

View user's profile Send private message Visit poster's website

PostPosted: Wed Sep 27, 2006 4:05 pm     Reply with quote

You may use HyperTerminal to view the recieved data. It is in the accessories-> communications menu on you computer. Make a new connection and direct it to the com port you have your device connected
_________________
www.hlektronika.gr
pattousai



Joined: 23 Aug 2006
Posts: 37

View user's profile Send private message

PostPosted: Wed Sep 27, 2006 5:11 pm     Reply with quote

ahhnnn, ok. thanks!!!


humm, and if i want to do the opposite way?? send a data from the pc to the pic?? is that simple too??


thanks once again!!
hanhao



Joined: 21 Mar 2007
Posts: 24

View user's profile Send private message

PostPosted: Mon Mar 26, 2007 2:03 am     Reply with quote


sadly this doesnt work for me using 687


the top graph shows the serial output at pin2 of D9 connector
the bottom graph shows the output from the chip

i used 2SK3019 NMOS
http://www.datasheetcatalog.com/datasheets_pdf/2/S/K/3/2SK3019.shtml

perhaps because i used a different schematic, i pulled R1 to high and not connected to D9
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library All times are GMT - 6 Hours
Page 1 of 1

 
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