casemod
Member level 1
- Joined
- Sep 21, 2013
- Messages
- 34
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,288
- Activity points
- 1,618
Hi,
I have a DSPIC33 and I am currently receiving a 10bit analog signal via an ADC.
I wish to change the code in order to receive the 10 bits using some of the ports I have left. Some are on PORTA and some are on PORTB.
The code is written in ASM
Currently I initialize the AD converter and get the 10 bit value. I shift 1 bit to the left (loop takes 11 bits) and then this is added to the sine look up table for the PWM generation.
I would like some help on how to implement something similar but receiving data from the pins. I know I have to set them as inputs, but since they are in different places (not in a row) i have no idea how to colect them and load them. If it were in C I would use an array, define bit x to position x of the array and then i would load the 10bit array into the variable frequency.
How can I do something similar in ASM?
Many Thanks
I have a DSPIC33 and I am currently receiving a 10bit analog signal via an ADC.
I wish to change the code in order to receive the 10 bits using some of the ports I have left. Some are on PORTA and some are on PORTB.
The code is written in ASM
Code:
mov ADCBUF1,W0 ; Read the ADC results into W0
bclr IFS0,#AD1IF ; clear A/D interrupt flag asr
sl W0,#1,W4 ; Shift to the left to get the
mov W4,Frequency ; frequency.
sl W4,#7,W4 ; Left shift AN to get Q15 value
Currently I initialize the AD converter and get the 10 bit value. I shift 1 bit to the left (loop takes 11 bits) and then this is added to the sine look up table for the PWM generation.
I would like some help on how to implement something similar but receiving data from the pins. I know I have to set them as inputs, but since they are in different places (not in a row) i have no idea how to colect them and load them. If it were in C I would use an array, define bit x to position x of the array and then i would load the 10bit array into the variable frequency.
How can I do something similar in ASM?
Many Thanks