serial port interface

Hi

im using the FRC tTL serial port to connect another controller to my robot

and i dont know how to read the serial Data from the other controller…

can Anyone help my with an example on how to read/write from the serial TTL port?

thanks

If you use the serial port driver at http://kevin.org/frc, it’s very easy to send and receive data from either of the serial ports. Have a look at the process_data_from_master_up() function in serial_port_diagnostics.zip/user_routines.c for an example that moves data from/to both serial ports.

-Kevin

Can you use the serial port 1 to connect to another 18 series pic eventhough that port has a RS232 chip interfaced to connect to PC.

Can’t use serial port 2 since the camera is using it.

How many sensors can you put on the FRC before you start pushing it(including Camera)?

Thanks.

Yep, but you’ll have to use another level shifter to get from RS232 back to TTL on your other pic.

So have like a external MAX232 wired to the pic?

why would you use a different controller if the other one works just fine?

becuse the sensor that i want to use is slow and give me the data in pulse width and if ill be witing for the pulse ,the program wont send the Data evry 26mS and wont work…

Thats the thing i don’t how far you can push the RC. I want quite a bit of accuracy form both the accelerometer and a the gyro. I would also like to keep track of the RPM’s of the spinning wheel in the shooter to adjust the power as required.

Now with the camera and these sensors and trig functions, you could easily push the RC to its limits, I think.

You could connect the CMUcam to the program port since it already uses RS232, and then connect your other pic to the TTL port directly. If you’re concerned about runnning a whole DB9 serial cable to the camera you could just buy a DB9 connector and replace one end of a pwm cable with the DB9. The CMUcam already has a PWM-style 3-pin connector for RS232 Tx, Rx, and ground (which is all you need).

Offloading this extra work onto another microcontroller is a great idea.

-Kevin

I can use your code for the pic, Kevin?

There’s only two things I care about: 1) The code not be posted on other publicly viewable websites, FTP sites, CVS, etc. 2) The code be used for educational purposes only (i.e., not used to make a profit for someone). If this is for your FRC robot, you’re encouraged to use the code anyway you see fit. I’ve been hoping someone would do what you intend to do. If you get stuck, I’ll be happy to help you out if I can.

-Kevin

It is for FRC and i might use it for my personal work or research on the pics but nothing to do with commercial use.

Is there anything really important that I have to modify to make the serial port driver, adc, gyro, and accelerometer code work with a 18F4XX series pic?Other than the usual registers and pins.

Would a CAN bus connection to the TLL port work? What type of serial connection does your serial port drive control?USART?

is ther any rule about connecting another microcontroller to the FRC??

It’s the same rules as any other circuit.

So far we’ve got a program that’s running fine with six encoders (each generating around 1000 pulses/sec), the gyro, some prototype DAA code, the camera, several PID controllers, and a bunch of math using (floating point!) trig functions, and it all fits comfortably on the RC so far and is working fairly reliably (the camera occasionally goes off into la-la land for as yet undetermined reasons, but if I reset it and the RC it’s always fine). That said, this is just the nuts and bolts, getting all the code ironed out, the PID parameters properly set, and autonomous mode working are going to take a lot of time and effort on the part of several students.

I suspect that if I need too many more trig functions or the code gets too slow, we’ll have to address the issue (probably by replacing the floating point math with fixed point trig routines), but for now I’m pleasantly surprised with what this year’s RC can do.

It would be really sweet to get it working, I think.
How accurate do you think you can go for a navigation system using the gyro and accelerometer? I want like 1 cm resolution at 10m/s, on paper at least.

Whats DAA? and What do you need 6 encoder for(at 1000 pules/sec)?