??? 02/17/08 05:49 Read: times |
#150948 - another question Responding to: ???'s previous message |
Hi again,
Once again, I have a couple more noob question here. 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.... 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? In short, do I need to do this: http://www.briansinsanity.com/circuit1.JPG Or this: http://www.briansinsanity.com/circuit2.JPG 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 Once again, thank you for your patience and for your help. Brian |