Migration to dsPIC30F

Programmer, In-Circuit Debugger, PIC Start-Up Kit, Memory Interface...

Re: Migration to dsPIC30F

Postby sich » Wed Jul 06, 2011 12:47 am

Wow...this is enlightening! Good to see some PRO's talk in the forum :D
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm

Re: Migration to dsPIC30F

Postby Brian Griffin » Fri Oct 07, 2011 1:36 pm

Also, for migration to PIC16/18 to PIC24/30/33 has a bit of a learning curve, if you have to do it in ASM. The PIC24/30/33 has 16 'W' registers, compared to only one in the PIC16/18. Similarly, the AVR has 32 of the temporary registers, but they are handled in a different manner.

The PIC32 has a totally different world. Do not attempt "movlw" or "mov." - it won't work. For reference, check the MIPS assembly or the PIC32 programmer reference manual.

Things will get better in PIC32 in comparison to the others. Example, c = a + b: in PIC16/18F (30 + 20 = c in example)

CODE: SELECT_ALL_CODE
PIC16/18F

CBLOCK 0x30
a
b
c
ENDC

.... ; more code here

movlw .30
movwf a
movlw .20
movwf b

movlw a
addwf b, c


(sorry, it's been a while since I do ASM, so pardon me for the errors)

Meanwhile, in PIC32:
CODE: SELECT_ALL_CODE

... other code here
... ($t0 = c, $t1 = a, $t2 = b)

li $t1, 30
li $t2, 20
add $t0, $t1, $t2



Examples from : http://www.eecs.harvard.edu/~ellard/Courses/cs50-asm.pdf

You can see why PIC32 'adds' so easily. Despite being exposed to some of the PIC32 instruction sets for a few minutes, I can guess the ADD instruction which is quite readable, even in untrained eye.

And of course, delays may be easy. It's all 32-bits per register. It's up to one to improvise it, but I leave it to the readers' imagination. :)
PIC - UIC00B from Cytron (replacement for my broken PICKit 2), Pickit 3, MikroC for PIC
dsPIC - MikroC for dsPIC, mikromedia board (dsPIC33)
AVR - AVR Dragon
Parallax - Prop tool
User avatar
Brian Griffin
Enthusiast
 
Posts: 403
Joined: Mon Jan 17, 2011 9:36 am

Previous

Return to PIC Development Tool

Who is online

Users browsing this forum: No registered users and 15 guests