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 CCS Technical Support

PIC18F4550 sending data to the PC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
cootemca



Joined: 30 Jul 2014
Posts: 2

View user's profile Send private message

PIC18F4550 sending data to the PC
PostPosted: Wed Jul 30, 2014 8:55 pm     Reply with quote

Good evening, my question is, how to make a program sending data from PIC18F4550 to a PC. Please show me an example.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jul 30, 2014 10:36 pm     Reply with quote

Code:

#include <18F4550.h>         
#fuses INTRC_IO, NOWDT, PUT, BROWNOUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

//====================================
void main()
{
printf("Hello World\n\r");

while(1);
}
 
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Thu Jul 31, 2014 1:16 am     Reply with quote

Smile

I suspect he might be wanting to use USB (since he is using the 4550). So perhaps ex_usb_serial.c
cootemca



Joined: 30 Jul 2014
Posts: 2

View user's profile Send private message

Send data from PIC to PC with PIC18F4550
PostPosted: Thu Jul 31, 2014 8:55 pm     Reply with quote

You're absolutely right, the idea is to use usb_put_packet() and send data
byte by byte.
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Fri Aug 01, 2014 12:57 am     Reply with quote

You don't need to fiddle with put_packet. As I said, look at ex_usb_serial (and the other versions). These generate a CDC device, and send the data byte by byte, but buffer this through usb_putc/getc, so you can simply printf a message and it is all sent for you.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion 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