HOW to use uart

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

HOW to use uart

Postby ekeng86 » Tue Feb 02, 2010 12:26 am

i want to know, how i want send data through uart, for ur info im used ccs compiler, i used while (1){
printf("OG>\n\r");
delay_ms(1000);
printf("S,100\n\r");
delay_ms(1000);

so motor will on and run forward with speed '100'

is it correct?
ekeng86
Fledgling
 
Posts: 1
Joined: Tue Feb 02, 2010 12:20 am

Re: HOW to use uart

Postby yonghui » Wed Feb 03, 2010 4:33 pm

hi ekeng86,

have a question here, are u trying to control your motor using microcontroller?
if yes, then b4 UART can function, u will need some initializations of the uart module: enabling the serial port, setting the baudrate correct, setting the tris. setting the pin as digital inout.
after done all these. u can send data by loading data byte into the transmit register or receiving data by copying data received from receive register. PIC datasheet will help a lot to understand HOW to use uart.

regards,
yh
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

Re: HOW to use uart

Postby shahrul » Thu Mar 04, 2010 5:39 pm

I don't know what your system. What relationship UART communication with motor?
If using UART, you should have 2 device. That is UART transmitter part and UART receiver part. The both device, can be a microcontroller. Then, the motor is at receiver part.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: HOW to use uart

Postby ober » Thu Mar 04, 2010 6:02 pm

ekeng86, please explain in detail what you plan to do. We do not know which motor you are controlling, if through UART, what is the protocol? How is the connection, etc.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm


Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 31 guests