Created Thu, 19 Apr 2012 12:55:51 +0000 by Bumbolt
Thu, 19 Apr 2012 12:55:51 +0000
My question is simple i've bought a chipkit uno32 because i wanted to program it in PIC-assembly but also have the possibility to switch to arduino language later? When i search for documentation and examples i can only find arduino code. Is it possible to program in PIC-assembly on this controller? (Using MPLAB)
NOTE: My chipkit is still shipping so didn't test it yet.
Thu, 19 Apr 2012 19:03:18 +0000
MIPS assembly language is rather difficult, and 99% of applications are programmed in C, at a guess. I spent a couple of hours some time ago working out how to write an assembler program for the PIC32, here is what I came up with:
.global main .data var1: .word 0x2222 var2: .word 0xFFFF .text .ent main main: loop: nop lw $t1,var1 lw $t2,var2 add $t0,$t1,$t2 # $t0 = $t1 + $t2 mult $t1,$t2 # (Hi,Lo) = $t1 * $t2 div $t2,$t1 # Lo = $t2 / $t1 Hi = $t2 mod $t1 nop j loop .end main
You will need to use the MPLAB IDE and MPASM for the PIC32, if you want to try it. The program can be tested using the simulator, or on an actual PIC32 board such as the Uno32 if you have a PICkit 3 or an ICD 3.
Fri, 27 Apr 2012 16:11:39 +0000
My Uno32 is arrived now, i'll try it out. I've been developping pic-assembly for pic4450 in 16bit so i know pretty much about pic programming (alot more then about arduino).
For my current project i'll use arduino code to speed up the proces (deadline).
Tue, 01 May 2012 04:52:19 +0000
Note that the pic32 on chipKit has a MUCH different assembly language than the 8-bit pics like the 4450!
Tue, 01 May 2012 08:51:51 +0000
asm for 8 bit PIC was great fun and relatively straight forward , but having scratched the surface of pic32s you realize its like going from a Z80 to a Pentium , its not going to happen.... better to get a book on pic32 and C programming ( one by Lucio Di Jasio is good start ) you can still use MPLAB etc ,and you can still manipulate registers and ports like asm but with all the core stuff done and working in the background ....