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

AVR projects using Microchip Studio

2 posters

Go down  Message [Page 1 of 1]

1AVR projects using Microchip Studio Empty AVR projects using Microchip Studio Wed May 05, 2021 1:55 am

Mistral


This opening post is intended to get you started quickly. 
I downloaded Microchip Studio a while ago and probably I got it from here:
https://www.microchip.com/en-us/development-tools-tools-and-software/microchip-studio-for-avr-and-sam-devices#Downloads

Once opened click File-New-Project
Next you have to choose something from these options

AVR projects using Microchip Studio Mcstud10

I chose GCC C Executable Project and gave it a name and a Location to save it into. Click OK.
Next pick a device, in this example it will be Atmega32

AVR projects using Microchip Studio Mcstud11


Paste your code in main.c


AVR projects using Microchip Studio Mcstud12

Next in the topbar click on Build-Build Solution. This will automatically generate a .hex file in the same Location in the debug subfolder, if the build was succesfull. From this point MCStudio is not needed anymore and we can continue in Simulide.

This line sets the uC frequency
#define F_CPU 1000000
In SimulIDE double click on the Atmega32 or right click and go to Properties to set the Mhz at 1.
Right click again and Load Firmware with the hex.

AVR projects using Microchip Studio Mcstud13

Code is from Circuit Digest - AVR Projects 
https://circuitdigest.com/avr-microcontroller-projects?page=4
with title Led Blinking

2AVR projects using Microchip Studio Empty Re: AVR projects using Microchip Studio Wed May 05, 2021 2:05 pm

Mistral


Simulide is a very good tool to learn programming 

AVR projects using Microchip Studio Avr210

I am not planning to go too deep into programming anymore but for younger people a simulation program like this can be very handy and educational.
The original code is from here but that didn't do much interesting
https://circuitdigest.com/microcontroller-projects/lcd-interfacing-with-atmega32-avr
https://circuitdigest.com/article/16x2-lcd-display-module-pinout-datasheet

I changed some lines, here a snippet from it
Code:
send_a_character (0x20); // ASCII code for 'space'
 send_a_character (0x74); // ASCII code for 't'
 send_a_character (0x6F); // ASCII code for '0'
 send_a_command   (0xC0); // activate second row position 0
 send_a_character (0x53); // ASCII code for 'S'
 send_a_character (0x69); // ASCII code for 'i'
 send_a_character (0x6D); // ASCII code for 'm'

I had no idea if it would work but just tried it and it did.

Anyway, I have opened a new Github and in the coming days there will be a bunch of examples there just like in the MPLab topic. Why you need MPLab and MCStudio? MPLab is only for pic-microcontrollers as fas as I know. If you want to select a pic-device in MCStudio it will not be there. And of course there are other compiler IDE's, I am using these.

https://github.com/Alectus/AVR-MicroController-Examples

3AVR projects using Microchip Studio Empty Re: AVR projects using Microchip Studio Fri May 07, 2021 10:48 pm

Mistral


I would like to connect a Help-topic with this project because they are related. It is this one >
https://simulide.forumotion.com/t201-adc-error-in-code-or-in-atmega32-or-human-error#1043

AVR1, Blink Led, begins here
https://circuitdigest.com/avr-microcontroller-projects?page=4
AVR11, Ultrasonic sensor HC-SR04, ends here
https://circuitdigest.com/avr-microcontroller-projects?page=3

Because there was/is some problem with ADC to LCD there are 8 more extra test-examples added from other websites. 
https://github.com/Alectus/AVR-MicroController-Examples/blob/main/AVR%201-11%20plus%208%20extra_.simu


The hex-files are on the same github in a folder. 
I will need a new Simulide sheet because this one is full.

AVR projects using Microchip Studio Avr_1-10

4AVR projects using Microchip Studio Empty Re: AVR projects using Microchip Studio Mon May 10, 2021 11:36 am

Mistral


The following Alarm Clock I find extra nice so I post it separate and I have a question too.
I am doing Avr-projects/examples from Circuit Digest and many of them are with Atm8 plus Lcd. Somehow the Lcd+Atm8 never work but when I try a simular example from an other website it does. So it must be somewhere in the coding and I can't find it. Anyway, that is not my question, it is about fuses. As I understand it you have to set a fuse if you are using a external oscillator, as shown here:

