The porting from dsPIC30F to dsPIC33F was not too difficult. As usual, when you change MCU or DSC family the most of the effort is on studying new features for peripherals. On dsPIC33F, as already described, there are several differences, among theme the must intriguing are DMA and peripheral pin select.
Of course the software is very much simpler without the need of hi speed communication among three DSCs.
At the beginnig I was a little bit worried about the time both PIDs procedures could take on the same DSC. So I started some measurements with stopwatch in MPLAB SIM. The result was comforting but I wanted to be sure, so I've used the scope to measure the time needed by the routines in the real environment with interrupts coming from all peripherals. A pin was set to 1 entering the routine and reset to 0 on exit.
The communication with the external word is performed through the two UART serial interfaces; one for telemetry, as on dsNavCon board, and the other to get data from sensor board. The XBee module can be connected to UART1 or UART2 through JP1 and JP2 jumpers. J1 and J16 sockets are available for other kind of connections. COMM1 port (J16) can also be used for an I2C communication thanks to the peripheral pin select capability of the dsPIC33F series.
To the side a little movie with a test of the first stage of the porting, with PID functions for both wheels working.
The screenshot above shows the overall time needed by both PID procedures. The procedures are the same described on this page duplicated for two motors. The values match enough with the simulation measurements. A call to one C30 libraries PID function takes 33 machine cycles, 0.825μs on a 40Mips DSC. Adding all other instructions to read the encoders, compute the speed values and create the acceleration ramps we have a total of 13μs of duration. 11μs are used only to perform: Vel1=Kvel1*IcIndxTmp/IcPeriodTmp; meaning to obtain the speed value knowing the encoder pulses in one time slot. Fortunately it is a dsPIC, otherwise...
The time needed for both PID procedures, included calling and returing from functions (pin set to 1 before entering in PID1 and reset to 0 after the return from PID2) is still less then 30μs, as can be seen on the graph. Less than 30μs every 1000μs... I must find something to do for the controller otherwise it get bored.
This time there is only one program for all of the procedures. It is in continuos development, stay tuned.