This thread details the process for the production of MicroChip PIC chipfiles for Great Cow BASIC.
The outcome of the process is a microcontroller specific DAT file. These files are located in the chipfiles folder of the Great Cow BASIC installation.
A microcontroller specific DAT file is required for every microcontroller that Great Cow BASIC supports. The microcontroller specific DAT file contains information with respect registers, register bits, configuration options, memory, interrupts and microcontroller specific constraints (if any). This microcontroller specific DAT file is for Great Cow BASIC only - this is a good resource but the microcontroller specific DAT file should not be manually edited.
All issues with respect to the microcontroller specific DAT file should be report via the forum.
This post will explain how we produce these microcontroller specific DAT file.
Tools
MPLAB-X IDE - we will be using component of the MPASMX sub-directory. Great Cow BASIC uses filename.INC files as the primary data source for microcontroller configuration.
PreProcess.BAT- the first part of the Great Cow BASIC conversion process. This uses GAWK.EXE - an Open Source application. PreProcessIncFile.bat is used for the first step of the conversion . The associated source script file is PreProcessIncFile.awk. PreProcessIncFile.awk is the script that is completes the conversion.
GETCHIPDATA.EXE - a Great Cow BASIC specific application for conversion.
Chipdata.cvs - a Great Cow BASIC specific data source. This file contains critical data with respect to microcontroller specific data.
CriticalChanges.txt - a Great Cow BASIC specific data source. This file contains critical date with respect to microcontroller specific data. This file contains corrections to known bugs in the INC source files and how to correct them.
Process to create and manage
Update the source INC file from the latest MPLAB-X installation by copying the file from the source folder to the Incfiles\original folder . Download and install the latest MPLAB-X installation from the Microchip website, then,
copy C:\Program Files (x86)\Microchip\MPLABX\v4\mpasmx\p1*.inc [target]DAT\incfiles\OrgFiles
Execute PreProcess.bat. This will update or create the inc files in the [target]DAT\incfiles folder.
Update CriticalChanges.txt for any known corrections.
Update the Chipdata.cvs file with the correct chip data, see below.
Execute getchipdata.exe > chipfiles/outputlog.txt. outputlog.txt will contain all the process messages.
Copy to chipfiles to Gold distribution of Great Cow BASIC
Update SourceForge: SVN:DAT
Details of Chipdata.cvs
There are a number of parameters. The majority are obvious, Those shown below are not that easy.
PWMTimerVariant can be set to 0 or 1.
Values will be set in the .dat using the following rule.
Search for CCPTMRS in the specific datasheet and examine.
PWMTimerVariant = 1. When CCPTMRS or CCPTMRSX has PTxSEL a value of 0x00 =Timer 2 and where PTxSEL=0x11 is reserved.
The Default (no value present). When PTxSEL as value=0x01 = Timer2 and PTxSEL=0xoo to be reserved, OR, this register /bit combination is not present. Which is the general case.
SMTClockSourceVariant can be set to 1, 2 or 3.
Values will be set in the .dat the following rule applies for SMTxCLK
ConfigBaseLoc to be set in the .dat the following rule applies:
Value are specific to the microcontroller and may need to be calculated.
Search the specific datasheet for 'memory map' and examine if the CONFIG words are at 300000h
Applies to 18f only and it is calculated at the last location for the config memory address minus 15
An example, 18F67J50 the last location is 0x1FFFF, so the ConfigBaseLoc is 0x1FFFF - 15 = 0x1FFF0
Default location for an 18F is from 0x300000.
IntOSCCONFormat to be set in the .dat the following rule applies:
Values are 1. The default is empty.
Search the specific datasheet for HFIOFS bit
Applies to PIC only examples are PIC10F322 and PIC18F13K22. This is required to ensure the clock oscillator is set correctly. This chip will have HFIOFS bit. The OSSCON bits for IRCFx are different for specific chips. The IntOSCCONFormat enables system.h to set the correct frequency bits.
IntOSCCONFormat = 1
111 = 111 16 Mhz
110 = 110 8 Mhz
. . .
000 = 0 31 kHz
Attached is a PDF version of this post with further reference material in terms of example datasheet entries for the varaints.
This thread details the process for the production of MicroChip PIC chipfiles for Great Cow BASIC.
The outcome of the process is a microcontroller specific DAT file. These files are located in the chipfiles folder of the Great Cow BASIC installation.
A microcontroller specific DAT file is required for every microcontroller that Great Cow BASIC supports. The microcontroller specific DAT file contains information with respect registers, register bits, configuration options, memory, interrupts and microcontroller specific constraints (if any). This microcontroller specific DAT file is for Great Cow BASIC only - this is a good resource but the microcontroller specific DAT file should not be manually edited.
All issues with respect to the microcontroller specific DAT file should be report via the forum.
This post will explain how we produce these microcontroller specific DAT file.
Tools
Process to create and manage
copy C:\Program Files (x86)\Microchip\MPLABX\v4\mpasmx\p1*.inc [target]DAT\incfiles\OrgFiles
Details of Chipdata.cvs
There are a number of parameters. The majority are obvious, Those shown below are not that easy.
PWMTimerVariant can be set to 0 or 1.
Values will be set in the .dat using the following rule.
Search for CCPTMRS in the specific datasheet and examine.
SMTClockSourceVariant can be set to 1, 2 or 3.
Values will be set in the .dat the following rule applies for SMTxCLK
Search the specific datasheet for SMTxCLK
ConfigBaseLoc to be set in the .dat the following rule applies:
Value are specific to the microcontroller and may need to be calculated.
Search the specific datasheet for 'memory map' and examine if the CONFIG words are at 300000h
IntOSCCONFormat to be set in the .dat the following rule applies:
Values are 1. The default is empty.
Search the specific datasheet for HFIOFS bit
Attached is a PDF version of this post with further reference material in terms of example datasheet entries for the varaints.
Anobium March 2018
Last edit: Anobium 2018-12-16
The post details the chipfile data format.
Do not post to this thread - this is a reference/master thread.
Please create a new thread to discuss any aspect.
Thank you.