PIC 18F2420 and Irobot Create

Discussion in 'Embedded Systems and Microcontrollers' started by crazyengineer, Dec 8, 2012.

  1. crazyengineer

    Thread Starter Member

    Dec 29, 2010
    156
    2
    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

    Code ( (Unknown Language)):
    1.  
    2. void main(void)
    3. {
    4. OpenUSART(USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE &USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH, 21);
    5. Delay1KTCYx(4);
    6. while(1)
    7. {
    8.     putcUSART(0x80);
    9.     putcUSART(0x84);
    10.     putcUSART(0x8B);
    11.     putcUSART(0x02);
    12.     putcUSART(0x00);
    13.     putcUSART(0x00);
    14. }
    15. CloseUSART()
    16. }
    17.  
     
  2. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    989
    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.
     
  3. crazyengineer

    Thread Starter Member

    Dec 29, 2010
    156
    2
    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: Dec 8, 2012
  4. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    989
    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?
     
  5. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    989
    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.
     
  6. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    989
    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.
     
Loading...