PDA

View Full Version : Acessing Config1 Register in PIC16F88



mychangl
- 14th February 2014, 14:56
can anyone advice why setting config1 register for PIC16F88 produce syntax error ?
I want to set FOSC1 & FOSC0 in Config1 register. Refer datasheet page 130.

Thx.

AvionicsMaster1
- 14th February 2014, 15:47
It will be much easier for someone to help if you post the troubling code. Absent being a prognosticator no one will be able to pinpoint your issue without seeing what you've written.

mychangl
- 15th February 2014, 04:44
The purpose is to enable port A & B become digital IO. But with this instruction, only PortA.6 & 7 not responded while Porta.5 become MCLR.
According to datasheet, i should access Config1 but PBP product syntax error.

The code is :
INCLUDE "modedefs.bas"

'Set clock source to internal @ 4MHZ
osccon = %01100010

'Set all analog pin as digital pin
ansel = %00000000

'Set Pin direction
TRISA = %00000000 'All PortA as output
TRISB = %00000000 'All PortB as output

HenrikOlsson
- 15th February 2014, 05:59
Hi,
The CONFIG registers aren't (normally) accessible at runtime like "normal" registers. You can change them by using you device programmers software (which programmare are you using?) or you can set/change them in the code. The way you set them in code depends on which version of PBP you're using.

If you're using PBP3 then open up the manual and read up on the #CONFIG / #ENDCONFIG directives. If you're using a version prior to PBP3 then make sure you read this thread (http://www.picbasic.co.uk/forum/showthread.php?t=543). Or you can search around the forum a bit and you'll find PLENTY of information since CONFIG settings are one of the most discussed topics.

/Henrik.

mychangl
- 15th February 2014, 09:51
I am using PBP 2.6 with microcode studio.

HenrikOlsson
- 15th February 2014, 10:13
Then make sure you read the thread I linked in my previous reply and follow the link to the Wiki in the first post - it'll tell you everything you need to know.

/Henrik.

mychangl
- 15th February 2014, 16:09
Will do it. Thank you Henrik.:eagerness: