piclist 2000\06\02\111128a >
Thread: Several baud rate of RS232C (CCS C) [Was: Re: Several baud rate of RS232C (CCS C)]
www.piclist.com/techref/microchip/ios.htm?key=rs232
flavicon
face BY : David Kott email (remove spam text)



> Dear all,
>
> I'm trying to realize two types of baud rate at PIC16F873. The chip
> would convert between 9600bps serial data and 31250bps MIDI data
> described as following two definitions:
> #use RS232C(baud=9600,***)
> #use RS232C(baud=31250,***)
>
> I would like to know how does it work In case that simply "getchar()"
> or "putchar()" is called. Is it possible to use two asynchronous
> transmission and reception by using above definition? At present, PIN_C6
> and PIN_C7 are used for RS232C. The complier is CCS C.
>
> I appreciate if anyone who tried this kind of situations or who knows
> any information would let me know a resolution.
>
> Sincerely yours,
>
> Keishiro Tabe

CCS can indeed do this and there is example code in the "Common Questions
and Answers" section of your PCM manual.

See page 79 of your PCM/PCW manual (rev. July 1999) or the section named
"How can I use two or more RS-232 ports on one PIC?" in your table of
contents.

Basically, you place the #use RS232 directive before any printf(), putc(),
getc() or kbhit() function invocation you use.

for example:

void MyTrivialFunction(void) {

#pragma use RS232 (baud=9600, xmit=PIN_B0, rcv=PIN_B1)
     printf("Hi, this is serial port 1 talking to a PC at 9600.\r\n");
#pragma use RS232 (baud=31250, xmit=PIN_B2,rcv=PIN_B3)
     printf("Hello, Mr. MIDI device, how are you this fine morning?\r\n");
}

would send, at 9600 baud, a message to a terminal listening to RB<0>.  It
would also send a message to a MIDI device listening on RB<2> at 31.250
Kbps.

-d

<002901bfcca4$b9100180$810000c0@dkott> 7bit

See also: www.piclist.com/techref/microchip/ios.htm?key=rs232
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Several baud rate of RS232C (CCS C) [Was: Re: Several baud rate of RS232C (CCS C)]

month overview.

new search...