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

wrong communication data transfer
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

wrong communication data transfer
PostPosted: Wed Jul 21, 2004 12:41 pm     Reply with quote

I have used
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
int8 val1;
val1=235;
printf("%2u",val1);

to sent data to serial port com1, and using the miscrosoft communication control 6.0 to receive dat, however, the data I reveived was strange character, what might cause this problem?
Guest








PostPosted: Wed Jul 21, 2004 1:41 pm     Reply with quote

any hint?
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Jul 21, 2004 2:10 pm     Reply with quote

Could you at least tell us what the strange character was, preferably the binary value?
_________________
The search for better is endless. Instead simply find very good and get the job done.
Guest








PostPosted: Wed Jul 21, 2004 2:27 pm     Reply with quote

Following is my RS232 testing file,
after download the file to the chip. I tried to monitor the result using serial port monitor under CCS PCW compiler, all data are zero, what is wrong with this program?


Code:


#if defined(__PCM__)
#include <16F877A.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)  // Jumpers: 8 to 11, 7 to 12
//I connected RX to RC7, TX to RC6

void main() {
   BYTE value;
   int val1;
   setup_port_a(ALL_ANALOG);
   setup_adc( ADC_CLOCK_INTERNAL );

   do {
     set_adc_channel( 1 );
     delay_us(50);
     val1 = Read_ADC();
     printf("%u\r\n",val1);
      delay_ms(1000);
   } while (TRUE);
}
Guest








PostPosted: Wed Jul 21, 2004 2:43 pm     Reply with quote

I could not type the character, it looks like the 0b11100001 in windows screen. however all 0 when I use the serial monitor. in order to find out what is wrong step by step, I made the above program only ccs and same result, what is wrong with the ccs c program? maybe after I find out problem here, I could go another step to vc programming.
valemike
Guest







Check your hardware
PostPosted: Wed Jul 21, 2004 2:51 pm     Reply with quote

Code:

#include <18F448.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

void main() {
   BYTE value;
   int val1;
   setup_port_a(ALL_ANALOG);
   setup_adc( ADC_CLOCK_INTERNAL );

   do {
     set_adc_channel( 1 );
     delay_us(50);
     val1 = Read_ADC();
     printf("%u\r\n",val1);
      delay_ms(1000);
   } while (TRUE);
}


My output looked like:

Code:

111
112
112
112
112
112
112
112
111
112
111
111
112


No garbage characters when I printed it out. Check your hardware to make sure your connections are correct. I used Hyperterminal to print my chars out... (9600-8-N-1)
Guest








PostPosted: Wed Jul 21, 2004 2:53 pm     Reply with quote

after I changed the baud rate it is now showing F0 00 00 00 00 00 F0 00 00, I also changed printf("%u\r\n",val1) to printf("%u",val1)
Ttelmah
Guest







PostPosted: Wed Jul 21, 2004 2:56 pm     Reply with quote

Anonymous wrote:
after I changed the baud rate it is now showing F0 00 00 00 00 00 F0 00 00, I also changed printf("%u\r\n",val1) to printf("%u",val1)

How are you connecting the serial?.

Best Wishes
Guest








PostPosted: Wed Jul 21, 2004 3:02 pm     Reply with quote

When I use my original program, it is showing F0 00 00 F0 F0 F0 00 00 F0 00, F0 00 00 00 00 f0 00, 00 00 00 f0 00 00 00 00, 00 00 00 00 f0 00 f0 00 00.
Guest








PostPosted: Wed Jul 21, 2004 3:06 pm     Reply with quote

I connected com1 with RS232 port on my PICeasy2 board, and RX was connected with RC7, TX was connected with RC6?
Guest








PostPosted: Wed Jul 21, 2004 3:13 pm     Reply with quote

what you mean hyperterminal, I do not know the word yet. is it the serial monitor in PCW IDE
Guest








PostPosted: Wed Jul 21, 2004 3:22 pm     Reply with quote

Ok, I found hyperterminal.
Guest








PostPosted: Wed Jul 21, 2004 3:33 pm     Reply with quote

when I use hyperterminal, there is nothing happened?
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Wed Jul 21, 2004 4:26 pm     Reply with quote

any further help?
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Jul 21, 2004 5:58 pm     Reply with quote

Are you using a RS232 transceiver chip like a Max232 between the PC serial port and the PIC?
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, 3  Next
Page 1 of 3

 
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