Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

OSCCON Settings not compiling in PicBasic

Status
Not open for further replies.

chien_fu

Newbie level 5
Joined
May 11, 2008
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,373
I'm trying to set my oscillator speed at 31kHz (for energy efficiency) but the program simply won't compile. It gives me a syntax error: ":" or "=" expected.
Doesn't change if I use a ":" either... Also doesn't change if I remove "DEFINE"..


Code:
DEFINE Device = 12F683

DEFINE OSCCON = %11000000       'Set oscillator to internal, 31 kHz, LFINTOSC Stable
 

I have never used PicBasic but from experience with other compilers it looks to me like you are associating the name OSCCON with %11000000 rather than setting it to that value.

Assuming PicBasic uses '%' to mean binary, do you want the 'DEFINE' at the beginning of the line?

Brian.
 

DEFINE doesn't work either, I can not get PBP to recognize any sort of definition of OSCCON...
when I try what I believe to be correct: OCSCON = %11000001
it gives me the error: undefined variable 'OSCCON'

I feel like I'm taking crazy pills! I wish this project could be done with my arduino!!
 

I would have thought there was a file you should include which defines the addresses and bit names in the device. I think by using your original 'define' you are trying to tell the program that OSCCON is at address C0h rather than loading C0h in to the OSCCON register. The real address is 8Fh so the compiler would at best see a conflict of definitions.

you could try:

define OSCCON = 8Fh
OSCCON = C1h


I use 'C' rather than BASIC but I would think the same principle applies, I would use:
#include <12F683.h>
at the top of the program to make the compiler aware of all the register names being used later.

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top