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

Serial Port monitor, taking wrong characters

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



Joined: 06 Apr 2011
Posts: 14

View user's profile Send private message

Serial Port monitor, taking wrong characters
PostPosted: Wed Apr 06, 2011 9:01 am     Reply with quote

Hello,

I'm trying to send some simple printf commands, but there is something wrong about settings i think.

here is my code:

Code:

#include <16F877.h>
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES xt                     
#FUSES NOPUT                    //No Power Up Timer
#FUSES PROTECT                  //Code protected from reads
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected
#FUSES NODEBUG                  //No Debug mode for ICD

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



void main()
{
   printf("Hello World, please");
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
 

 
while(TRUE)

}


I see on the screen " Nenno>Wornf, *neyse"

When i try to send " battery" i saw rottery and it was changing. sometime "bottery" and sometimes "battery"
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Wed Apr 06, 2011 9:34 am     Reply with quote

Have you got a good earth connection?.
What is generating you processor clock.

Best Wishes
Grkan13



Joined: 06 Apr 2011
Posts: 14

View user's profile Send private message

PostPosted: Wed Apr 06, 2011 9:43 am     Reply with quote

i'm using http://www.alldatasheet.net/datasheet-pdf/pdf/35051/POWER-ONE/MAP55-4001.html for power connection and its grounding.

I tried 20Mhz and 4Mhz crystals but result didn't change
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Wed Apr 06, 2011 10:01 am     Reply with quote

What is the PCB layout round the crystals, what loading capacitance are they meant to have, what capacitors were you using?. Your link gives no details of how you are linking the serial ground, which is what 'matters' for the communication.
Your fault is classic for a connection not having both wires for the connection (the data line and the ground), properly connected, or the USART clock is unreliable.
Also what are you using for the level translation on the connection?.

Best Wishes
Grkan13



Joined: 06 Apr 2011
Posts: 14

View user's profile Send private message

PostPosted: Wed Apr 06, 2011 10:57 am     Reply with quote

I'm using a breadboard. My capacitors for the crystals are 22pf ceramic.

There are 5 pins on the power connector, +5V, GND, +24V, -12V, +12V. I've just connected the +5V and +12V to the my breadboard with a cable.

Hmm I think the problem is not connecting properly on the rs-232 connector, I will try to change it. Because when I order they send me wrong connector, I have a female without pins. Male connector's pins and my data and ground cables are just touching each other in holes.
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