• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Importing PIC18F Project into PIC32

Status
Not open for further replies.

Analastuomar

New Member
Hi,
I purchased a new PIC32 USB Starter Kit II development board. It doesn't come with a CD. My project in PIC18F is mixed of C and assembly. I'd like to import the old project into to PIC32.
Q1) Is there any conflict between the PIC18F tools and PIC32?
Q2) What's the nearest tool should I used, since I saw many tools for PIC32.
Q3) As a new user for PIC32 where should I start?

Thanks
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
This all depends on the project.... If the code has been written with portability in mind, there will be little conflict. If the Pic18 code was written in C18 then you need to get a copy of C32....

The assembly part will cause problems. Personally I would convert the asm to C first as the pic32 is tons faster so native C will also run faster.....

I use MikroC for pic32 and I also use C18 and XC8.. I can port C programs to MikroC with very little effort. I have also ported C18 to C32 with very little problems...

Asm is very different, so conversion to C first will be the quickest way!! Unless, of course, you are well versed in assembler!!
 

Analastuomar

New Member
Thanks Ian Rogers,
I used an assembly may be 1/8 Th of my coding since it was an interaction with external chips .
I start seeing the assembly instructions of PIC32 are MIPS and I have to comprehend the meaning and usage.
I read somewhere that to write a boot-loader you use an assembly language.
I'm planning to use PIC32MX795F512L. I'm planning to use in circuit programming and boot-loader to update the firmware at he field.
If you have done any of , which pins have you used?
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
I'm planning to use PIC32MX795F512L. I'm planning to use in circuit programming and boot-loader to update the firmware at he field.
Bootloaders are free... There is a portion of memory specifically assigned in the pic32 for this.... It uses the USB port.
The USB n the pic32 is a OTG

If you have done any of , which pins have you used?
I use the pic32mx440f256l ... In fact I use a small board called a Pinguino micro... It does everything I need and has a boot loader.. Its not much bigger than a pic18 40 pin device ... However! I use MikroC to program them via their own bootloader...

The pic32 is designed to used C more than many chips I have used, ergo a perfect chip to not use assembler!!
 

Analastuomar

New Member
Since PIC32 is based on MIPS, that required too much work. I decided to step down to PIC18F where all my old work.
I came across the programming section, I was not able to figure out how should I know if there is a received data and where to get it from and where should I put the reply.
The section is a while loop as:

// Enter into infinite program loop
while(1)
{
// Update tick count. Can be done via interrupt.
TickUpdate();
// Let Stack Manager perform its task.
StackTask();
// Let any Stack application perform its task.
HTTPServer(); // Only if HTTP is used.
FTPServer(); // Only if FTP is used.
// Application logic resides here.
DoAppSpecificTask();
}
By the way I knew how to use SPI communication and it's interrupt. ENC28J60 I'm going to use as an experiment .

Any help appreciate it.
Thanks
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member

Analastuomar

New Member
Ian,
I downloaded the library and I saw the demapp, which is a while loop as wrote before. The question is how to know if there is a message and where to get it from and where to put the reply?.
Thanks
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
I'm not up to speed with TCPIP.. All know is there is a function "Process IO()" in the relevant protocol call. The buffer is a quite large and the first 'x' characters are the header. This is queried to determine the packet... Your reply needs to be in the same format... Google the TCPIP packet and see for yourself.
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member

Analastuomar

New Member
Hello Ian,
I received PIC-WEB. I found two things odd.
1) On the jack power supply, 6-9 V AC.
2) ICSP/ICD connector is very small. I thought the pin size would be like the other two connectors which will make it easy for me to hook my MPLAB ICD 2.

How did you handle this two issues?
 

Analastuomar

New Member
Hi Ian,
PIC-WEB requires MPLAB-C18-Upgrade-v3_47. I never upgrade after MPLAB-C18-Upgrade-v3_34, becuase all upgrade versions were posted.
What version worked for you.
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
Hi Ian,
PIC-WEB requires MPLAB-C18-Upgrade-v3_47. I never upgrade after MPLAB-C18-Upgrade-v3_34, becuase all upgrade versions were posted.
What version worked for you.
XC8 will compile your code... I compiled it on C18 v3.40 But I think I tried on XC8 as well... I'm slowly moving all my C18 code to XC8... The trouble here is you need XC8 1.33 or less as the libraries needed are not included with XC8 1.41
 

Analastuomar

New Member
Hi Ian,
I bought mcc18 while the version was 2.2, then I kept upgrading it until 3.34. Yesterday I used the last version I'm holding which is 3.35. The compilation went fine and produced a hex file. The last PIC I used, PIC18F6621. since I need to add an Ethernet, I choose PIC18F97J60 and this will ease my work moving C code and assembly from the previous work. I backed off to use PIC32 for compatibility.
 

Analastuomar

New Member
Ian,
PIC18F97J60 is built in Ethernet. I didn't see any independent input source to run the Ethernet (@25Mhz).Which means I have to sacrifice the speed (40MHZ).
I need my application to run @40 Mhz. Do I have to add an independent chip for the Ethernet?
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
Yes! The Ethernet is inside... The external crystal is 25Mhz this is for the Ethernet.. You then set the PLL to x5 = 125Mhz then a prescale of /3 to get the 41.66Mhz clock speed ( nearly 42Mhz) you can then adjust the osctune to get what you need. So with a single 25Mhz you get Ethernet speed and 42Mhz FOSC...
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top