Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/17/08 21:46
Read: times


 
#150966 - Is it the priviledge of noobs...
Responding to: ???'s previous message
to ask noob questions? Are the same questions asked by the pros a shame? :-)))

Brian Reid said:

First, I will be using two PWM outputs on my board for DC motor speed control but have to configure the board first. I need to configure bit 6 of the CFG831 SFR to set the PWM pin out to P2.6 and P2.7 by setting that bit to zero. However, the datasheet for my processor says I should not modify the EPM0, EPM1, or EPM2 bits of the CFG831 SFR as they are set automatically so I don't think I can use the MOV instruction here. I think I need to use the ORL instruction here but I'm not sure how to do that properly. The CFG831 SFR is not bit addressable....

   anl   CFG831,#0BFh

you would use orl if you would want to set the bit to 1

Brian Reid said:
Also, I will be connecting a 5V input(from DVdd) via a normally open solid state relay with 12V control to P0.7 but have a question on the proper interfacing. The datasheet on my board says: "In general-purpose I/O port mode, Port 0 pins that have 1s written to them via the Port 0 SFR will be configured as “open drain” and will therefore float. In this state, Port 0 pins can be used as high impedance inputs." Does this mean I need to use a pulldown resistor to keep the port from floating when no 5V signal is applied to the pin?

Yes; although the common practice is to use a pullup and use active low signalling. Then, you would not need a series resistor (which value, 1MOhm, is unusually high, btw.)

You should also read the datasheet of the mcu, don't rely on datasheet of your board.

Brian Reid said:
I'm also a little confused when they say to write a 1 to P0.7 to configure it as an input. Does this mean I need to write a 1 to it before checking the state of the pin in my code? If so, can I just do something like the code below to accurately check the state of P0.7?

SETB P0.7
JNB P0.7,label


You don't need to set it before each read; it's enough to do it once at the beginning (or do nothing at all - 1 is the default state after reset), and never overwrite it into 0.

JW




List of 42 messages in thread
TopicAuthorDate
Initializing two timers            01/01/70 00:00      
   the infamous intel notation of hexadecimal numbers            01/01/70 00:00      
      thank you!            01/01/70 00:00      
   Aside: Assembler vs Compiler            01/01/70 00:00      
      compiler vs. assembler            01/01/70 00:00      
         Do yourself a favor ...            01/01/70 00:00      
            Symptomatic?            01/01/70 00:00      
            software            01/01/70 00:00      
               bad idea            01/01/70 00:00      
               Good tools make life easier            01/01/70 00:00      
                  software choice            01/01/70 00:00      
                     I see            01/01/70 00:00      
                        Apire            01/01/70 00:00      
         RE: All I know is that I hit the "Compile" button            01/01/70 00:00      
            terminology            01/01/70 00:00      
               sloppy            01/01/70 00:00      
   another question            01/01/70 00:00      
      Is it the priviledge of noobs...            01/01/70 00:00      
         follow up...            01/01/70 00:00      
            read the "bible" and FAQs            01/01/70 00:00      
               interfacing            01/01/70 00:00      
                  ME=mech.engineer is fine...            01/01/70 00:00      
                     ME            01/01/70 00:00      
                     if I was not clear, then            01/01/70 00:00      
                        but does it provide the same comfort...            01/01/70 00:00      
                           so what?            01/01/70 00:00      
                              Is it easy?            01/01/70 00:00      
                                 You answered the question yourself            01/01/70 00:00      
                                    isn't there some lock?            01/01/70 00:00      
                                       actually it is            01/01/70 00:00      
                     thank you everyone!            01/01/70 00:00      
         "not bit addressable" question            01/01/70 00:00      
            Value, not SFR address            01/01/70 00:00      
               perfect!            01/01/70 00:00      
                  yes            01/01/70 00:00      
            did you check "the bible"            01/01/70 00:00      
      PWM ....            01/01/70 00:00      
         I have not see it suggested in this thread            01/01/70 00:00      
         P89V51RD2 instead of AT89S52            01/01/70 00:00      
            P89V51RD2 instead of AT89S52            01/01/70 00:00      
   WHAT are you using            01/01/70 00:00      
      terminology            01/01/70 00:00      

Back to Subject List