# PIC 18F2420 and Irobot Create

#### crazyengineer

Joined Dec 29, 2010
156
So I'm trying to control an Irobot create using a PIC 18F2420 microcontroller, but it seems like it does not turn on the Power LED as I wanted.I know I configured the baudrate correctly because I tested a printf program using a baudrate of 57600. Here's the code

Rich (BB code):
void main(void)
{
OpenUSART(USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE &USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH, 21);
Delay1KTCYx(4);
while(1)
{
putcUSART(0x80);
putcUSART(0x84);
putcUSART(0x8B);
putcUSART(0x02);
putcUSART(0x00);
putcUSART(0x00);
}
CloseUSART()
}

#### spinnaker

Joined Oct 29, 2009
7,835
How do you know that data is actually going to the robot? DO you have a scope or logic analyzer?

Are you certain you have the transmit pin tied to the receive pin of the robot and not the other way around?

Can you connect the serial port of your PC to the robot and get it to work that way?

There are a lot of things you can do to troubleshoot this on your own,

If you want to go by the user name of "Crazy Engineer" then you need to start think like an engineer.

#### crazyengineer

Joined Dec 29, 2010
156
How do you know that data is actually going to the robot? DO you have a scope or logic analyzer?

Are you certain you have the transmit pin tied to the receive pin of the robot and not the other way around?

Can you connect the serial port of your PC to the robot and get it to work that way?

There are a lot of things you can do to troubleshoot this on your own,

If you want to go by the user name of "Crazy Engineer" then you need to start think like an engineer.
1) The data is sent during restart. The Rx pins of the FTDI programmer flashes whenever data is sent and the power LED flashes whenever the data is sentLike I said, I know the baudrate is working because I tested some data transfer using arduino serial IDE.

2) I do not appreciate that little insult. I do not have a lot of tools at my disposal. I do not have a logic analyzer or a oscilloscope in my place of residence though I will buy it in the future. I applied most troubleshooting tools available at my disposal which includes the PICKIT3 which does not show the values of what I place inside it.

Last edited:

#### spinnaker

Joined Oct 29, 2009
7,835
1) The data is sent during restart. The Rx pins of the FTDI programmer flashes whenever data is sent and the power LED flashes whenever the data is sentLike I said, I know the baudrate is working because I tested some data transfer using arduino serial IDE.

2) I do not appreciate that little insult. I do not have a lot of tools at my disposal. I do not have a logic analyzer or a oscilloscope in my place of residence though I will buy it in the future. I applied most troubleshooting tools available at my disposal which includes the PICKIT3 which does not show the values of what I place inside it.
It was not meant as an insult. I was teasing you. But you do have a bad habit of not including enough information so others can help you.

The information you posted is useful. It should have been included in your first post.

You can send data from your Mcu to a PC? The same data that you are sending to the robot? A PC can sort of act like a serial data analyzer.

What "power" LED the one one the robot?

Can you control the robot with your PC?

#### spinnaker

Joined Oct 29, 2009
7,835
And are you certain that you have the correct pins corrected on the robot? Baudrate is one thing but you need to have the transmit pin connected to the receive pin of the robot.

#### spinnaker

Joined Oct 29, 2009
7,835
Is the FTDI programmer the programmer you are using to program the Audrino? If so. what does that have to do with controlling the robot?

If you are worried that the chip is being programed correctly then you could wriite a simple program to turn on an LED or something.

But if you used it before then you can probably assume that it is being programmed ok.