MSP430F2013, Reading Analog and Digital Inputs

Hi!

My application needs to generate a PWM; the frequency is kept constant (about 50kHz) and the duty cycle is varying according to the following:

A counter is set up to count until logic high is on a digital input.

An analog measurement is made using interrupt.

The two results need to be multiplied and the value of the duty cycle is changing continuously according to this multiplication.

I am able to read the analog input accurately. The counter is also working properly.

My problm is the following: I cannot copy the content of the SD16MEM0 register to a variable; and somehow I cannot perform multiplication of two variables; the result is always zero. I believe that I have a very fundamental problem. I think I did not properly set up the settings of the workspace. I followed the SLAU138E user guide.

Does anyone have a solution?

Thank You.