PR23:How to send the data from LCD back to x-ctu?

LED Blinking, Walking with Cytron Servo, Displaying RFID, Multi-function Mobile Robot......

PR23:How to send the data from LCD back to x-ctu?

Postby fyp09 » Thu Feb 04, 2010 12:44 pm

How to send the LCD data such as(m_right or right appear on the LCD to the x-ctu program) dual communication using two xbee pro.As you can see below:

{
lcd_goto(20);
if (RCREG == '8') // if character '8' is detected, the robot move forward
{
forward();
send_string("FORWARD ");
}



How to program the PIC so that the send_string will appear back to X-CTU at the PC.
Please help :roll:
fyp09
Newbie
 
Posts: 14
Joined: Mon Dec 07, 2009 11:24 am

Re: PR23:How to send the data from LCD back to x-ctu?

Postby yonghui » Fri Feb 05, 2010 2:18 pm

fyp09 WROTE:{
lcd_goto(20);
if (RCREG == '8') // if character '8' is detected, the robot move forward
{
forward();
send_string("FORWARD ");
}



hi fyp09,

can you briefly describe how you are controlling your pr23? i see that you are using UART to control pr23, the character '8' is receive from where?
for your info, XBee module needs UART communication with microcontroller, you will need to reserve the UART module of PIC for XBee use.
but if you are using the XBee to just transmit data to pc, then u will need the transmit part of the uart only. setting the baudrate correct to 9600 for default XBee module setting. then

the sending of your data will look like this:

CODE: SELECT_ALL_CODE
{
lcd_goto(20);
if (RCREG == '8') // if character '8' is detected, the robot move forward
{
 forward();
 send_string("FORWARD ");
   
 while(TXIF==0);   //only send the new data afterthe previous data finish sent
 TXREG='F';
 while(TXIF==0);
 TXREG='O';   
 while(TXIF==0);
 TXREG='R';
 while(TXIF==0);
 TXREG='W';
 while(TXIF==0);
 TXREG='A';
 while(TXIF==0);
 TXREG='R';   
 while(TXIF==0);
 TXREG='D';      

}




before anything, u will need the xbee setting correct:
AP=0 will set xbee to transparent mode for simple commnication;
DL and MY to match each other on both Xbee module, DL of transmit xbee equal to MY of receive Xbee.

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

Re: PR23:How to send the data from LCD back to x-ctu?

Postby fyp09 » Fri Feb 05, 2010 5:59 pm

The robot controlled by skxbee from keyboard..the setting i already follow the user manual given.Actually i want the robot gives the response when the user press the keyboard. so when i press '8' the robot will send Forward back to the X-ctu(PC) :ugeek:
fyp09
Newbie
 
Posts: 14
Joined: Mon Dec 07, 2009 11:24 am

Re: PR23:How to send the data from LCD back to x-ctu?

Postby yonghui » Sat Feb 06, 2010 10:30 am

fyp09 WROTE:The robot controlled by skxbee from keyboard..the setting i already follow the user manual given.Actually i want the robot gives the response when the user press the keyboard. so when i press '8' the robot will send Forward back to the X-ctu(PC) :ugeek:


hi,

from your description, i am clearer now what u wish to do with your Xbee, previous, i really blur of what u are trying to implement, i tot u just wan a response to your pc when pr23 is moving and probably pr23 was control by other device.

my suggestions are here:

when u press '8' on keyboard, u know that the robot will move forward. so, probably sending back Forward back to Xctu might not helpful in determining whether ur robot is really moving onot unless u have encoder on the motor.
probably its more meaningful to send other responses such as, status of each line following IR sensor on board, distance of obstacle from IR range sensor or ultrasound.

from Xctu terminal pressing 8 will send out ASCII value ( which is 0x38 in Hexadecimal) of '8'. this value will receive by the matching address Xbee radio on the robot. microcontroller on robot will read the value via UART Dout pin of the radio. if detected '8', it will start move forward, or if detected '2' it will move backward etc.

sending information back to the xtcu will require loading the data u want to send into Din pin on radio using UART. mayb u can send other character like 'F' back to xctu to shows that the robot is now moving forward or 'B' to show that robot is now moving backward as the response.

hope this info will help u. pls read more on UART, so that u will know how to communicate with XBee. u can read it in PIC datasheet.

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


Return to DIY Project Set

Who is online

Users browsing this forum: No registered users and 20 guests

cron