• Increase font size
  • Default font size
  • Decrease font size

gpsim tutorial

To build a robot it is often neccesery to create also a hardware. PIC programming is one of many possible options. I have chosen this way several times and hence know a good PIC simulator is very handy. I have found difficult to find any gpsim tutorial aimed on windows version of the gpsim out there. Therefor you may find one here:

Basics

This chapter will lead you in a very fast way to run your first gpsim simulation by running a .hex file.

1. gpsim download page can be found here. if you want to download a windows installer use this link instead.

2. install the gpsim. in my case into following directory: "c:\Program Files (x86)\gpsim\"

3. to run your code (as a hex file) in simulator (gpsim) the fastest way is this:
- open command prompt
- execute following command  (correct path if neccesery).

 "c:\Program Files (x86)\gpsim\bin\gpsim.exe" 

it will start up the gpsim and at least 1 new window should be displayed - main GUI. You should stay in your command prompt window though. You may notice that command prompt has changed a little bit. Something like "**gpsim>" should be displayed at the beginning of the command prompt which tells you that gpsim is running and ready to accept your commands.

- now execute following command:

 processor list 

the list of all supported PIC processors is displayed. choose the one you will use for the simulation. Let's say "pic16f84".

- quit the gpsim by issuing following command:

 quit 

you may notice that the beginning of the new line on command prompt has returned to its standard form - "C:\Users\Jon.Doe>" in my case.

- now you are finally able to run a simulation. To do this execute following command (correct path if neccesery):

"c:\Program Files (x86)\gpsim\bin\gpsim.exe" -pp16f84 c:\_cc5x\_Projects\Clock_generator\clock_generator_v01.hex

it will run "gpsim.exe" with parameter "-pp16f84" (this tells to gpsim that your processor is pic16f84) and then follows path to your .hex file - in my case "clock_generator_v01.hex".

Breadboard

This chapter will show you a basic usage of the breadboard functionality which I found the most important during the simulation. We will connect a PORTB0 port of the PIC to the LED module.

1. open Breadboard window by clicking: "Windows/Breadboard"

2. click "Add library" button and enter following text into the displayed input window: "libgpsim_modules.dll" and click "OK".

3. click "Add module" button. New window is displayed. The window contains list of many different modules, eg. switch, led, etc.

4. let's choose "led" as our new module. Click on it and enter its name afterward "led1".

* if mouse is not working for the window use keyboard instead - tab to navigate from input box to OK button.

5. a picture of the let module is now displayed in the breadboard window. click on a "+" sign of the led1 element in the upper left corner to display its ports. following situation should be shown:

- led1
- led1.in

- by clicking on "led1" you display properties of the module.

- by clicking on "led1.in" in the lower left part you display nodes/stimulus that are connected to the input port (since its name is led1.in) of this module. since we have not made any connection yet following situation should be shown:

Stimulus led1.in

Not connected

6. to create a node push "Add node" button and enter its name, for instance "node_led1".

7. now we are finally able to connect a PIC output port to the led1 module. the "node_led1" node serves for this purpous.
- click on "led1.in" and pusth the "Connect stimulus to node" button. double click on "node_led1" item in the displayed window.
- click on "+" sign of the p16f84 processor. list of all its ports is displayed. select "portb0" and pusth the "Connect stimulus to node" button. now select the same node as in the previous step - "node_led1".
- to check the new connection click on "+" sign of the nodes and select "node_led1" node. in the lower left part of the window both ports led1.in and portb0 should be displayed.

STC file

Maybe more convienient way to set up whole simulatin in breadboard is to code it. If this is your case you may use .stc files.

1. in the same directory as your .hex file create a new text file called for instance clock_generator_v01.stc

2. put following code into the file:

processor pic16f84
 
 load clock_generator_v01.hex
 frequency 32768
 
 # Processor position:
 p16f84.xpos = 50
 p16f84.ypos = 50
 
 # Modules:
 module library libgpsim_modules.dll
 
 module load led led1
 led1.color = green
 led1.xpos = 100
 led1.ypos = 350
 
 module load led led2
 led2.color = green
 led2.xpos = 100
 led2.ypos = 400
 
 # Connections:
 node n_led1
 attach n_led1 portb0 led1.in
 
 node n_led2
 attach n_led2 portb1 led2.in

 #scope.ch0 = "portb0"
 #scope.ch1 = "portb1"
 #scope.ch2 = "portb2"

 #break at interruption
 #break e 0x0004

 #break at specific instruction execution
 #break e 0x003f

 #break on write to 0x1A
 break w 0x1A
 

3. now you can run the simulation simply by calling:

"c:\Program Files (x86)\gpsim\bin\gpsim.exe" -c c:\_cc5x\_Projects\Clock_generator\clock_generator_v02.stc

 

Comments  

 
0 #305 3win8 casino 2019-05-20 08:44
In this way, could possibly ask for whch youu want without criticizing,
condemning, or complaining. She was irritating andd finally ggot the judge to do what was
right. Seeing him should not be a duration of drama.


my web page :: 3win8 casino: http://winslot.club/index.php/download/46-3win8
Quote
 
 
0 #304 ocean king vessel 2019-05-20 03:30
Someone notifies you that on the subject of the traffic today comes form top
search engines like Google, Yahoo and MSN. Its place on the web caan fundamentally be marked if for example the sjte is
marketed clearly.

