Keil™, An ARM® Company

Discussion Forum

How can i set the serial baud rate

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
shyam krishnan
Posted
4-Aug-2008 04:55
Toolset
C51
New! How can i set the serial baud rate

Please help me in setting the baud rate in 89c51.I am doing project in 8051 which is a message transmitter.What i mean is there are two blocks
in my project one is transmitter And other is receiver.

The transmitter consist of 64 keys which is obtained by 8*8 matrix key board.I am aiming
for A to Z alphabets & 0 to 9 no.

After decoding which key is pressed
i has to transmit the pressed key which will display on the receiver.I am planing to use 433Mhz transmitter & receiver the problem is that the transmitter and receiver has only 20kbps speed so i has to reduce the baud rate considerably.

Read-Only
Author
Per Westermark
Posted
4-Aug-2008 05:48
Toolset
C51
New! RE: How can i set the serial baud rate

If the 433MHz equipment is connected to the serial port, then any sample RS232 application should show you how to set the speed of the serial port.

Have you been looking?

Read-Only
Author
natgash slimkersh
Posted
4-Aug-2008 06:00
Toolset
C51
New! RE: How can i set the serial baud rate

this is the code i use for the serial


void Send_Character ( unsigned int Array [] )
$(SRC)
{
        PUSH    ACC           ; store accumulater onto stack
        MOV     P, ACC.3      ; get the bit for later
        PUSH    B             ; store the other data
}
        theByte = Array[1];   ; get the data from calling code
$(SRC)
{
        MOV     ACC, theByte  ; get the only byte
        MOV     SBUF2, theByte ; store it to uarter
}

        Array = Array + 3;     ; add to next bit for later

$(SRC)
{
        POP     ACC          ; get the accumulater back
}

        return DONE_IT;
}
Read-Only
Author
erik malund
Posted
4-Aug-2008 06:15
Toolset
C51
New! RE: How can i set the serial baud rate

How can i set the serial baud rate

this is the code i use for the serial

which does not set the baudrate

Erik

Read-Only
Author
Jack Sprat
Posted
5-Aug-2008 05:29
Toolset
C51
New! RE: How can i set the serial baud rate

How can i set the serial baud rate

this is the code i use for the serial

which does not set the baudrate

Perhaps you'd like to actually answer the OP's question rather than just stating the obvious?

Read-Only
Author
Andy Neil
Posted
4-Aug-2008 11:46
Toolset
C51
New! RE: this is the code i use for the serial

As all the actual functional code is in assembler, what on earth is the point of wrapping it all in 'C'?

If you want to write assembler, just do it - don't dress it up as 'C'!

Read-Only
Author
Jeff Dunn
Posted
4-Aug-2008 12:47
Toolset
C51
New! RE: this is the code i use for the serial

shyam krishnan,

Do not even consider using the code example from natgash slimkersh - Unless you want to examine it to see how not to write code.

There are numerous comments I could write about it, but I think the worst has to be that the assembler pushes ACC and B on entry and only pops ACC on exit.

However, I remember evaluating a very old version of the Keil C compiler which produced very similar code to that - And that was before optimization was enabled!

Glad to see things have improved on that front.

Read-Only
Author
Andy Neil
Posted
4-Aug-2008 12:29
Toolset
C51
New! RE: any sample RS232 application should show you how to set the speed of the serial port

and that would include the "Hello, World" examples...

Read-Only
Author
ninja Z
Posted
5-Aug-2008 03:09
Toolset
C51
New! Talk about something about your transceiver!

433Mhz transmitter & receiver the problem is that the transmitter and receiver has only 20kbps speed so i has to reduce the baud rate considerably

These ambiguous words didn't quite descript your transceiver. You thought you have to reduce the baudrate, how could you reduce it while you havn't set it up at all?

Read-Only
Author
Per Westermark
Posted
5-Aug-2008 05:37
Toolset
C51
New! RE: Talk about something about your transceiver!

Jack: The OPs question has been answered - unless the OP has connected the RF transceiver in some other way. In that case, the OP has to come back and tell why the RS232 sample code is not relevant.

When people do post irrelevant source code to a thread, it can't be considered off-topic to note that the code isn't relevant.

By the way: I didn't notice any baudrate answers from you, so you must consider off-topic answers to be on-topic when you are the poster... But then again, your posts hardly ever help any requester on this forum, since helping people is not on your agenda.

Read-Only
Author
Jack Sprat
Posted
5-Aug-2008 06:22
Toolset
C51
New! RE: Talk about something about your transceiver!

When people do post irrelevant source code to a thread, it can't be considered off-topic to note that the code isn't relevant.

I don't recall saying anything about topicality.

By the way: I didn't notice any baudrate answers from you, so you must consider off-topic answers to be on-topic when you are the poster

Again, topicality policing isn't my thing.

But then again, your posts hardly ever help any requester on this forum, since helping people is not on your agenda.

There are some people who post irrelevant, misleading or, as in this case, downright unhelpful bandwidth clutter. My attempts to reduce the quantity of this sort of stuff seem to have been at least partially successful recently so it seems worth persevering. Sadly I don't have enough time on my hands to do offer a free advice service as well, luckily there are a few such as yourself who do.

Read-Only
Author
erik malund
Posted
5-Aug-2008 06:52
Toolset
C51
New! RE: Talk about something about your transceiver!

http://www.keil.com/c51/baudrate.asp

Next Thread | Thread List | Previous Thread Start a Thread | Settings