Menu

7-bits data to 8-bits port

Help
2011-05-07
2013-05-30
  • Nobody/Anonymous

    Hello guys,
                          First of all you guys are doing great job by developing such an easy to use tool, Well i know 7-bits doesn't  make sense but let me ask, is there any way to put 7-bit data in a variable and that variable correspond to a 8-bit port so that whenever that variable is written only 7 pins should give the output(the data will not exceed more than 7-bits), the remaining one pin should left undisturbed.

    Thanks in advance.

     
  • kent_twt4

    kent_twt4 - 2011-05-09

    I would just use the AND(&) operation to mask off the unwanted bit.  There will always be some switching "noise" when  
    writing to a Port whether a particular pin is written to or not.  In some cases the whole port is cleared before adding the W register to it, usually nothing to be concerned about?

    'An example to write the 7 msb's of a variable to a port, excepting bit 7
    Rotate MyVar Right Simple
    PortA = MyVar & b'01111111'
    
     
  • Waqar

    Waqar - 2011-05-13

    Hello Kent,

                          Thanks for your prompt reply, its really getting the job done. I marked your words about that noise thing since I am using that remaining pin as ADC input, Let me write it to my controller(and observe the noise) then I will get back to you.

     
  • Waqar

    Waqar - 2011-05-16

    Hello Kent,

                          I think i should better not use that port at all, mainly there are two reasons so far, first the masked bit is set always to low which is hindering the ADC input to move freely, second that noise thing, I was trying to use that port as RAM address counting high byte, anyways I have arranged a separate binary counter(CD4024) for high address byte which clocked by the MSB of the low byte port on controller. I appreciate your help Kent keep up the good work : )

     
  • kent_twt4

    kent_twt4 - 2011-05-16

    Sounds like you have it figured out.  The noise thing is a very fleeting thing that I saw on the scope, and by the time an a-d conversion looks at the pin, the very small glitch would be long gone.  A 0.1uf bypass cap on the input pin for extra measure wouldn't hurt.

    Hats off to Hugh, who has put together a very unique, and useful compiler.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.