Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

My first MPLabX

2 posters

Go down  Message [Page 1 of 1]

1My first MPLabX Empty My first MPLabX Fri Apr 16, 2021 8:59 pm


My first MPLabX Pic16f10

Took me a long time to get it installed and working, maybe 8 hours or so, although I already had some experience with Visual Studio.

These two video's and webpages below from Circuit Digest gave imo the best guide to make it run. For tools in stead of Pickit3 I used simulator, or left it open, I am not sure.

Huge program are these MPLab and its compiler XC8, they are about 8.5 and 1.5 GB respectively.

Well, anyway, maybe somebody wants to start with this too and hopefully this post is helpfull.

Edit: This video shows the same in the first 7.5 minutes.

Edit2: Github with more projects and hex-files

Last edited by Mistral on Mon Apr 19, 2021 10:03 am; edited 2 times in total

arcachofo likes this post

2My first MPLabX Empty Re: My first MPLabX Sat Apr 17, 2021 7:16 pm


This MPLab is showing often a 'this project is empty' barrier and quite a few times it will not build but pressing the build hammer a few times and re-opening the project suddenly it will. That's why it took me 8 hours to get it started.

I follow the CD-tutorial video's, CD stands for Circuit Digest, this is no.4

So far it's going good, although with above mentioned trip wires.
I've done pretty much in Simulide with Arduino before but not with Pics.
I have a few beginner questions

My first MPLabX Cd4-1610

Why is it showing File type not supported? 
Why is the Mclr having no effect
And why are the Osc pins not blue like Vcc and Gnd when there is no oscillator component in Simulide?  scratch

3My first MPLabX Empty Re: My first MPLabX Sat Apr 17, 2021 8:41 pm



Why is it showing File type not supported?
You probably clicked in"Compile" button.
For hex files you can only upload.

Why is the Mclr having no effect
You are rignt, there is a problem here.
I will have a look.

4My first MPLabX Empty Re: My first MPLabX Sat Apr 17, 2021 11:21 pm


Thank you, indeed I must have pressed Verify in stead of Upload.
I am not sure if I'll continue with these uC's, I am not an allrounder like you that knows about electronics and programming. Tried to compile CD5 
and took me 1.5 hour to find out that this line
void interrupt timer_isr()

is somehow not accepted anymore and should be replaced by this

void __interrupt () timer_isr()

5My first MPLabX Empty Re: My first MPLabX Sat Apr 17, 2021 11:47 pm



AVRs are very easy thanks to Arduino.
I remember a project trying to do the same with PICs named Pinguino (based in SDCC), but as far as I know it never was very successful.

I used SDCC compiler for PICs, but it is not as easy as using Arduino, you need to get into the compiler details and there are not many libraries, specially for 14 bit PICs.

Now I have no time to work in my own projects, so I'm a bit outdated with all this stuff.
Maybe there are new things out there...

6My first MPLabX Empty Re: My first MPLabX Sun Apr 18, 2021 3:06 pm


Maybe there are new things out there...

Yes, code language changes over time, next time I'll give myself an hour or so and when it still not builds I skip it and move on. Thanks for the search words pinguino and SDCC, it opens up lots of projects. I didn't download it, my laptop is getting saturated with only 15 out of 118 Gbyte left. 
The previous CD5 simulation is working like in the video. The video is messy but at 08:25 you can see a better demonstration. 
I tried CD6 today and it compiled the first time  Shocked  and is working on Simulide. 
Probably it's just the code that makes it compile at once but I did something different as well. When Mplab is opened you get al the previous projects listed, before you make a new one, like this

My first MPLabX Cd6-1610

With a right-click and 'close' I removed them. For Tool I kept it to None but it doesn't seem to make a difference wether you choose Simulator. Need to try some more to be certain.

This is the simulation

My first MPLabX Cd6-1611

using this hex-file

CD6 Video

The Lcd is flashing a little bit, it gets reloaded every few seconds or so but maybe it should be like that. Anyway, this chapter went very fast and smooth so that's positive to try some more.  Very Happy


Not sure if the Hex comes together with the Simu, so I put it in the code above.

arcachofo likes this post

7My first MPLabX Empty Re: My first MPLabX Mon Apr 19, 2021 9:36 am


