• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Output Low Voltage on PIC16F690

Status
Not open for further replies.

pgenereu

New Member
Hey,

I'm using a PIC16F690 for a PWM motor control application. I am using pulse steering to alternate between two pins (P1A and P1B). This works well.

I am also trying to turn 2 other pins "on" and "off" (bsf/bcf PORTA,3 ; bsf/bcf PORTA,4).

The logic works (ie the pins turn on and off) but for some reason the output is 0.6 V rather than 5 V. In the data sheet it states that 0.6 V is the Output Low Voltage and 5 V is the Output High Voltage.

Any idea why they are set to 0.6 V? Any idea how to change it to 5 V?

Thanks,

-Phil
 

Nigel Goodwin

Super Moderator
Most Helpful Member
What are the pins connected to?, and have you set them as outputs?. RA4 is also an open-collector output on many PIC's, so needs a pullup resistor - check the datasheet for exactly what the pins are capable of, and how you need to set them.
 

pgenereu

New Member
Yes, they are set to output. They are connected to a 1k resistor to a voltmeter (a test circuit).

To test, the pin is set, then there is a 200 ms delay, then the pin is cleared...this is looped for test purposes. The logic is functioning as the pin goes high to 0.6 V then back to 0 V then back to 0.6 V and so on.

If I use a test program without pulse steering, the pins go to 5 V and back to 0 V. So it seems that for some reason having the pulse steering enabled makes the output low voltage.

The pins are not PWM pins.

Thanks for the reply.
 

geko

Active Member
pgenereu said:
I am also trying to turn 2 other pins "on" and "off" (bsf/bcf PORTA,3 ; bsf/bcf PORTA,4).
RA3 on the 16F690 is input only, so that will be part of the problem.

That aside, have you configued them for digital I/O, otherwise they default to analogue inputs.

Pete
 

pgenereu

New Member
Yes. They are set to digital I/O (I think so anyway)

;****************************
BANKSEL ANSEL

CLRF ANSEL ;digital I/O
CLRF ANSELH;

BSF STATUS,RP0 ;Bank 1
BCF STATUS,RP1 ;

MOVLW b'00001000' ;Port A all output, except RA3
MOVWF TRISA
;*************************************

Yes, PORTA,3 is input only. Thanks for pointing it out...my mistake. My concern is more with PORTA,4 and PORTB,5.

PORTB,5 and PORTA,4 give me the same behaviour. 0.6 V = logic high when I expect 5 V

PORTC,6 however gives me 5 V for logic high.

The pins are connected to a multimeter through a 1k resistor.

Thanks for your interest.
 

pgenereu

New Member
RA4 is listed as a general purpose I/O. I have it set as a digital I/O via "CLRF ANSEL"

From the data sheet:

• a general purpose I/O
• an analog input for the ADC (except PIC16F631)
• a TMR1 gate input
• a crystal/resonator connection
• a clock output
 

geko

Active Member
Have you checked if RA4 is open collector or not?, it is on many PIC's, check the datasheet.
It's not so that isn't the problem here.

You don't show all your initialisation code, but what you do show is correct.

Clutching at straws a bit here, but are you setting the register banks back to bank 0 before writing to the port registers?
 

eng1

New Member
Assuming that you've configured the TRISB register properly and that you're not sending fosc/4 on RA4, you're very likely experiencing the read-modify-write issue. Place some NOPs after each BCF, BSF inctruction, or - better - use a shadow register.
 
Last edited:

Pommie

Well-Known Member
Most Helpful Member
pgenereu said:
To test, the pin is set, then there is a 200 ms delay, then the pin is cleared...this is looped for test purposes. The logic is functioning as the pin goes high to 0.6 V then back to 0 V then back to 0.6 V and so on.
You are turning the pin on and off! What proportion of the time is it on? Multimeters are not very good at showing pulsed outputs. Try just turning it on and see what you get.

Mike.
 

pgenereu

New Member
Pommie, thanks for the idea. I don't think the multimeter is the problem though because I read 5 V for PORTC,6 with the same conditions.
 

Pommie

Well-Known Member
Most Helpful Member
I wasn't suggesting that the multimeter was the problem, I was suggesting that if the port is active high for a short period then the multimeter may show the average voltage. Just set the pin high, leave it high and check the voltage.

Mike.
 

pgenereu

New Member
Pommie, that is what I thought you suspected. I did test it as you suggested. You're right, however the time that the pin was set was long enough to get the right reading.

Unfortunately I caused my own problem. I pinned out the programming pins to a ribbon cable so I wouldn't have to take the chip out of the circuit every time I programmed it. After working with the circuit for a while, I managed to cause a small piece of frayed wire to short RA0 and RA4 to each other.

I found that probelm first thing this morning. A good night's sleep seems to solve a lot. 10 minutes of work found the problem today.

To find the problem, I set all of the outputs high and then tested the voltages and found that only RA0 and RA4 had a 0.6 V output while all others had 5 V. So I checked for a short, and sure enough, I found a very small connection between the two at the pinout for the programming cable.

Thanks to everyone for the input.

Sorry it turned out to be my poorly constructed hardware. I really thought it had something to do witih the pulse steering as this is the first time I have implemented it. The circuit used to work fine, so I didn't suspect that I had damaged it. Ah well, good old prototypes.

-Phil
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top