gnupic: Re: [gnupic] simulating pic 101 flasher


Previous by date: 18 Nov 2006 20:56:00 +0000 gpsim & Mandriva 2007, Pete
Next by date: 18 Nov 2006 20:56:00 +0000 Re: [gnupic] simulating pic 101 flasher, Maxim Wexler
Previous in thread:
Next in thread: 18 Nov 2006 20:56:00 +0000 Re: [gnupic] simulating pic 101 flasher, Maxim Wexler

Subject: Re: [gnupic] simulating pic 101 flasher
From: "Scott Dattalo" ####@####.####
Date: 18 Nov 2006 20:56:00 +0000
Message-Id: <60204.71.139.0.37.1163882092.squirrel@ruckus.brouhaha.com>

On Sat, 2006-11-18 at 09:59 -0700, Maxim Wexler wrote:


> Here's a simple led flasher from the web adapted for gpsim:

 ; you probably want this:
   movlw 0

>     ;simulate gnd
>     tris PORTA
>     clrf PORTA


> Heres the stc file modeled after mod_test.stc:


> attach Cat porta0 D0.Cat
> attach An0 portb0 D0.An0

The LED module is only a single terminal device.

> Here's the error msgs:
>
> ***ERROR: syntax error, unexpected LITERAL_STRING_T, expecting EOLN_T
> while
> parsing:
> 'D0.Cat'
>  Last command: attach Cat porta0 D0.Cat

Which explains that error message.

In general, you can query a device's pin names by:

gpsim> symbol D1.

D1 = Leds::Led
D1.in =  stimulus  attached to An1
 Vth=5V Zth=1e+08 ohms Cth=0F nodeVoltage= 2.65V
 Driving=0 drivingState=0 drivenState=1 bitState=Z
D1.xpos = 264.0000000000000
D1.ypos = 276.0000000000000

The ending '.' is like a wild card expansion character. All symbols in teh
symbol table beginning with D1 will get displayed. And as you may see, the
diode D1 has only one pin named 'in'.

Here's an .stc file that has the correct connections and places the diodes
in reasonable locations:

--------

# Script for testing modules
#
# The purpose of this script is to load a simple
# program for a PIC (16F84), load the gpsim module library,
# and illustrate how modules can be connected to pics.


load s chaser.cod

# load the gpsim module library. Not that this is a 'shared library'.
# If the library fails to load then 1) it's not installed (try installing
# gpsim) 2) or the path to library is not available (see the documentation
# on modules).

module library libgpsim_modules.so

# display all of the modules that are in the library:
# module list

# load modules from the module library and give them names

module load led D0
module load led D1
module load led D2
module load led D3
module load led D4
module load led D5
module load led D6
module load led D7

# create nodes that can connect the Pic and the leds.

node An0
node An1
node An2
node An3
node An4
node An5
node An6
node An7

attach An0 portb0 D0.in
attach An1 portb1 D1.in
attach An2 portb2 D2.in
attach An3 portb3 D3.in
attach An4 portb4 D4.in
attach An5 portb5 D5.in
attach An6 portb6 D6.in
attach An7 portb7 D7.in

D0.xpos = 300.0
D0.ypos = 276.0
D1.xpos = 264.0
D1.ypos = 276.0
D2.xpos = 228.0
D2.ypos = 276.0
D3.xpos = 192.0
D3.ypos = 276.0
D4.xpos = 156.0
D4.ypos = 276.0
D5.xpos = 120.0
D5.ypos = 276.0
D6.xpos = 84.0
D6.ypos = 276.0
D7.xpos = 48.0
D7.ypos = 276.0

-----------

Scott


Previous by date: 18 Nov 2006 20:56:00 +0000 gpsim & Mandriva 2007, Pete
Next by date: 18 Nov 2006 20:56:00 +0000 Re: [gnupic] simulating pic 101 flasher, Maxim Wexler
Previous in thread:
Next in thread: 18 Nov 2006 20:56:00 +0000 Re: [gnupic] simulating pic 101 flasher, Maxim Wexler


Powered by ezmlm-browse 0.20.