Searching \ for 'MPSIM - How to?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/index.htm?key=mpsim+how
Search entire site for: 'MPSIM - How to?'.

Truncated match.
PICList Thread
'MPSIM - How to?'
1997\01\15@104402 by Scott Horton

flavicon
face
I want to simulate the reception of 4 bytes (rs232 format 9600 baud with 1
stop, and 1 start bit) by a 16C84 in MPSIM.  I'm running the PIC at 4Mhz
so the bits are 104 steps long.  I don't know how to do the timing or how
to make a pin stay high for a bit-long period of time.

Can anyone tell me how to setup the stimulus file?  I'd like to recieve
these
4 bytes about 40 cycles into the program.

Thanks very much in advance for any help/pointers.

Scott

1997\01\15@115328 by myke predko

flavicon
face
Scott Horton wrote:

>I want to simulate the reception of 4 bytes (rs232 format 9600 baud with 1
>stop, and 1 start bit) by a 16C84 in MPSIM.  I'm running the PIC at 4Mhz
>so the bits are 104 steps long.  I don't know how to do the timing or how
>to make a pin stay high for a bit-long period of time.
>
>Can anyone tell me how to setup the stimulus file?  I'd like to recieve
>these
>4 bytes about 40 cycles into the program.

Actually, you've done all the hard stuff.

The Stimulus file is pretty easy.  The first part is defining the pins to be
used, followed by the actual data.  ie to send "A" (0x041) to the PIC pin
RBO, I would use the format:


STEP    RB0                     !  Define the Port Registers
  1      1                     !  Start with everything high
                               !
1000      0                     !  Start Bit after 1000 cycle delay to allow
                               !   Program to Start up
1104      1                     !  Bit 0
1208      0                     !  Bit 1
1312      0                     !  Bit 2
1416      0                     !  Bit 3
1520      0                     !  Bit 4
1624      0                     !  Bit 5
1728      1                     !  Bit 6
1832      0                     !  Bit 7
1936      1                     !  Stop Bit

That's about it.  For your next four characters, just put them in line.

One of these days I'll write that Graphical Stimulus Generator.

myke


A New Era in Computing:

HAL 9000

Born January 12, 1997 - Urbana Illinois

1997\01\15@121700 by Tony Brock-Fisher

flavicon
face
After you get your RS-232 receive routine tested, would you send it to
me? No one has yet responded to my request for PIC libraires/routines.
RS-232 is one thing I was specificly looking for. In .asm format.

-Tony

1997\01\15@135711 by Scott Horton

flavicon
face
=->Scott wrote:
=->>I want to simulate the reception of 4 bytes (rs232 format 9600 baud
with 1
=->>stop, and 1 start bit) by a 16C84 in MPSIM.
snip

Myke wrote:
snip
=->Actually, youv'e done all the hard stuff.
=->The Stimulus file is pretty easy.  The first part is defining the pins
to be
=->used, followed by the actual data.  ie to send "A" (0x041) to the PIC
pin
=->RBO, I would use the format:
=->
=->
=->STEP    RB0                     !  Define the Port Registers
=->   1      1                     !  Start with everything high
=->                                !
=->1000      0                     !  Start Bit after 1000 cycle delay to
allow
=->                                !   Program to Start up
=->1104      1                     !  Bit 0
=->1208      0                     !  Bit 1
=->1312      0                     !  Bit 2
snip


Myke,

What if I want the pins to be high for the duration of the bit?  Do the
commands above "toggle" the pin's state or would I have to do something
like:
.
.
1104        1
1105        1
1106        1
.
etc.
.
1206        1
1207        1
1208        0     <- Next bit
1209        0
etc...

???

TIA,

Scott

1997\01\15@172532 by myke predko

flavicon
face
{Quote hidden}

Scott, they will stay at the last state until they are explicitly changed
(you don't have to worry about doing each and every clock cycle).

The sample I gave you will send out serially ASCII "A" without it just being
glitches.

myke


A New Era in Computing:

HAL 9000

Born January 12, 1997 - Urbana Illinois

More... (looser matching)
- Last day of these posts
- In 1997 , 1998 only
- Today
- New search...