MPLab SIM question


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Posts
    20

    Default MPLab SIM question

    Well, my DS18B20 program is now running nicely on a PIC18F2620 with decimal values (Anyone interested in reading that thread can find it at http://www.picbasic.co.uk/forum/showthread.php?t=7533).

    Anyway, I discovered the fact that I can use MPLab SIM with PBP just 2 days ago and I am ecstatic! I tested some really basic PBP programs with MPLab SIM and was able to input to pins and read registers. Then I tried my DS18B20 program (the source-code is attached at the bottom of this post in text format).

    Consider the following lines from my program –
    Code:
    1	ReadDS18B20:  
    2   		OWOUT Comm_Pin, 1, [$CC, $44] ' Skip ROM search & do temp conversion
    3   		ReadBusy:
    4   		OWIN Comm_Pin, 4, [Busy] ' Read busy-bit
    5    		IF Busy = 0 THEN ReadBusy ' Loop until Busy=1 (Temp conversion complete)
    Here, Comm_Pin was set to PortB.4 at the top of the code somewhere (see the complete code). The problem I’m having is that after line 5, it jumps to line 3 and seems to be in an infinite loop. Of course I understand why it happens! It’s because PortB.4 never gets to 1 and this is where I ask for your help.

    I have tried to create a stimulus that sets RB4 to 1 at the beginning of the program and keeps it at 1 for good. But when I step through the program, I see RB4 changing periodically between 0 and 1. So, I am not able to simulate a valid bit “1” at RB4. Also, how does anyone go about implementing this:

    Code:
    OWIN Comm_Pin, 2, [RAWTEMP.LowByte, RAWTEMP.HighByte]
    I mean how can I simulate a bitstream arriving at PortB.4? Any help is much appreciated. Thanks.
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    never messed with this feature, but i think it's doable with Clock Stimulus and/or Pin/Register action

    Probably it's something i would never simulate anyways.. still and never been a sim user/fan
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Oct 2007
    Location
    Vancouver, BC, Canada
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    have you tried lower the pull up resistor ? I got the problem other day, and lower the resistor to 2k2 then everything work.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    pssst... it's more about MPLAB SIM
    Quote Originally Posted by POST #1
    my DS18B20 program is now running nicely on a PIC18F2620 .......I mean how can I simulate a bitstream arriving at PortB.4? Any help is much appreciated. Thanks.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Oct 2007
    Location
    Vancouver, BC, Canada
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    sorry, i misread.

  6. #6
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    966


    Did you find this post helpful? Yes | No

    Default

    It may be possible to do what you want. Look under Debugger->SCL generator->New workbook->Register injection.

    Here you will find that you can specify a stimulus file. I haven't used this feature, but I'm sure that it works and will be wonderful to use. I have played a lot with the stimulus features and can encourage others to try the simulator.

    Let us know how it goes with the injection feature.

Similar Threads

  1. MPLAB SIM timing vs Real life
    By Bronurstomp in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th July 2008, 16:32
  2. Linker/COFF debugging in MPLAB SIM
    By RichardBowser in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th January 2007, 18:28
  3. Using MPLAB SIM
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th July 2006, 04:20
  4. Tracing code in MPLAB Sim
    By ErnieM in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th August 2005, 16:00
  5. pause loop lockup with mplab sim
    By power67 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th February 2005, 13:10

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts