Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help me in mikroC usart

Status
Not open for further replies.

suwaii

Member level 4
Joined
Jan 21, 2006
Messages
68
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,830
usart mikroc

hi



i try to use PIC18F452 to send data to hyperterminal but i do not
get anything . I user hyperterminal in the mikroC compiler and i put
it in the HEX display but i do not get any thing may be the mistake
come from code.....can any one tell me what is the problem in this code
and correct it even itry to use code of example of usart in the mikroC help
but without result:


void main()
{
int chunk = 0x1E;

TRISC = 0b10101111;
SPBRG = 0b00011001;
TXSTA = 0b00100100;


do {
Usart_Write(chunk);
} while (1);


}
 

mikroc usart

what is chunk?
and know you do not need to initialize SPBRG just write Usart_init(9600);
it initialize at 9600 baud remember u must have set the same bausd for ur terminal
 

mikroc uart

hi,

because I am curious Please tell me if you use easypic3 board... I have done a project like you want and it works.
I can sent it to you if you want and you can change it as you want!


B.
 

microc usart hardware

you mean i should use easypic3 board to wok........................
i connect the pic with max232 and from max232 to PC and i use hyper terminal in the Pc and also the hyper that is in the mickroO compiler still i get nothing even if i use same example in the help in the mikroC but not work tell me wht is the correct circuit....................i heard you should use put and print function
 

mikroc usart example

so.....

check from www.mikroe.com the circuits from boards in order to be sure how you should do the connections.

and take the source in microC.
 

usart1 mikroc

also, let me know what happen!

Good LUCK!
 

mikroc printf

still i get nothing.........i comile your code in the attachment i get nothing
did you try it by your self and do we need to use may be put or printf function

thanks
 

usart_write

the code works perfect.

may be you should change the ports depends on your hardware.
Also, are you sure about your connections?

B.
 

usart in mikroc

which port & pin you send the the data from the pic to PC

what i know the pic18f452 has TX/RX in the portC
 

uart interrupt mikroc

I don't remember but check the manual from your Pic.
 

Hi all,
I also want to parse ASCII(AT Commands) to GSM modem through serial connection?
Pls help me also with simple mikroC example and Hardware configuration.
 

I'm also facing the similar problem. Have you found the way to solve this problem?
 

Need help USART programming in MikroC

I'm using microchip PIC18f452. I'm looking for a way to perform communication between my PIC and PC. I'm testing the communication by using the example code from mikroC as shown below. However, I found that the result I obtained in PC were different from what were expected. For example, if I set the data to be sent as number in dec, when I send 1, I would get 255(expected to get 1); when send 2, the result would be 242(expected to get 2) and so on. Can someone tell me why I cant get the expected result? It there any problem with this code? I'm looking for your kindly help, please.

Code :
unsigned short i;

void main() {
USART_init(19200); // initialize USART module
// (8 bit, 19200 baud rate, no parity bit...)
while (1) {
if (USART_Data_Ready()) { // if data is received
i = USART_Read(); // read the received data
USART_Write(i); // send data via USART
}
}
}
 

Yes, I have some example code.



Code:
int i=0;
int j=0;
int receive;

void main(){


    // unsigned char *p ;
     //unsigned char ok[5];

     const unsigned char command1[5]="AT\n\r";
     const unsigned char dial[17]="ATD0716530115;\n\r";
      TRISB=0x00;
     Usart_Init(9600);
     PORTB=0x01;
     Delay_ms(2000);
    while(1){
    PORTB=0x00;
     for(i=0;i<6;i++)
     {
     if(command1[i]=='\0') break;
     Usart_Write(command1[i]);
     Delay_ms(100);
     }

     Delay_ms(5000);
     for(j=0;j<18;j++)
     {

     Usart_Write(dial[j]);
     Delay_ms(100);
     }
     PORTB=0x01;
     Delay_ms(1000);


     }
}
 

the code works perfect.

may be you should change the ports depends on your hardware.
Also, are you sure about your connections?

As per BooM, I believe the problem may be in your connections.
1- Check the serial cable used.
2- Check the MAX232 connections.

I hope this helps.
Good Luck.[/quote]
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top