View previous topic :: View next topic |
Author |
Message |
cjenkins
Joined: 29 Jan 2007 Posts: 2
|
output_high voltage level output |
Posted: Mon Jan 29, 2007 12:14 pm |
|
|
I'm using a PIC18F4550 with a 5V supply, and am using RB0 for a digital output. My program sets this pin high in 20 ms intervals anywhere from 1.25 ms to 1.75 ms (driving a motor), but my oscope shows my output is only going up to 1V, not 5V. From the curve it's clear it has reached its final value easily and it's not the case it doesn't have enough time to switch.
I searched the documentation and the device header for any clues, but there is no indication whether or not output_low and output_high refer to the rail values as I assumed. Does anyone know for sure? |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1909
|
|
Posted: Mon Jan 29, 2007 12:24 pm |
|
|
The output_high() and output_low() functions do as you expect: set a pin to Vdd or Vss. If you're observing a pin that isn't making it to Vdd, I'd suspect whatever the pin is trying to drive, not the PIC itself. Break the connection between the PIC and the circuit it is driving and you'll see that it does (or should) go to 5V. If not, the PIC is likely damaged.
One other thing: are you sure your scope is set properly? Seeing 1V and expecting 5V sounds suspiciously like a scope vertical scale issue (5V/div vs. 1V/div). |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jan 29, 2007 12:27 pm |
|
|
What's the impedance of the load on the pin ? The data sheets says
the maximum current that a PIC pin can supply is 25 ma. What is
the load ? Is the pin directly driving the motor ? Preferably, you
should have a separate driver such as a FET or a transistor which
will drive the motor. |
|
|
|