Questions tagged [dspic]

Microchip's 16-bit dsPIC® Digital Signal Controllers

75 questions
9
votes
7 answers

What is the fastest way to transpose the bits in an 8x8 block on bits?

I'm not sure the exact term for what I'm trying to do. I have an 8x8 block of bits stored in 8 bytes, each byte stores one row. When I'm finished, I'd like each byte to store one column. For example, when I'm finished: Byte0out = Byte0inBit0 +…
Roland Rabien
  • 8,750
  • 7
  • 50
  • 67
9
votes
4 answers

Faster way for extracting and combining bits from UINT16 to UINT8

I'm searching for a faster way for my required special extract and combine operation as described below: +-------+-------+-------+-------+-------+-------+-------+-------+ | BIT 7 | BIT 6 | BIT 5 | BIT 4 | BIT 3 | BIT 2 | BIT 1 | BIT 0…
bkausbk
  • 2,740
  • 1
  • 36
  • 52
4
votes
2 answers

dsPIC33 updating PWM duty and frequency

I am trying to control a H-bridge converter using one PWM generator for each diagonal (PWM1 and PWM4 in my case). I want to be able to control both frequency and duty cycle. To do so, I generate a trigger interrupt at the beginning of PWM4 period,…
3
votes
0 answers

Microchip C inline asm does not generate prefix for immediates in inline asm

Im trying to implement my own memcpy function in asm. CPU is dsPIC33F, compiler Microchip C30. asm("repeat %2 \n mov.b [%1++], [%0++]" : : "r"(dst), "r"(src), "ri"(len)); When len is variable, this works fine: the compiler picks a register and…
Woodoo
  • 129
  • 6
3
votes
1 answer

KissFFT Versus DSPIC - Rounding Errors

Trying to get the KissFFT fixed point implementation to line up with the DSPIC. The issue is that the fixed point implementation in Kiss is a true fixed point but the dspic does the multiplies and sums in a 40 bit register then shifts down to 16…
user2848810
  • 1,187
  • 1
  • 8
  • 12
3
votes
0 answers

dsPIC33EP512MU810 analogue comparator not working

I'm having trouble getting the analogue comparator working on a dsPIC33EP512MU810. I want to compare two external voltages. Connected to C1IN1+ is my reference voltage (1.5V) and C1IN1- is my variable voltage (1.1 - 1.9V). I've set the Event trigger…
Tinez
  • 31
  • 4
2
votes
1 answer

EZBL_EraseAll or EZBL_NVMKEY not working in mplab x IDE version 5.4

I have a bootloader working for mplab x IDE v4.2 for years. It is compilated with XC16 1.35. We are updating it to be used on MPalb x IDE v5.40. I have been able to make this by creating an example of ezbl and replacing the files with my code from…
Hamboy75
  • 938
  • 1
  • 11
  • 22
2
votes
0 answers

Compare and Swap/Exchange on an dsPIC33F with CPSNE instruction

Is there a better way to implement an interlocked variant of "compare and exchange" on a dsPIC33F? unsigned int InterlockedCompareExchange(volatile unsigned int* Destination, unsigned int Exchange, unsigned int Compare) { register unsigned int…
bkausbk
  • 2,740
  • 1
  • 36
  • 52
2
votes
1 answer

How does Simulink sample time relate to Interrupt Service Routine sample time?

I have a question concerning a simulink model I am building. I am trying to find out with values of P and I are needed for a closed loop controler. That is for a PFC controled by a dspic. I know that the sample time in Simulink determine the rate…
Adrien
  • 33
  • 4
2
votes
1 answer

How loops are implemented in PIC24F assembly code

Below is the disassembly of following C code: 268: while (Counter < 250) 269: { 270: Counter++; 271: } Disassembly: 268: while (Counter < 250) 001B08 …
M Sharath Hegde
  • 485
  • 1
  • 6
  • 20
2
votes
2 answers

dsPIC33EP128MC202 UART receiver doesn't work

I wrote the code for UART communication. TX is working fine, but RX is not working. I have searched a lot but found no solution. I am transmitting character x to PC with time interval, and I am able see the data. But when transmits data pic is not…
2
votes
0 answers

CDC USB on dspic33EP

I'm trying to get my pic to communicate via USB with my PC (MacBook Pro). Here is the schematic for my homemade board, using a dsPIC33EP256MU806: I've adapted microchip's MLA Library, specifically, the cdc_basic firmware. Following are the changes…
tsuo euoy
  • 129
  • 3
  • 10
2
votes
0 answers

DSPIC33 ADC Conversion Time

I have a problem with my code; My aim is to create a code that should take 8000 - 10000 value per second from ADC. Now i wrote a test code to configure the ADC, but according to my calculation ADC Time for Conversion shoul be : *…
Furch Radeon
  • 77
  • 1
  • 7
2
votes
3 answers

How to rotate the bits in a word

I'm using a dsPIC33F and GCC. I want to rotate the bits in a word once left or right, like this: MSB LSB input: 0101 1101 0101 1101 right: 1010 1110 1010 1110 left : 1011 1010 1011 1010 (In case it's not clear, the LSB moves into…
Thomas O
  • 6,026
  • 12
  • 42
  • 60
2
votes
2 answers

dsPIC33EV256GM002 PWM settings

I developed a simple program to produce PWM waveform on dsPIC33EV256GM002 but I can't disable it. I used PWM1 and PWM2 and I would generate PWM waveform on PWM1L1 pin (pin 26 on DIP package) maintain PWM1H1 (pin 25 on DIP package) as digital…
Ferrari
  • 75
  • 1
  • 11
1
2 3 4 5