In order to be able to properly protect your Ship from other pirates, you will definitely want to familiarize yourself with the cannons found on your ship. Usually, there will be cannons on both side of your ship that any of your crew members can use. However, before being able to fire one of them, you will need to grab a cannonball from one of the barrels found on your ship. Once you have a cannonball in hand, you will need to load it in the desired cannon you would like to fire. After the cannon has been properly loaded, you can then take aim and fire it (as long as you continue to have cannonballs in your inventory).
On top of being able to fire cannonballs, you can also fire your own character from a cannon. In order to execute this, you will first need to unload any cannonballs found within the cannon you would like to use. From there, step around to the front of the cannon until you have the option of climbing in for yourself. Once inside, you will be actually be able to aim and launch yourself in order to make an escape from your Ship.