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

RS232 problem with Internal Oscillator

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



Joined: 05 Oct 2007
Posts: 31

View user's profile Send private message

RS232 problem with Internal Oscillator
PostPosted: Thu Jan 17, 2008 5:44 pm     Reply with quote

Hi,
I'm having some trouble with getting my printf command working. I'm using a PIC18LF6722 (the low power version). I'm using the internal osciallator at 4MHz. I do not have a serial driver such as a MAX232. The RX and TX go straight from the PIC to the serial port. All I get on the output is some garbage. Here's the code:

Code:

#include <18F6722.h>
#device ADC=10
#include <stdio.h>
#include <math.h>
#include <ctype.h>
#include <stdlib.h>

#fuses INTRC,NOWDT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, parity=N, bits=8)

void main(void)
{
printf("Hello World");
}


I know the MAX232 inverts the serial pins, but since I didn't have one, I used the invert parameter in the *use rs232 directive, but the complier complained with the following command:

USE parameter value is out of range H/W USART can not invert

Any suggestions what I'm missing?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 17, 2008 6:03 pm     Reply with quote

Quote:

I know the MAX232 inverts the serial pins, but since I didn't have one, I used the invert parameter in the *use rs232 directive, but the complier complained with the following command:


See the sample #use rs232 statement in this thread.
http://www.ccsinfo.com/forum/viewtopic.php?t=26607

See these threads for more about the 22K series resistor on the Rx pin
of the PIC (when using a software UART directly connected to the PC):
http://www.ccsinfo.com/forum/viewtopic.php?t=32568
http://www.ccsinfo.com/forum/viewtopic.php?t=28707
cypher



Joined: 05 Oct 2007
Posts: 31

View user's profile Send private message

PostPosted: Thu Jan 17, 2008 6:32 pm     Reply with quote

Thanks! That worked. I don't have a 22K, but a 1K in series. But it works.
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