https://www.youtube.com/watch?v=lHv1tHjrb6w
https://github.com/MicrocontrollersAndMore/Atmel_Programming_Tutorial_2_Fuses_and_Using_an_External_Oscillator/blob/master/ATmega328P%20fuse%20settings%20for%2020%20MHz%20external%20xtal%20osc.png

I found that setting this fuse or not does not seem to matter? And does this mean you will never have to change fuses in Simulide?

The alarm clock comes from here:
https://circuitdigest.com/microcontroller-projects/digital-alarm-clock-using-avr

AVR projects using Microchip Studio Avr22_10


Hex-file:
Code:
:100000000C942A000C9447000C9447000C94470071
:100010000C9447000C9447000C9447000C94490042
:100020000C9447000C9447000C9447000C94470034
:100030000C9447000C9447000C9447000C94470024
:100040000C9447000C9447000C9447000C94470014
:100050000C94470011241FBECFE5D8E0DEBFCDBF12
:1000600010E0A0E6B0E0E0E1F7E002C005900D92FC
:10007000AA37B107D9F720E0AAE7B0E001C01D9286
:10008000A038B207E1F70E94D3000C9486030C94C9
:1000900000001F920F920FB60F9211248F939F931F
:1000A00080917E0090917F00CC974CF480917E00EF
:1000B00090917F00019690937F0080937E008091C5
:1000C0007E0090917F00CC9799F480917C00909174
:1000D0007D00CC974CF480917C0090917D0001963E
:1000E00090937D0080937C0010927F0010927E00A0
:1000F00080917C0090917D00CC9799F480917A005A
:1001000090917B0048974CF480917A0090917B000D
:10011000019690937B0080937A0010927D0010925C
:100120007C0080917A0090917B00489721F4109296
:100130007B0010927A009F918F910F900FBE0F90CD
:100140001F90189588BB82B38F7B82BB82B380627D
:1001500082BB86E690E20197F1F7000082B3807CD3
:1001600082BB8FEF88BB089588BB82B3806482BB5B
:1001700082B3806282BB86E690E20197F1F70000CD
:1001800082B3807C82BB8FEF88BB0895CF93DF93CF
:10019000EC0103C021960E94B40088818111FACF3E
:1001A000DF91CF910895CF93DF93CDB7DEB72C9732
:1001B0000FB6F894DEBF0FBECDBF80EC8ABB8FEFC9
:1001C00087BB81BB8EB58D608EBD80E39AE29BBDFF
:1001D0008ABD789489B7806189BF81E00E94A200BE
:1001E0002FEF8FEA91E0215080409040E1F700C06E
:1001F000000088E30E94A2002FEF8FEA91E02150D7
:1002000080409040E1F700C000008FE00E94A20013
:100210002FEF8FEA91E0215080409040E1F700C03D
:100220000000E12CF12CC12CD12C80917A0090910E
:100230007B000AE010E0B8010E942903CB014AE0EC
:10024000BE016B5F7F4F0E945103CE0105960E9455
:10025000C60080917A0090917B00B8010E9429032A
:100260004AE0BE016B5F7F4F0E945103CE010596AD
:100270000E94C60087E790E00E94C60083E80E94C3
:10028000A20080917C0090917D00B8010E9429031A
:10029000CB014AE0BE016D5F7F4F0E945103CE014A
:1002A00003960E94C60080917C0090917D00B80169
:1002B0000E9429034AE0BE016D5F7F4F0E945103F7
:1002C000CE0103960E94C60085E80E94A20087E73F
:1002D00090E00E94C60086E80E94A20080917E0005
:1002E00090917F00B8010E942903CB014AE0BE0132
:1002F0006F5F7F4F0E945103CE0101960E94C6009E
:1003000080917E0090917F00B8010E9429034AE00D
:10031000BE016F5F7F4F0E945103CE0101960E9484
:10032000C600CD9B26C080E690E00E94C6004091AA
:100330007A0050917B0020917C0030917D0091E00B
:10034000E416F50609F090E081E0C216D30609F044
:1003500080E0892320917E0030917F0091E0232B63
:1003600009F090E0882329F0992319F08BB3806875
:100370008BBBCD9907C089E690E00E94C6008BB385
:100380008F778BBB80EC0E94A20082E790E00E94F6
:10039000C60087EC0E94A2000AE010E0C701B80185
:1003A0000E9429039B015C014AE0BE01655F7F4F0B
:1003B000C9010E945103CE010B960E94C6004AE07B
:1003C000BE01655F7F4FC5010E945103CE010B96B0
:1003D0000E94C60089EC0E94A20087E790E00E947C
:1003E000C6008AEC0E94A200C601B8010E9429033F
:1003F0009B018C014AE0BE01675F7F4FC9010E94EB
:100400005103CE0109960E94C6004AE0BE01675F13
:100410007F4FC8010E945103CE0109960E94C60079
:100420008CEC0E94A20087E790E00E94C6008DEC51
:100430000E94A2004AE0BE01695F7F4F80E090E029
:100440000E945103CE0107960E94C6004AE0BE01F9
:10045000695F7F4F80E090E00E945103CE010796D4
:100460000E94C60080E80E94A200CC9B91C0C8995F
:1004700038C080917C0090917D00CC978CF4809165
:100480007C0090917D00019690937D0080937C008C
:100490002CEC8CE697E0215080409040E1F700C0C2
:1004A00080917C0090917D00CC97D9F480917A0066
:1004B00090917B0048974CF480917A0090917B005A
:1004C000019690937B0080937A0010927D001092A9
:1004D0007C002CEC8CE697E0215080409040E1F7C6
:1004E00000C0C99918C080917C0090917D001816B9
:1004F00019068CF480917C0090917D000197909377
:100500007D0080937C002CEC8CE697E021508040AD
:100510009040E1F700C0CA9921C080917A00909183
:100520007B0048974CF480917A0090917B00019673
:1005300090937B0080937A002CEC8CE697E021501E
:1005400080409040E1F700C080917A0090917B005C
:10055000489721F410927B0010927A00CB9918C032
:1005600080917A0090917B00181619068CF4809186
:100570007A0090917B00019790937B0080937A00A2
:100580002CEC8CE697E0215080409040E1F700C0D1
:10059000CC994BCEC89924C02CE3C216D1045CF48C
:1005A0008FEFC81AD80A9CEC2CE687E091502040C7
:1005B0008040E1F700C09CE3C916D10489F428E12A
:1005C000E216F1041CF48FEFE81AF80A9CEC2CE612
:1005D00087E0915020408040E1F700C0C12CD12C31
:1005E000C9990EC01C141D045CF491E0C91AD1080D
:1005F0002CEC8CE697E0215080409040E1F700C061
:10060000CA9915C028E1E216F1041CF48FEFE81A2C
:10061000F80A9CEC2CE687E0915020408040E1F7FE
:1006200000C098E1E916F10411F4E12CF12CCB990A
:10063000FCCD1E141F040CF0F8CD21E0E21AF108E5
:100640008CEC9CE627E0815090402040E1F700C010
:10065000ECCD97FB072E16F4009407D077FD09D058
:100660000E943D0307FC05D03EF4909581959F4F75
:100670000895709561957F4F0895AA1BBB1B51E1AA
:1006800007C0AA1FBB1FA617B70710F0A61BB70B02
:10069000881F991F5A95A9F780959095BC01CD01A7
:1006A0000895BB274A3031F4992322F4BDE2909596
:1006B00081959F4F0C945D03BB27FB015527AA270B
:1006C000880F991FAA1FA41710F0A41B83955051DF
:1006D000B9F7A05DAA3308F0A95DA193009779F757
:1006E000B111B1931192CB010C947603DC01FC01A2
:1006F000672F71917723E1F7329704C07C916D9356
:1007000070836291AE17BF07C8F30895F894FFCFC6
:1007100020414C4D3A4F4E200020414C4D3A4F461F
:0A0720004600414C41524D3A0000E2
:00000001FF