arcachofo wrote:PNP not working solved in Rev 155.
Thank you, I use them often, like here

My first MPLabX Cd5b-110

I found the page where the CD-pic-projects are shown in order
This is about a car battery voltage meter with Pnp's in the schematic
Lots of troubles again and only partly solved. It started with this code at about line 102
void interrupt low_priority LowIsr(void)
after many shuffles and build errors and reopenings of the project it finally catched with this replacement
void __interrupt(low_priority) LowIsr(void)
Then I had to find the right display to connect to the right pin and it can only go up to about 9.77V and then the displays overflow and get mixed up again while in the original it can meassure up to 15V but I'm fine with this outcome because that issue most likely has more to do with the coding and I have no idea what effect my changes in the line above have had. 
And don't worry, I am not going to post every sim I make. This is a different chip, the 18F2520 and the MR is working  Wink 
I've opened a new GitHub that contains the simu- and the hex-file(s) for this and coming circuits.

Edit: A tip for other beginners, this circuit uses multiplexing. In the original schematic it is straight forward but in this sim the displays were mixed up. To see what is going on reduce the simulation speed to about 0.5%, you will find its properties with a right-click in the central panel, that is the drawing area.

8My first MPLabX Empty Re: My first MPLabX Wed Apr 21, 2021 12:04 am


A way to go around the 'only 1 Mcu' rule

My first MPLabX Cd8-1610

Multiple projects can now fit in one file. It's a counter, I made it faster like a stopwatch.
It's called CD8. Simu and Hex are here
This is the second time I had to use inverters(?) but at least the displays are not mixed up.

Update IC-socket component   Wink

My first MPLabX Cd9-1010

I received a message from the XC8 compiler. It said it didn't like my project path name and it could give problem. So instead of CD10-Pwm I now use a underscore like CD10_Pwm.
CD9&10 compiled at once so maybe it helped. Hex-files are on the Git.

Last edited by Mistral on Wed Apr 21, 2021 7:34 pm; edited 4 times in total (Reason for editing : Update)

9My first MPLabX Empty Re: My first MPLabX Thu Apr 29, 2021 10:25 am


Today I finished no.20 in the Circuit Digest Pic Projects, it's called Interrupts.
One thing to notice for people who want to start programming, the codes with interrupt do not compile unless this change has been made:
/****Interrupt function ****/
void __interrupt () ISR_example() // NEW SYNTAX WORKING

I myself do not program and only know little about it.
Sometimes CD adds a hex-file in their projects but many times they do not and for my own comfort I have put them in a new folder from now on.

Two pictures

My first MPLabX Cd20_i10

My first MPLabX Cd_9_u10


A few projects are difficult and perhaps impossible to simulate, for example Bluetooth, Infrared remote and Esp. Another one I did not manage to compile it.

edit: Another case of old syntax - ''unknown type name bit''.
change bit to __bit and it will build.

10My first MPLabX Empty Re: My first MPLabX Thu Apr 29, 2021 2:49 pm


11My first MPLabX Empty Re: My first MPLabX Tue May 04, 2021 11:18 pm


CD 21 until 33
21 starts here, it's called GSM 
33 ends here, it's called alarm clock

Examples that are difficult (or impossible(?)) to simulate are 21-Gsm, 25-Gps, 
27-Thermo module DS18B20,  30-I2C.

CD31 and 33 also use I2C and a DS3231 RTC but I managed to trick it a little bit with clock signals on the SDA SCL 16F877A chip pins so at least the LCD is responding.

A little bit more details are in the simu-file
Much more details are in the original Circuit Digest webpages.

Hex-files, CD25 is not there because I couldn't get it compiled.

My first MPLabX Cd_21_10

12My first MPLabX Empty Re: My first MPLabX Tue May 11, 2021 7:15 pm



Simulating a RFID card reader. Perhaps it can be done but it might take some code adjustments and a well designed input signal. Tried it but unsuccesfull  My first MPLabX 1f610 

My first MPLabX Rfid_r10

Orignal is here:
Header files Eusart1.h and Lcd.h are in this zip-project at bottom of page, just above video.
Took me already 1.5 hour to melt it together and compile.
This is not a request for help, maybe somebody wants to try it, that's all.  Wink

13My first MPLabX Empty Re: My first MPLabX Thu May 13, 2021 2:49 pm


