PIC's ports individual bits manipulation - how to?


Closed Thread
Results 1 to 39 of 39

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default

    Right then Mister_e, that's the one I had a hard time to make work...

    Maybe I should insist a little more.

    The simulator I use is that easy... but maybe not fully reliable so it may be worth to spend more time on the MELABS Sim programmer.
    Roger

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex View Post
    Right then Mister_e, that's the one I had a hard time to make work...

    Maybe I should insist a little more.

    The simulator I use is that easy... but maybe not fully reliable so it may be worth to spend more time on the MELABS Sim programmer.
    I don't know if the MPLABs simulator is 'hard to use', at least I don't think so anyways. There is a bit of an initial learning curve to figure out which windows to use, which keystrokes and which functions key are really handy, etc.
    All I do it pull up MPSIM, load the .asm file that PBP gave me, and run it, or single step it or whatever. Yes, you need to have some input values, and maybe a stimulus file, but I don't use any of that and just set my program up to 'fake' those values.
    All I can say is that MPSIM has always treated me right...and I especially like the 'stopwatch' function.

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


    Did you find this post helpful? Yes | No

    Default

    Well it's actually pretty simple once you know how.

    Start a new project using the usual method, then Select MPLAB Sim and compile your code.

    Go to View> Watch, right to Add Symbol chose the variable you want to monitor and add them in the list.

    If you want to monitor a PORT ouput, you go on the Add SFR side.

    Once done, press f9 and enjoy the show.

    If you have some PAUSE, PAUSEUS in your code... comment them.

    You can use and create your Code in MPLAB and use the animate mode... it works. You just need to install properly the MPLAB plug-in. Easier to figure out than the .ASM file.

    Today i notice that Microchip have added the VSM plug-in. I need to laugh and waste some time... i'll try it...
    Last edited by mister_e; - 25th February 2007 at 22:07.
    Steve

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

  4. #4
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default

    Well it's actually pretty simple once you know how.
    Ça, c'est la phrase qui tue :-)

    I wish this could be as simple as it looks like... to your (expert) eyes.

    Going to sleep now but tomorrow, MELABS will have to be nice with me!

    Bonne nuit.
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    MELABS or MPLAB?

    Bonne nuit
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Update to the VSM... painful and useless as you can't create your OWN neither modify the provided sample...

    Idiot and useless...
    Steve

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

  7. #7
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    I might have misread the original intent, but you did ask:

    How is it possible to handle ONLY those four bits wihtout modifying the other (MSB) four bits?
    "Under the hood" PBP will either write to the port as a Byte, or set/clear individual bits. This means you have 2 basic approaches:
    1) Dave's approach, which deals with the port as a byte. This uses some bit manipulation to preserve the status of the MSBs.
    2) And what I was trying to get at, but was not very clear, and that is to set each bit individually.

    Just so I've got it straight, as your FOR...NEXT loop counts from 0 to 3 you would like to see a pattern on PORTAs LSB like: 0001, 0010, 0100, 1000. Is this correct?

    If this is the case, then this should work:

    Code:
    Digit VAR Byte
    DCD_temp VAR Byte
    
    FOR Digit = 0 TO 3
         DCD_temp = DCD Digit 
         PORTA.0 = DCD_temp.0
         PORTA.1 = DCD_temp.1
         PORTA.2 = DCD_temp.2
         PORTA.3 = DCD_temp.3
    NEXT Digit
    SteveB
    Last edited by SteveB; - 26th February 2007 at 05:53.

  8. #8
    nish's Avatar
    nish Guest


    Did you find this post helpful? Yes | No

    Default Timer1 in pic16f877a

    hi all
    i m new to pic16f877a.i need a help regarding timers in pic 16f877a.
    in the timer1,T1CON register what is the purpose of using T1OSCEN bit and the T1SYNC bit.if we are using T1SYNC bit,with what signal it will get synchronised and the purpose of synchronization.expecting the reply.

    thanx n advance

    nish

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  2. Individual Variable bits
    By tazntex in forum General
    Replies: 4
    Last Post: - 31st January 2008, 18:27
  3. Equating Ports to Data Bits
    By Osiris in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd March 2006, 15:00
  4. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31
  5. pics with 3 hardware PWM ports
    By CBUK in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th August 2004, 00:14

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