Although the used Lcd commands are very very similar for Atm8 and Atm32 it is so far only the 32 in the CD-examples that connects good with the Lcd. But like I said, different Lcd codes from other websites work good with Atm8 so it can't be a Simulide problem.
For example this Atm8 - Lcd not working although it has a pretty straight forward set-up:
https://circuitdigest.com/microcontroller-projects/flex-sensor-interfacing-with-atmega8

+++++++++++++++++++++

Returning to my question, I found this:

AVR projects using Microchip Studio 08764f22b652cc5688bd2e145c628624?r=pg&d=https%3A%2F%2Fa.fsdn.com%2Fallura%2Fnf%2F1620243033%2F_ew_%2Ftheme%2Fsftheme%2Fimages%2Fsandiego%2Ficons%2Fdefault-avatar

Ronomir 2018-08-29

I want to suggest the possibility to expose fuses in microcontrollers AVR.
 




  • AVR projects using Microchip Studio User_icon?1502824599&w=32
    Santiago 2018-08-30

    I will have a look to see how to expose fuses, but i'm not sure...
    I have to think about it.

    Regards.



https://sourceforge.net/p/simulide/discussion/bugs/thread/d1c5b687/

I assume there is no fuse setting option in Simulide, unless it has been added since then? Not that I need it now, setting the MHz in Proporties works just as well but that is not the only fuse that can be set, although I didn't see examples yet for the other ones.