I am not much of a programmer, sometimes I have to make some changes and if it succeeds it's not knowledge but trial and error. Lots of trial and errors. For example, I get message ' unknown type name 'bit' ', than I change the line bit status=0; to int status=0; and when I am lucky it Build Succeeds, which it did. By the way, this builds too:
__bit status=0; That is probably better to do. (in lcd.c)

I found something that might be of interest for readers who want to do the Circuit Digest Pic-examples, in real or simulated. There are about 53 of them:
and I noticed they wrote their own Lcd.h and Lcd.c files. You can also find them if you type lcd.h in search.

Problem is, going from example 1 untill the end these files change somewhat. Among example 1 to 53 sometimes there are zip-files to download a complete project, the mentioned files are included in that and if you compare them you will see what I mean.

At the moment I am doing example 34 Keypad until example 53, the last one. 
The article contains a zip, the link is just above the code.

What I noticed is that since this keypad example, all the next examples that make use of the HD44780, the second line never appears anymore on the screen. Searching and trying I found that this address needs to be changed:

#define LineTwo 0xC0
#define LineTwo 0xA8

That line is in lcd.c and in main.c there is a simular line(s) to be changed.

I would like to ask a question if it does not take too much time to answer.

Why is it that this address needs to be changed? Is it in the simulator, do they use another LCD at Circuit Digest or is it something else?  Thanks in advance.

Keypad is working now  Wink

My first MPLabX Keypad11



I solved my own challenge from the previous post, sort of.

My first MPLabX Rfid_r11

I used a shift register to get an irregular input signal at around 125 kHz, the frequency where this RFID is supposed to operate with, but with only a generator as input signal it works as well. Since the LCD's second line is working more examples can be simulated.

My first MPLabX Heart_10

14My first MPLabX Empty Re: My first MPLabX Fri May 14, 2021 9:20 am


Almost reaching the end of this pic-project ..
Sometimes it is not so easy to get a signal on the display and if it does than the next step is to get a value displayed. For example this one, you have to put around 20 kHz or else you don't get the Temp and Humidity to see. Tried to create a data stream with a counter and multiplexer but the values stay 00.


My first MPLabX Dht1110

This one needs to be set in order or else not working. First it needs to calibrate and get a Ohm value. That only happens between about 0 and 2 Volt on pin A0. Than it needs to detect gas, which is the sensor on/off button and than the Ohms on A0 need to change, somewhere between 1.5 and 2.5 Volt to get a ppm value.

My first MPLabX Cd50_g10

It helps to read the article and the code good to get an impression of what should happen but often it is just trying and hoping for luck some values will appear. And that is only the simulation part, most of the time went to getting the programs compiled. Scattered header files and the like is common practice among these examples. Anyway, writing the programs is much harder so I have respect for that.


The supporing files turn out to be here:


When finished I'll put the hex-files on Github, just three more to go.  rabbit

15My first MPLabX Empty Re: My first MPLabX Fri May 14, 2021 12:58 pm


Examples 51 to 53 are a bit too difficult for me to simulate, also again there is no zip-file to download, except in the last one, and they use some pic-micro's that are not avaible. No.51 is about IR, 52 SD Card and 53 Wireless.
So this concludes this MPLabX-Pic-CD project.  Wink

Source - counting down, no. 53 is at the top:

My first MPLabX Cd_34_10

16My first MPLabX Empty Re: My first MPLabX Sat May 15, 2021 12:14 am



#define LineTwo 0xC0
#define LineTwo 0xA8

That line is in lcd.c and in main.c there is a simular line(s) to be changed.

I would like to ask a question if it does not take too much time to answer.

Why is it that this address needs to be changed? Is it in the simulator, do they use another LCD at Circuit Digest or is it something else? Thanks in advance.
Check if both displays are exactly the same and use the same in simulide.
There are many displays based on HD44780: 1, 2 or 4 lines, 16 or 20 (or other) characters per line...

17My first MPLabX Empty Re: My first MPLabX Sun May 16, 2021 10:51 am


Thank you arcachofo, I am doing the last examples of Avr now and the Lcd is in there so I will have a look how that goes. 
After that I am not sure what to do next, perhaps the MyNor.

Sponsored content

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum