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

the problem of my code.

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







the problem of my code.
PostPosted: Tue Jul 08, 2008 6:29 pm     Reply with quote

Hello,

I am using PIC16f877.

I got two problem.
First of all. the compiler told me that "Line 3(5,47): Baud rate out of range" but I think that the baud rate 9600 is not out of the range. Am I right?

My code is following:

__________________________________________________

#include <16F877.h>
#use delay(clock=100000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#define BUFFER_SIZE 18

void main()

{
char szAddr[BUFFER_SIZE];
int nBytesRead;


puts("get address\r");
delay_ms(1);
printf("the device address is %S", szAddr);
}

______________________________________________________

The second problem:

I am trying to send a string to my wireless device by TX but I do not know how to control it. I mean that I need to send a command which is only for the wireless device to control it to make this device to connect to another one. How can I know that this command has already sent to TX? Do I need point out the specific PIN such as PIN_C6?

I am really really new on the C and Microcontroller.

Any help will be really appreciated!



Thank you very much.



Sincerely,



Brian
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Re: the problem of my code.
PostPosted: Tue Jul 08, 2008 6:58 pm     Reply with quote

The compiler is right. You said the clock is 100,000. That is very slow. The clock is used to generate the baudrate. So 9600 baud would be OK if you are using a much higher clock.
_________________
Robert Scott
Real-Time Specialties
Embedded Systems Consulting
Lion
Guest







the problem of my code
PostPosted: Wed Jul 09, 2008 1:08 am     Reply with quote

Hello RLScott,

It works now. Thank you for your reply.
The first problem is solved.
Does anyone have suggestion for second problem?
Any help is appreciated.
Thank you very much.
Sincerely,
Brian
SherpaDoug



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

View user's profile Send private message

PostPosted: Wed Jul 09, 2008 8:51 am     Reply with quote

As written any serial output will go to pin C6. Is this what you want? Do you have one serial stream to a terminal and another to the wireless? If so you need to use "streams" with your #use RS232 statements.
_________________
The search for better is endless. Instead simply find very good and get the job done.
pdl



Joined: 01 Jun 2005
Posts: 45
Location: UK

View user's profile Send private message

PostPosted: Wed Jul 09, 2008 9:14 am     Reply with quote

It would help if you told us what wireless device you was using.

Pete
Lion
Guest







the problem of my code
PostPosted: Wed Jul 09, 2008 12:35 pm     Reply with quote

Hello,

Thank you guys' kindness.

I am using PIC16f877 and MPLAB v8.10 with CCS.

I try to use PIC16f877 (PIC A) to control a bluetooth by USART and to communicate with another PIC (PIC B )which also has a bluetooth device on it.

My question is that I need to send some command to bluetooth such as "get address" which is to get the address of bluetooth or "con 00:8A:16:7C:89:7L" which is a command to connect to the other bluetooth.
I do not know how to send the string to bluetooth TX (PIN_C6) in PIC A or get a string from RX(PIN_C7) in PIC B.

I am really really new on C and PIC so could you tell me how to do that?

By the way, I knew the basic concept of stream but I have no idea how to use it with USART or how to write a code with it.
Could you guys kindly explain to me or give me some example to understand how to use it?

Any help will be really really appreciate.
Thank you very much.
Sincerely,
Brian
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