Log in

View Full Version : serial port interface


AMIRAM
19-01-2006, 04:41
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

Kevin Watson
19-01-2006, 15:48
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?


thanksIf 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

6600gt
19-01-2006, 20:12
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.

fowlerm
19-01-2006, 22:11
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.
Yep, but you'll have to use another level shifter to get from RS232 back to TTL on your other pic.

6600gt
19-01-2006, 22:15
So have like a external MAX232 wired to the pic?

pclements
20-01-2006, 09:09
why would you use a different controller if the other one works just fine?

AMIRAM
20-01-2006, 09:26
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....

6600gt
20-01-2006, 09:33
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.

fowlerm
20-01-2006, 11:20
Can't use serial port 2 since the camera is using it.
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).

Kevin Watson
20-01-2006, 12:00
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.Offloading this extra work onto another microcontroller is a great idea.

-Kevin

6600gt
20-01-2006, 14:45
I can use your code for the pic, Kevin?

Kevin Watson
20-01-2006, 16:20
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

6600gt
20-01-2006, 18:29
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?

AMIRAM
22-01-2006, 02:03
is ther any rule about connecting another microcontroller to the FRC??

SoftwareBug2.0
22-01-2006, 02:12
is ther any rule about connecting another microcontroller to the FRC??It's the same rules as any other circuit.

kaszeta
22-01-2006, 11:15
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.

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.

6600gt
22-01-2006, 21:16
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)?