my homepage ocean king vessel: http://goodpastureproperties.com/__media__/js/netsoltrademark.php?d=www.badmoon-racing.jp%2Fframe%2F%3Furl%3Dhttp%3A%2F%2F918kiss.poker%2Fcasino-games%2F71-joker123
Quote
 
 
0 #303 ntc33 download 2019-05-20 00:21
Think hard and reason out the points for and against your approaches.
Arre you going to day trade, or hold your positions ffor periods?
There are about five different involving online dating
services.

my weblog - ntc33 download: https://Kslot.app/index.php/games/ntc33
Quote
 
 
0 #302 scr888 new apk 2019-05-19 17:45
Both of thdm were ardent fans of the Melvin's because they were
interested, so mch in creating their own band. In 1996, the band toured
extensively, tto retain the album. As far as I'm concerned still the 1970s rule!


my page :: scr888
new apk: http://scr888slot.angelfire.com/
Quote
 
 
0 #301 scr888 latest update 2019-05-19 17:44
This app is perfect for bar hopping and pub crawls. Getting in tluch witth
new networks, but is supposed to keep your personal cell phone
nimber private? Of course, the new nummber will visible on the cell phone, but why
think?

My page :: scr888
latest update: http://myslot.live/index.php/games/918kiss/4-918kiss
Quote
 
 
0 #300 scr888 latest update 2019-05-19 17:44
This app is perfect for bar hopping and pub crawls. Getting in tluch witth
new networks, but is supposed to keep your personal cell phone
nimber private? Of course, the new nummber will visible on the cell phone, but why
think?

My page :: scr888
latest update: http://myslot.live/index.php/games/918kiss/4-918kiss
Quote
 
 
0 #299 play8oy install 2019-05-19 17:25
Very good article. I am experiencing mawny of these issues as well..


Here is my weblog: play8oy
install: http://watersafetyinstruction.com/__media__/js/netsoltrademark.php?d=m-Grp.ru%2Fredirect.php%3Furl%3Dhttp%3A%2F%2F918.network%2Fdownloads%2F86-play8oy
Quote
 
 
0 #298 xbox live casino 2019-05-19 09:33
Wonderful article! We are linking to thuis great content on our
website. Keep up the good writing.

Take a look at my web-site xbox live casino: http://Halohaircrown.com/__media__/js/netsoltrademark.php?d=Zow.hackerscampus.com%2F__media__%2Fjs%2Fnetsoltrademark.php%3Fd%3D918.network%2Fcasino-games%2F75-ace333
Quote
 
 
0 #297 3win8 slot 2019-05-19 03:47
Viral marketing is the ability getting others to spread the word about goods or choice.
If you are a newbie, did you know have any idea where to get into.
Now, here could be the punchline, so to speak.
Quote
 
 
0 #296 newtown ntc33 2019-05-18 13:11
You could invariably draw resources and present the facts in person words.
It's very important in order to mention give away the whole solution to the problem.
These several of reduce based businesses available today.
Quote
 
 
0 #295 rollex11 login 2019-05-18 11:02
And in most cases, you are going to nothing to show for that it.
Read the instructions carefully on each of the building products you
usage. I really enjoyed creating my own boat.
Quote
 
 
0 #294 rollex11 login 2019-05-18 11:02
And in most cases, you are going to nothing to show for that it.
Read the instructions carefully on each of the building products you
usage. I really enjoyed creating my own boat.
Quote
 
 
0 #293 mobile slot game 2019-05-18 10:58
The Spiritual Gift For Being Irritating
Quote
 
 
0 #292 918kiss 2019-05-18 04:44
There are other ways as well that are good marketing your blog.
Start making your information for individuals that are going to be
reading your stuff. Attempt to find the low numbers in local amount of searches.
Quote
 
 
0 #291 joker123 casino 2019-05-18 04:21
Just find some clients that looking for writers. Focus
to details is actually one of your most important article
marketing secrets. These links always be on pages that are
working in the same niche as yours.
Quote
 
 
0 #290 ace333 apk download 2019-05-17 19:46
We're talking about 400-600 conditions.that's one page!
Therefore, select a subject that you really like, and
are savvy, to your first world wide web site.

Try to different and different with your marketing.
Quote
 
 
0 #289 ocean king meaning 2019-05-17 17:03
You can try video marketing, article marketing, pay per click,
and even search engine optimization. Various search engines love
article directory sites just mainly because
they do weblogs.
Quote
 
 
0 #288 playboy casino 2019-05-17 12:41
Kim has 392 fans and keeps them well entertained and intelligent.
Then they hire copy writers and now have it created by him.
Remember a person can are optimizing individual pages to rank well.
Is the page caused by your marketing?
Quote
 
 
0 #287 3win8 slot 2019-05-17 10:04
There is just about the way of accomplishing this that out
ways another programme. SEO is not something you do for 8 hours single time and then never ought to bother about again. Their firm is designing website.
Quote
 
 
0 #286 scr888 version 2.0 2019-05-17 09:00
So from my stand point, this tool will they offer you the easiest and
safest way to reset your forgotten Windows password. Watching TV, listening music and
reading eBooks, all becomes so splendid! Recently I met many similar situations.
Quote
 
 
0 #285 scr888 latest update 2019-05-17 07:58
His show was later moved to 2 to 4 PM with the last hour being broadcast nationally on ESPN Radio.
It's time to grab your MP3 player, boot up the computer and personalize your soundtrack.
Quote
 

Add comment

No bad words.


Security code
Refresh


Design by i-cons.ch / etosha-namibia.ch