Programming a third port

Hello my team wants to program the third port.What we did was change everything that said port1 or port2 and put in port3. we got a failled build that said
SPBRG3 AND TXSTA3bits is not defined.

How can we fix this problem?all are welcome(KEVIN!lol)

What third port?

(There are only two serial ports available: the program port and the TTL port.)

if u look on the IO there are four ports. we configuered our controller so that when we press a switch it activates a motor. we want to program that port so we can use it.

Again I ask, “what third port?” What are you looking at that shows four of them? Again I tell you that there are only two serial ports available.

Now I ask why a serial port has anything to do with using a switch to control a motor.

A motor usually connects to a Victor speed controller, which sets its output based on signals from one of sixteen pwm outputs on the Robot Controller. Some motors can be connected instead to a Spike relay module, which sets its output based on signals from one of eight relay outputs on the Robot Controller. Switches are typically connected directly to one of eighteen digital inputs on the Robot Controller.

Maybe he means joystick ports.

yes the joystick ports! We are using two joysticks that are connected into port 1 and port 2 on the operator interface. Then there are two extra ports(3 and 4). We created a controller that uses the third port. How would you program the third port!

The third port should be exactly the same as the others. Simply replace the p1 or p2 prefix with p3. There shouldn’t be any other changes.

the “aliases” for the third stick are p3_x, p3_y, and so on

which source or header file would i input my data. I cant seem to find it anywhere

All of the aliases are defined in the same header as the first two ports, that is, ifi_frc.h.

but where would i write

ex.if(p3_sw_trig)
pwm03=254;
else
pwm01=127

That should be in user_routines.c, like the other code.

the kevin watson code doesnt have user_routine. should i add it?

No, if you’re using Kevin’s code, try teleop.c, the function “void Teleop (void)” should work.

THANK YOU!

for some reason i thought teleop was the hybrid period. Thats why i have been lost for so long!:smiley:

Hey how are you suppose to get the robot to move. we downloaded the program and now we cant control the robot. Nothing works but when we download the old program it works fine! i suck:confused:

HELP~!!!~!~!~!!!

did you change any thing about the port 1 or 2 joysticks? did you tell the motors to run on port 3?
example:

pwm01 = p3_y;