1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Help please with MPLAB X

Discussion in 'Microcontrollers' started by ljcox, Nov 30, 2017.

  1. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,226
    Likes:
    28
    Location:
    Melbourne Australia
    I recently downloaded MPLAB X since the PIC I'm currently using (16F1708) cannot be fully tested in MPLAB 8.92 since that PIC is not fully supported in 8.92.

    I have been able to import the programme into MPLAB x, but I can't see how to test it. There is a daunting array of info available but I can't find anything relevant to answer my question.

    In MPLAB 8.92, I used the function keys F7 & F9 to step through the programme so I could test it.

    But with MPLAB X, I cannot find the equivalent facilities.

    Any assistance will be appreciated.
    Len
     
  2. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,673
    Likes:
    947
    Location:
    Rochdale UK
    MPLABX is slightly different... Everything is contained within the project..

    Right click the project name in the projects window... Then select properties... It should open on the correct window.

    Conf: (default)... In the hardware window, swap to simulator.. From there its the same..
     
  3. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,226
    Likes:
    28
    Location:
    Melbourne Australia
    Thanks Ian,
    I did as you said, but I still can't simulate. I've tried everything I can think of to no avail. I must be missing something.
    A copy of the window is attached.

    When I click on the Debugger console button, the window is blank.
     

    Attached Files:

  4. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  5. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,566
    Likes:
    394
    Location:
    Brisbane Australia
    You need to press the debug button - the one with the green triangle. Your program will then be running, press the pause button to halt it and use F7 to single step. Or put a breakpoint on the first line.

    Mike.
     
    • Like Like x 1
  6. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,673
    Likes:
    947
    Location:
    Rochdale UK
    Simulation will only be available once you build the project successfully! I notice the "Run" button is greyed out!
    BUT!! I cant see the build tool on the ribbon.... Is the assembler present on the machine?

    EDIT!! Whoops I'm blind.... Click the hammer tool to build..
     
  7. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,226
    Likes:
    28
    Location:
    Melbourne Australia
    Thanks Ian & Mike,
    I took your advice & I'm was able to simulate.
    I had all of the buttons at the top of the Edit window.
    But when I closed the software & later re-opened it, all I have is the .asm and I can't see the Watch & Pins buttons.
    I have fooled around trying to find them without success.
    Please advise.
     
  8. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  9. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,673
    Likes:
    947
    Location:
    Rochdale UK
    Did you open the project or just the asm file.... I do that on occasion...
     
  10. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,566
    Likes:
    394
    Location:
    Brisbane Australia
    When you open MPLAB X it should be in the same state as when you closed it. I.E. with the same projects and files open. Except, it adds a start screen which you just close.

    Mike.
     
  11. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,226
    Likes:
    28
    Location:
    Melbourne Australia
    Ian,
    I opened the project
    Mike,
    When I open it, it is essentially blank. See the attachment. I had to fool around to go back (approximately) to where I was yesterday. But I could not get back to exactly where I was.
    I have V 4.01, what version do you both have? I noticed that there is a later version (V 4.01 was the latest when I downloaded) so I'm wondering if V 4.01 has some faults.
    I find it extremely frustrating. So I'm considering going to the later or to the previous version.
    Thanks for your help.
     

    Attached Files:

    • O_1.jpg
      O_1.jpg
      File size:
      140.4 KB
      Views:
      25
  12. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,566
    Likes:
    394
    Location:
    Brisbane Australia
    I'm using version 4.00 and have just closed and opened it and here is a screen shot. screen.png
    Note the open projects on the left and the open files at the top.

    Mike.
     
  13. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    5,159
    Likes:
    155
    Location:
    morristown,tn
    Mike He got the same thing he had open LOL it's like you said when you reopen it's the same as you left it LOL
    I do that all the time close it and not shut off the sim it comes back up just as it was

    Normal window
    Screenshot from 2017-12-01 22-39-52.png

    When I close it after closing project
    Screenshot from 2017-12-01 22-44-36.png

    You get it where you left it. If I had sim it would of looked like his post
    I like to never figured how to get a window back but now it's not bad I kind of like hiding them so I have a bigger editor
     
    Last edited: Dec 1, 2017
  14. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,566
    Likes:
    394
    Location:
    Brisbane Australia
    Just downloaded the latest version (4.05) and the actions are the same.

    As a test I did the following,
    Closed all projects
    Selected menu file/new project
    selected standalone project
    selected PIC16F1708
    Debug header: none
    Selected simulator
    Selected MPASM (5.76)
    Entered filename test
    Click finish

    Then, in the projects pane, I right click the source file tab and select new>pic_8b_general.asm and enter test as filename.

    Once this is done I use the config generator menu window>Pic Memory Views>Configuration bits to generate the beginning of the file.

    Let me know if this works for you.

    Mike.
     
  15. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    5,159
    Likes:
    155
    Location:
    morristown,tn
    Works for me same way i been doing it
     
  16. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,226
    Likes:
    28
    Location:
    Melbourne Australia
    I find I have to re-open the project & load the Stimulus file each time I start MPLAB X. But I can live with that.

    I can now use MPLAB X (as much as I need for the current programme) but the IOC is not working as I would expect.

    I'm using IOC to wake the PIC from sleep. (I'm not using an interrupt)
    But it does not work properly & I don't know why.

    The attachment Cases.pdf. shows the situation after it has (incorrectly) passed through sleep even though the change was processed before reaching sleep.

    Note that IOCAF is still = 0x20 (it should be 0) & INTCON is still = 0x0D (it should be 0x0C).

    Attachment also shows the situation after a negative edge. Again, it passed through sleep.

    I don't think there is anything wrong with my programme, so I assume it is a bug in v4.05.

    Any comments will be appreciated.
    Len
     

    Attached Files:

  17. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,280
    Likes:
    554
    Location:
    Cleveland, OH, USA
    I notice you have
    upload_2017-12-10_2-43-58.png

    That flag bit is read only:
    upload_2017-12-10_2-44-58.png
    And you have to clear it in the appropriate register for which you set the IOC, e.g, IOCxF (probably Bank 7):

    upload_2017-12-10_2-50-18.png

    That probably explains why IOCAF remains set.

    John
     
  18. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,673
    Likes:
    947
    Location:
    Rochdale UK
    Interrupt on change requires a read to the relevant port, or it will not clear.

    Once the interrupt fires. Read the port with a dummy then clear the flag..
     
  19. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,280
    Likes:
    554
    Location:
    Cleveland, OH, USA
    I disagree, at least with those chips. One must clear IOCxF. Reading the port is not necessary.

    upload_2017-12-10_6-39-13.png

    Using MCP logic, that makes sense. For example, If IOC is set only to a rising edge, it will not cause an event on the falling edge. Thus, there may be no detectable change in the port pin with a fast pulse. The flag, however, is a long-duration indicator of that change.
     
  20. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,673
    Likes:
    947
    Location:
    Rochdale UK
    Apologies John... I should have looked at the newer datasheets.. Still you made the point, the data is in the datasheet. They must have cleaned up the operation for the latest chips.
     
  21. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,226
    Likes:
    28
    Location:
    Melbourne Australia
    Thanks for the responses.
    I have been using "Close Project" each time when closing.
    So, inspired by one of the posts above, I tried going straight to exit.
    When I re-opened MPLAB X, the window was identical to the one I had closed.
    Thanks again,
    Len
     
  22. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,280
    Likes:
    554
    Location:
    Cleveland, OH, USA
    How is that related to this:
     

Share This Page