If you are using Excel, there are built-in function for mortgage calculating.
For example, for capitcal repayment mortgage:
=PMT(monthly interest rate, no.of months, captical amount).
if annual interest rate = 2.98%, then monthly rate = 2.98% / 12
no. of months of total payment, say 20 years term, = 12 x 20
capital amount = total amount borrowed say 300,000
PMT(2.98%/12, 240, 300,000) = 1,660.79, which is monthly payment.
IPMT function is used for Interest Payment Only Mortgage.