usart in mikroc pro
usart in mikroc pro
Hi
i want to use usart library in mikroc pro but it isn't available !!
i want to use usart library in mikroc pro but it isn't available !!
Re: usart in mikroc pro
Hardware USART library is available only for processors with appropriate hardware module. Did you check if the processor you chose has such a module?
Re: usart in mikroc pro
thank you for your reply ofcourse i use a pic18F4580 but the library usart is not available in mikroc pro and i talk about usart not uart
Re: usart in mikroc pro
The hardware peripheral for this processor is actually called EUSART - which doesn't influence the name of the library available in mC PRO. The library is named UART uniformly for all processors with hardware serial communication module.motahhir wrote:thank you for your reply ofcourse i use a pic18F4580 but the library usart is not available in mikroc pro and i talk about usart not uart
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: usart in mikroc pro
Hello,
Please see
MikroC Pro UART Library
http://www.mikroe.com/download/eng/docu ... ibrary.htm
Best regards,
Peter
Please see
MikroC Pro UART Library
http://www.mikroe.com/download/eng/docu ... ibrary.htm
Best regards,
Peter
Re: usart in mikroc pro
there is a difference between uart and USART !
uart: asynchronous
usart: synchronous
uart: asynchronous
usart: synchronous
Re: usart in mikroc pro
i talk about uart not usart !!
Re: usart in mikroc pro
i talk about uart not usart !!
Re: usart in mikroc pro
Actually, USART means UNIVERSAL SYNCHRONOUS ASYNCHRONOUS RECEIVER TRANSMITTER, so it's not just for synchronous communication. If you have specifically asked for synchronous communication library, there'd be no misunderstanding.motahhir wrote:there is a difference between uart and USART !
uart: asynchronous
usart: synchronous
UART library does work with USART (and EUSART) hardware modules but it's indeed dedicated to asynchronous communication.
Re: usart in mikroc pro
I asked for synchronous communication library
Re: usart in mikroc pro
There's no such library built into mC. You'll have to write your own, I'm afraid.
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: usart in mikroc pro
Hello,
As Janni said you need to write your own library, also check www.libstock.com
Best regards,
Peter
As Janni said you need to write your own library, also check www.libstock.com
Best regards,
Peter
Re: usart in mikroc pro
hi,
to begin, i want to say that my level in english is average, so forgive me for the mistakes..
i am a beginner in C programming and this is the first time i work with mikroC.
so i want to write a code and i need your help ..
the code should do the following :
first : PORTB.f0=1
when i send the letter 'c'
i must receive the data that is on the port 'RA0'
when i send again the letter 'c'
i must receive the data that is on the port 'RA1'
when i send again the letter 'c'
i must receive the data that is on the port 'RA2'
when i send again the letter 'c'
i must receive the data that is on the port 'RA3'
when i send again the letter 'c'
i must receive the data that is on the port 'RA5'
when i send again the letter 'c'
i must receive the data that is on the port 'RE0'
PORTB.f0=0
when i send the letter 'c'
i must receive the data that is on the port 'RA0'
when i send again the letter 'c'
i must receive the data that is on the port 'RA1'
when i send again the letter 'c'
i must receive the data that is on the port 'RA2'
when i send again the letter 'c'
i must receive the data that is on the port 'RA3'
when i send again the letter 'c'
i must receive the data that is on the port 'RA5'
when i send again the letter 'c'
i must receive the data that is on the port 'RE0'
now the code should return to the beginning and expected that i send the letter 'c'
---
I actually have this code
but it does not satisfy my need..
in this code, when i sent the letter 'c' i receive all data contained on ports..
could you help me modify this code or write one that works according to algorthme above?
to begin, i want to say that my level in english is average, so forgive me for the mistakes..
i am a beginner in C programming and this is the first time i work with mikroC.
so i want to write a code and i need your help ..
the code should do the following :
first : PORTB.f0=1
when i send the letter 'c'
i must receive the data that is on the port 'RA0'
when i send again the letter 'c'
i must receive the data that is on the port 'RA1'
when i send again the letter 'c'
i must receive the data that is on the port 'RA2'
when i send again the letter 'c'
i must receive the data that is on the port 'RA3'
when i send again the letter 'c'
i must receive the data that is on the port 'RA5'
when i send again the letter 'c'
i must receive the data that is on the port 'RE0'
PORTB.f0=0
when i send the letter 'c'
i must receive the data that is on the port 'RA0'
when i send again the letter 'c'
i must receive the data that is on the port 'RA1'
when i send again the letter 'c'
i must receive the data that is on the port 'RA2'
when i send again the letter 'c'
i must receive the data that is on the port 'RA3'
when i send again the letter 'c'
i must receive the data that is on the port 'RA5'
when i send again the letter 'c'
i must receive the data that is on the port 'RE0'
now the code should return to the beginning and expected that i send the letter 'c'
---
I actually have this code
Code: Select all
float rtdv, rtdr, temp, y;
int msd, isd, i;
char temperature[6];
char uart_rd;
calcule()
{
rtdv=rtdv *5/1024;
rtdv=rtdv/5;
rtdr=rtdv*1000.0/(5.0-rtdv);
y=0.15274-(rtdr-100.0)*0.0002310;
if (y>=0)y = sqrt(y);
temp = (y-0.39083)/(-0.0001155);
bytetostr(temp,temperature);
delay_ms(1);
}
affichage()
{
UART1_Write_Text(temperature);
strcpy(temperature,"");
}
void main()
{
TRISA = 0xFF;
TRISE = 0xFF;
TRISB = 0x00;
PORTB = 1;
UART1_Init(9600);
while(1)
{ portb.f1=1;
if (UART1_data_ready())
{
uart_rd = UART1_read();
if(uart_rd=='c')
{
PORTB.f0=1;
for (i=0; i<6 ;i++)
{
delay_ms(5);
rtdv=adc_read(i);
UART1_Write(13);
calcule();
affichage();
}
PORTB.f0=~portb.f0;
for (i=0; i<6; i++)
{
delay_ms(5);
rtdv=adc_read(i);
UART1_Write(13);
calcule();
affichage();
}
}
}
}
}
in this code, when i sent the letter 'c' i receive all data contained on ports..
could you help me modify this code or write one that works according to algorthme above?