Continue to Site

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.

  • 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.

Can't get PORTA.6 and PORTA.7 to be output

Status
Not open for further replies.

jerryd

New Member
ELECTRO TECH forum,

For some reason I can't seem to get PORTA.6 and PORTA.7
to be cmos outputs on my 16F88. I know these pin are
multiplexed with the oscillator module input and external
oscillator output but the data sheet says they are also
full CMOS outputs.

I'm using the internal oscillator at 8MHZ.

TRISA = %00100000 'set porta 0,1,2,3,4,6,7 as output
PORTA = %11011111 'set porta 0,1,2,3,4,6,7 high

All the other PORTA bits work fine. Is there some
configuration bit I'm missing?

Thanks,
jerryd
 
hi Jerry,

Ignore this, misread the post!
 
Last edited:
Yep it's your config fuses.

Check your settings in the MPLAB config settings. There is one for RA6 and RA7 to set to I/O.

Or add & _INTRC_IO to your config settings.
 
Last edited:
Gobbledok
I don't have MPLAB just Mikrobasic using basic.

On page 130 of the datasheet I found this:

CONFIG1:

bit 4, 1-0 FOSC<2:0>: Oscillator Selection bits
100 = INTRC oscillator; port I/O function on both
RA6/OSC2/CLKO pin and RA7/OSC1/CLKI pin

Looks like it might be the right bit but I can't figure
out how to set it with basic.

The only OSCCON command I have is:
OSCCON = %01110000 'set internal osc to 8mhz

Also I don't know how to look at or edit the configuration.

Thanks,
jerryd
 
hmm yeh it's the CONFIG1 byte you need to change. It is not done in code though, and is independent from the OSCCON byte.

What do you use to program your PIC? If you use icprog you can change the config fuses there before burning into your PIC.
 
I've never used mikrobasic but try going to:

> Project > Edit Project.

Then look for _INTRC_IO under the Device Flags heading.
 
Gobbledok,

I've been looking in "Project Edit" menu but didn't see anything
like you said to look for.

I did find my Configuration Registers:
CONFIG :$2007 : 0x3F6A
CONFIG2 :$200B : 0x3FFF

I read on the internet that if DEBUG is turned off it makes
RB6 & 7 I/O. Couldn't figure out how to do that.

Also read that I need to have:
ANSEL = ANSEL and %10011111 ' RB6, RB7 as digital

didn't help.

jerryd
 
Try changing '0x3F6A' to '0x3F78'.

I could be wrong, but if I'm right it keeps the same config fuses for you except changes your HS oscillator (which it is currently set to) to an internal oscillator with port I/O on RA6:RA7.

If you're not using any analog inputs then ANSEL should be %00000000.
 
Last edited:
Gobbledok,

It won't let me edit the CONFIG numbers.
I've had ANSEL set to 0 all along.

I can't find any example code for this on the internet.

Thanks,
jerryd
 
hmm having no experience with mikrobasic, I have no idea then.

But yeh that's what you need to do.

Either find the box and tick _INTRC_IO or change the config word from '0x3F6A' to '0x3F78'.
 
Find this it's under projects and change to suite
 

Attachments

  • 88.PNG
    88.PNG
    34.1 KB · Views: 182
Gobbledok,

I went back and re-read your posts again and realized
I never tried changing the config in ic-prog. Under
Oscillator there is an INTRC selection. I have to do
it every time I program the device and that worked.

Thanks to be80be I know how to edit the project configuration.
Another one of those things I should have been able to
figure out myself.

So PORTB.1, 4 and 7 pins are external interrupts and
the rest of the ports I/O's.

Thanks for your help and patience. Learned a lot.

jerryd
 
Status
Not open for further replies.

Latest threads

Back
Top