PIC Programming Inquiry

Travm

Joined Aug 16, 2016
315
OK...I need a break anyway......bout ready to tomahawk this thing.
Ok, dont do that.
I wonder if there is a character/attachment limit per post :D

So you have downloaded mplabx, and xc8
Plug in your curiosity board, verify the chip in the dip socket, you will need the model number. The chip that ships with that board is supposed to be the PIC16F18875.
Go to File->New Project
1.png
select Microchip Embedded, and Standalone Project
2.png
Select your device, PIC16F18875 - I'm showing a PIC12F1571, because that is what is installed in my curiosity board
3.png
Select Microchip Starter Kits, then Curiosity This option will not be available if your board is not connected.
4.png
Select your compiler, XC8 if you wish to use C programming language.
5.png
Give your project a relevant name. Important for a couple reasons, it makes a folder for all the files as well so you can keep the project together.

Next you should install Microchip Code Configurator;
Go to tools->Plugins->Available Plugins, then scroll through the list and select Microchip Code Configurator, then click install.
When this is done installing, you will get a button on the top taskbar that looks like a blue shield with MCC inside the shield.
Click on MCC.
This will open the Code Configurator, which will allow you to do all the configuring of the chip in the GUI.
When you are all configured (read the data sheet, about 1000 times first), you click on "generate Files" and MCC will create a bunch of header and program files.
Now you can open your main.c file and start banging code.

It appears as though maybe i dont have permission to post screenshots... the text may help i hope.
 

Thread Starter

BR-549

Joined Sep 22, 2013
4,938
ok....thanks....I am connected.

changing from harmony project to stand alone project....allowed connection.

interesting.

I want ASM as primary. c secondary. loaded mpasm.

At first......I don't want to program chip. I want to explore it first. How do I bring up the assembler?

And does it have an immediate mode?

I want to look at registers, memory and check out the indexing.
 

Travm

Joined Aug 16, 2016
315
I have never worked in assembly, so I dont know if i can help with that.
The only way that i know how to look at the registers is with the MCC plugin. Otherwise your just hand coding.
I'm not sure if MCC supports assembly.
The registers all have nothing in them until you configure them. Either with MCC or by hand coding as the datasheet lays out.
 

Travm

Joined Aug 16, 2016
315
ok.....show me how to load a sample program. can I get sample programs?
I've never worked with a sample program either...

quite literally the only thing i know how to do, is configure any PIC chip with MCC (i could hand code it, but then i would die), then start writing.
this is what MCC looks like. you have to install it from the plugin manager.
MCC.png
appologies for the small size, my development computer is a chromebook.
This will allow you to configure the device to work, then load it into your chip, make it turn LED's on, etc.
You will need the Data sheet for your chip open beside you. there are many things you will need to read and do properly as there are literally 1000s of different PIC chips. They have similarities, but they are not the same.
 

Travm

Joined Aug 16, 2016
315
So once you have configured the system module, the pin manager, then added any peripherals you intend to use, you click Generate on the upper left.
MCC2.png
you see now if you switch the left task window to "files", there is a list of files that MCC created, as well as a new main.c file.
You can look and see how MCC coded all the headers, and configured all the registers.
If you double click on main.c, you can then start writing your program.
MCC3.png
 

Travm

Joined Aug 16, 2016
315
you asked some questions I couldnt answer, so i got looking.
Registers you look at by going to
Window -> pic memory views ->file registers
I like my comfy GUI ><
theres a bunch of other stuff in there that more capable people might be able to shed more light
 

Thread Starter

BR-549

Joined Sep 22, 2013
4,938
OK...I found a demo program for the board. Can some one show me where to install this demo?

And how to get it in the IDE. I put the demo in the project folder.......but IDE says that there is no files?
 

Travm

Joined Aug 16, 2016
315
OK...I found a demo program for the board. Can some one show me where to install this demo?

And how to get it in the IDE. I put the demo in the project folder.......but IDE says that there is no files?
link to demo?
did you rename it?
i'm noticing all my project folders are "projectname.X"
perhaps the .X is significant.
I have quite literally had no issues with the IDE, and believe me, i've had tons of issues.
 

Travm

Joined Aug 16, 2016
315
Open the source files and start modifying, or program you're pic and see it work?
The source files are listed under the files tab to the left.
 

Travm

Joined Aug 16, 2016
315
I'm dying to know how you made out with your curiosity board?
The HPC board wasn't available when I bought my standard 8-bit, considering grabbing one for fun times.
 

Thread Starter

BR-549

Joined Sep 22, 2013
4,938
Well......after a very discouraging start........I am thoroughly enjoying studying this chip. The only previous experience was with a 6502 in the 80s.

I was finally able to figure out the IDE, to understand the file setup. Still not sure about the project structure.

My problem is that the IDE.....and everything else about the programing environment and support from the company is set up for C. And for all of the revision changes...for older devices....is mentioned....but you are on your own to figure it out.

If some one would build an ASSEMBLY ONLY IDE......my life would be perfect. The C and higher IDE......take all the fun and pleasure out of it.

Finally.......after a lot of loud cussing, I was able to talk to and load configuration files to the chip with assembler. But that was weeks ago. I have been reading the data sheet..........and noting key registers. Not quite half thru yet. A lot of times I have to go back to an earlier chip datasheet......to understand an example....of what they think I already know. They assume I have been studying pic since the beginning. And of course in that frackin C.

I was even considering another chip company.........but couldn't find an assembly IDE. They're all the same.

I knew that asking for help.....would be useless........but there is enough data on web about pic.....I was sure to figure it out.

There is so many chip instruction changes and compiler changes.........that unless someone is working with exact same chip and with assembly........they would never be able to help me with problems. Unless I was willing to use C.

I wish I had the knowledge to forgo the pic ide and hardware. And be able to program the bare chip on a breadboard without pic software. Probably can't be done without some sort of C IDE.

I will continue to study this chip. But I doubt I will be doing any programming with it. My want and goal was not programming. My goal was to single step and watch memory and registers change. With the present IDEs available....that goal is not obtainable.

But this chip is like a novel.......so I will study it. Even though I can't watch it work.

If someone wants to program any micro controller.....they have to use C. The only reason I bought HPC board....was I thought I could program in asm. And one can.....just not the way I want to.

So...no more micro controllers for me. The software is useless for me.
 
Last edited:

Travm

Joined Aug 16, 2016
315
thats unfortunate. The IDE is a complicated minimalist kinda thing i agree, (mutually exclusive? not!).
In my learning of MCU's i caught on real quick, arrogant people program in asm. Smart people program in C. C is a programming language. asm is a machine language. Let compilers talk to the machine, you and I are not machines.

Why avoid C?
 

Thread Starter

BR-549

Joined Sep 22, 2013
4,938
It's a hard concept for many. It's sorta like the difference between stick shift and automatic. Again........getting there is not the goal.

I want to interact with the hardware.

I want a more intimate relationship with the chip. Any modern man should be able to understand that.

I'm exploring Man-Computer Symbiosis.

At least that's how they explained it to me.
 

Travm

Joined Aug 16, 2016
315
Ahh, this makes perfect sense.

I can see how you might have a hard time finding an IDE that is tailored to that.
Best of luck.

btw, "they" arent your robot computer overlords are they?
 

Thread Starter

BR-549

Joined Sep 22, 2013
4,938
C is like using a music synthesizer and assembly is like using a piano. I just can't find a good piano. They want me to make the synthesizer sound like a piano. And of course......it never can.
 
Top