5AVR projects using Microchip Studio Empty Re: AVR projects using Microchip Studio Mon May 10, 2021 5:40 pm

arcachofo

arcachofo
As I understand it you have to set a fuse if you are using a external oscillator, as shown here:
...
I found that setting this fuse or not does not seem to matter? And does this mean you will never have to change fuses in Simulide?
Fuses about MCU clock speed have no effect in simulide, because that speed is set by the user.
But there are other fuses that can have an effect.


I assume there is no fuse setting option in Simulide, unless it has been added since then? Not that I need it now, setting the MHz in Proporties works just as well but that is not the only fuse that can be set, although I didn't see examples yet for the other ones.
By now the only way to configure fuses is in your firmware.
There is no way to do it from simulide.

6AVR projects using Microchip Studio Empty Re: AVR projects using Microchip Studio Mon May 10, 2021 9:14 pm

Mistral


Ok, so I can stop looking for fuses, thank you, I was not sure if they were hidden somewhere. 
I changed some fuse settings in MCStudio but I noticed after pressing program that the hex-file that was created before did not get updated, it still had the old time of creation. But before I start asking more questions I should better read some more about AvrDude 
https://www.ladyada.net/learn/avr/avrdude.html
and in Simulide microcontroller properties what the Init gdb and Auto Load are for.
At the moment I don't have need for it but maybe other readers have the same question in mind.

I filled another sheet with examples and most of them are working nice, especially the alarm clock above. After maybe two hours it had a mismatch of only 5 minutes. Another one with matrix is also very nice to see it scrolling. 

Picture:
https://raw.githubusercontent.com/Alectus/AVR-MicroController-Examples/main/AVR%2012-29%20plus%202%20extra.PNG
Simu-file:
https://github.com/Alectus/AVR-MicroController-Examples/blob/main/AVR%2012-29%20plus%202%20extra.simu
Folder with Hex-files:
https://github.com/Alectus/AVR-MicroController-Examples/tree/main/AVR%2012-29%20Hex%20Files

AVR projects using Microchip Studio Avr_1210

I forgot to mention the source.
AVR 12 - Touch Keypad starts here:
https://circuitdigest.com/avr-microcontroller-projects?page=3

7AVR projects using Microchip Studio Empty Re: AVR projects using Microchip Studio Wed May 19, 2021 3:27 pm

Mistral


This is the last part of microcontroller examples made with Simulide. Not all of them work, like GPS or RTC or Fingerprint and only the display or 7-segments will give some output. It ends with no. 44 on this webpage at the top, Fuse Bits. Count down from there to find the other examples as I have numbered and named them if you want to try one.
https://circuitdigest.com/avr-microcontroller-projects

Picture:
https://raw.githubusercontent.com/Alectus/AVR-MicroController-Examples/main/AVR%2030-44%20completed.PNG
Simu-file:
https://github.com/Alectus/AVR-MicroController-Examples/blob/main/AVR%2030-44%20completed.simu
Hex-files:
https://github.com/Alectus/AVR-MicroController-Examples/tree/main/AVR%2030-44%20Hex%20Files

AVR projects using Microchip Studio Avr_3010

Sponsored content


Back to top  Message [Page 1 of 1]

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