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.

#pragma problems converting from BoostC to CC5x

Status
Not open for further replies.

AlGeorge

Member level 1
Joined
Nov 17, 2009
Messages
39
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Waihi Beach
Activity points
1,606
Hi I am trying to use CC5x due to BoostC not supporting baseline micros. Unfortunately, CC5x is not altogether clear on how to define some of the #pragma settings. Its help refers you to the respective chip header file, but with the desired chip there is little you can see below I have tried various combos of config, and all of them error out. There seems to be no clock_freq pragma. Any pointers appreciated. Thanks, Alistair.

#pragma config _WDTE_OFF,_MCLRE_OFF
^------
Error C:\Projects\PIC\cc5x\mytest.C 3: Preprocessor error
(The source line starting with '#' contains invalid syntax or context
dependent syntax)


//#pragma config WDTE=off, PWRTE=off, MCLRE=off,CP=off
//#pragma config _PWRTE_OFF & _WDT_OFF //& _MCLRE_OFF _CP_OFF &
//#pragma config CP=OFF PWRTE=OFF,WDT=OFF,INTOSCIO
#pragma chip=PIC10f206
#pragma CLOCK_FREQ 125000 //Set known clock frequency to prescaler


// HEADER FILE
#pragma chip PIC10F206, core 12, code 511, ram 8 : 0x1F
// NOTE: last code location is omitted ^--

#pragma resetVector 0

#pragma config_def 0x0010
 

Actually I can now see where its going wrong. It does not seem to conform to Microchip specs in options available for chip.Compared to BoostC CC5x (for me anyway) is a horror to configure. EG there is no WDTEN bit as per app specs eg the following is illegal: #define wdt CONFIG.WDTE //Watchdog control bit

How to get access to the CONFIG register is obscure.
Thanks,
Al.
 

Hi it was a wee bit tricky but the key information is available here it is:
EXAMPLE ON HOW TO USE THE STANDARD MPASM CONFIGURATION IDENTIFIERS

1. First copy the identifiers from the right .INC file
(P10F206.INC) in the MPASM Suite directory into an
#asm .. #endasm region in a header/source file.

2. Then use the EQU identifiers together with the '&' operator

EG in my CC5x PIC10F206.H file in the CC5x directory I modified it with the MPASM data thusly:
Code:
#asm
_MCLRE_ON                    EQU     H'0FFF'
_MCLRE_OFF                   EQU     H'0FEF'
_CP_ON                       EQU     H'0FF7'
_CP_OFF                      EQU     H'0FFF'
_WDT_ON                      EQU     H'0FFF'
_WDT_OFF                     EQU     H'0FFB'
_IntRC_OSC                   EQU     H'0FFF';IntRC_OSC is the only option.
                                            ;It is here for backwards compatibility
                                            ;only.
#endasm

Then within the C code you can define these (missing) Options thusly:
#pragma config = _WDT_OFF & _MCLRE_OFF & _CP_OFF

Hope this helps someone!

Al.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top