Actually, i want to tell clearly my problem so ,that iam elaborating...please
read till the end.........
Actually i am configuring my system baud rate(RS232) t0 19200,8 data bits,1 stop
bits,no parity.....
and based on the reset values......
MSEL[5:0]=0x0A; and for BF533 EZkit lite kit CLKIN'Mhz..
so, VCO CLK is:0x0A*27'0MHz...
and on the reset the SCEl=0x05 and DF=0; so,SCLK=VCO/5TMHz.........
Based on the formula Baud rate=SCLK/(16*divisor);
19200T*10^6/(16*divisor);
i found divisor 6(APProximately);
and the program is like this:
i want to first configure serial port 19200,8,1,no
so,UART_LCR=0x0083;//enabling DLAB to access DLL and DLH registers
*pUART_DLL=0x00b0;// 176;
*pUART_DLH=0x0000;
then making DLAB clear so,that i can access THR and RBR registers..
and i want to use polling here not the interrupts so, uam dissabling the
interrupts...
just i want to send @ to the BF533 then it will send 'B'..
After wards whatever i will send from system it has to return it....
#include
//#include
void serialin()
{
*pUART_LCR=0x0083;
*pUART_DLL=0x00b0;
*pUART_DLH=0x0000;
*pUART_LCR=0x0003;
}
void main()
{
int a;
serialin();
*pUART_GCTL=0x0001;
*pUART_IER=0x0000;
//polling for whether dat ready signal
//is set or not
while(((*pUART_LSR) & 0x0060) == 0x0060 );
if ((*pUART_RBR)==0x0040)
{
*pUART_THR='B';
while(((*pUART_LSR) & 0x0040) == 0x0040 );
while(1)
{
while(((*pUART_LSR) & 0x0060) == 0x0060 );
a=*pUART_RBR;
*pUART_THR=a;
while(((*pUART_LSR) & 0x0040) == 0x0040 );
}
}
}
Serial port(UART problem) for the new comer
Started by ●July 26, 2007
Reply by ●July 26, 20072007-07-26
And what's your problem?
--- In a..., malli_1729@... wrote:
>
> Actually, i want to tell clearly my problem so ,that iam
elaborating...please read till the end.........
> Actually i am configuring my system baud rate(RS232) t0 19200,8
data bits,1 stop bits,no parity.....
>
> and based on the reset values......
>
> MSEL[5:0]=0x0A; and for BF533 EZkit lite kit CLKIN'Mhz..
> so, VCO CLK is:0x0A*27'0MHz...
>
> and on the reset the SCEl=0x05 and DF=0;
so,SCLK=VCO/5TMHz.........
>
> Based on the formula Baud rate=SCLK/(16*divisor);
> 19200T*10^6/(16*divisor);
> i found divisor 6(APProximately);
>
> and the program is like this:
> i want to first configure serial port 19200,8,1,no
> so,UART_LCR=0x0083;//enabling DLAB to access DLL and DLH registers
> *pUART_DLL=0x00b0;// 176;
> *pUART_DLH=0x0000;
> then making DLAB clear so,that i can access THR and RBR
registers..
>
> and i want to use polling here not the interrupts so, uam
dissabling the interrupts...
> just i want to send @ to the BF533 then it will send 'B'..
> After wards whatever i will send from system it has to return
it....
> #include
> //#include void serialin()
> {
> *pUART_LCR=0x0083;
> *pUART_DLL=0x00b0;
> *pUART_DLH=0x0000;
> *pUART_LCR=0x0003;
> }
>
> void main()
>
> {
>
> int a;
>
> serialin();
>
> *pUART_GCTL=0x0001;
>
> *pUART_IER=0x0000;
>
> //polling for whether dat ready signal
> //is set or not
> while(((*pUART_LSR) & 0x0060) == 0x0060 );
> if ((*pUART_RBR)==0x0040)
> {
> *pUART_THR='B';
> while(((*pUART_LSR) & 0x0040) == 0x0040 );
>
> while(1)
> {
> while(((*pUART_LSR) & 0x0060) == 0x0060 );
> a=*pUART_RBR;
> *pUART_THR=a;
> while(((*pUART_LSR) & 0x0040) == 0x0040 );
> }
>
> }
> }
>
--- In a..., malli_1729@... wrote:
>
> Actually, i want to tell clearly my problem so ,that iam
elaborating...please read till the end.........
> Actually i am configuring my system baud rate(RS232) t0 19200,8
data bits,1 stop bits,no parity.....
>
> and based on the reset values......
>
> MSEL[5:0]=0x0A; and for BF533 EZkit lite kit CLKIN'Mhz..
> so, VCO CLK is:0x0A*27'0MHz...
>
> and on the reset the SCEl=0x05 and DF=0;
so,SCLK=VCO/5TMHz.........
>
> Based on the formula Baud rate=SCLK/(16*divisor);
> 19200T*10^6/(16*divisor);
> i found divisor 6(APProximately);
>
> and the program is like this:
> i want to first configure serial port 19200,8,1,no
> so,UART_LCR=0x0083;//enabling DLAB to access DLL and DLH registers
> *pUART_DLL=0x00b0;// 176;
> *pUART_DLH=0x0000;
> then making DLAB clear so,that i can access THR and RBR
registers..
>
> and i want to use polling here not the interrupts so, uam
dissabling the interrupts...
> just i want to send @ to the BF533 then it will send 'B'..
> After wards whatever i will send from system it has to return
it....
> #include
> //#include void serialin()
> {
> *pUART_LCR=0x0083;
> *pUART_DLL=0x00b0;
> *pUART_DLH=0x0000;
> *pUART_LCR=0x0003;
> }
>
> void main()
>
> {
>
> int a;
>
> serialin();
>
> *pUART_GCTL=0x0001;
>
> *pUART_IER=0x0000;
>
> //polling for whether dat ready signal
> //is set or not
> while(((*pUART_LSR) & 0x0060) == 0x0060 );
> if ((*pUART_RBR)==0x0040)
> {
> *pUART_THR='B';
> while(((*pUART_LSR) & 0x0040) == 0x0040 );
>
> while(1)
> {
> while(((*pUART_LSR) & 0x0060) == 0x0060 );
> a=*pUART_RBR;
> *pUART_THR=a;
> while(((*pUART_LSR) & 0x0040) == 0x0040 );
> }
>
> }
> }
>