I am newbie in Swordfish.
I just first time to use SF compiler and purchase this compiler on yesterday.
Well, today I just started to use and compiled some pieces code use a PIC18F2550, I plan to use a Crystal 20 Mhz with external and I refer to use a Plugin configGenerator through SF compiler, I have an error on Config.
Please help what is I do wrong, refer to below code :
Code: Select all
{
*****************************************************************************
* Name : Tried_New_Test Compiler.BAS *
* Author : Test Code - Tried New Compiler *
* Notice : Copyright (c) 2023 [select VIEW...EDITOR OPTIONS] *
* : All Rights Reserved *
* Date : 11/04/2023 *
* Version : 1.0 *
* Notes : *
* : *
*****************************************************************************
}
Device = 18F2550 //uC use
Declare Xtal = 20 // Ue external crystal
Config
PLLDIV = 5, // Divide by 5 (20 MHz oscillator input)
CPUDIV = OSC1_PLL2, // [Primary Oscillator Src: /1][96 MHz PLL Src: /2]
USBDIV = 1, // USB clock source comes directly from the primary oscillator block with no postscale
FOSC = XT_XT, // XT oscillator (XT)
FCMEN = OFF, // Fail-Safe Clock Monitor disabled
IESO = OFF, // Oscillator Switchover mode disabled
PWRT = OFF, // PWRT disabled
BOR = ON, // Brown-out Reset disabled in hardware and software
BORV = 3, // Minimum setting 2.05V
VREGEN = OFF, // USB voltage regulator disabled
WDT = OFF, // WDT disabled (control is placed on the SWDTEN bit)
WDTPS = 32768, // 1:32768
CCP2MX = ON, // CCP2 input/output is multiplexed with RC1
PBADEN = ON, // PORTB<4:0> pins are configured as analog input channels on Reset
LPT1OSC = OFF, // Timer1 configured for higher power operation
MCLRE = ON, // MCLR pin enabled; RE3 input pin disabled
STVREN = ON, // Stack full/underflow will cause Reset
LVP = ON, // Single-Supply ICSP enabled
XINST = OFF, // Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
DEBUG = OFF, // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
CP0 = OFF, // Block 0 (000800-001FFFh) is not code-protected
CP1 = OFF, // Block 1 (002000-003FFFh) is not code-protected
CP2 = OFF, // Block 2 (004000-005FFFh) is not code-protected
CP3 = OFF, // Block 3 (006000-007FFFh) is not code-protected
CPB = OFF, // Boot block (000000-0007FFh) is not code-protected
CPD = OFF, // Data EEPROM is not code-protected
WRT0 = OFF, // Block 0 (000800-001FFFh) is not write-protected
WRT1 = OFF, // Block 1 (002000-003FFFh) is not write-protected
WRT2 = OFF, // Block 2 (004000-005FFFh) is not write-protected
WRT3 = OFF, // Block 3 (006000-007FFFh) is not write-protected
WRTC = OFF, // Configuration registers (300000-3000FFh) are not write-protected
WRTB = OFF, // Boot block (000000-0007FFh) is not write-protected
WRTD = OFF, // Data EEPROM is not write-protected
EBTR0 = OFF, // Block 0 (000800-001FFFh) is not protected from table reads executed in other blocks
EBTR1 = OFF, // Block 1 (002000-003FFFh) is not protected from table reads executed in other blocks
EBTR2 = OFF, // Block 2 (004000-005FFFh) is not protected from table reads executed in other blocks
EBTR3 = OFF, // Block 3 (006000-007FFFh) is not protected from table reads executed in other blocks
EBTRB = OFF // Boot block (000000-0007FFh) is not protected from table reads executed in other blocks
Dim timing As Byte 'Declare timing
Dim blink_led As Word 'Declare blink_led
Dim pinLed PORTB.5 'Declare pinLed
Dim OnLed PORTB.7 'Declare OnLed
timing = 12 '12 times waiting
TRISB = 0
'LATB.F0 = 0
For blink_led = 0 To 12 'reach 12 time then
High OnLed 'Led On
pinLed = 1 'Make it on
pause 50 'Delay a second
pinLed = 0 'Make it off
pause 50 'Delay a second, then
High OnLed 'Reach make Led High
Next
While
Asm
EndAsm
PORTB = 1
pauseus(timing)
Asm
GoTo $+1 ; 2uS 'Produce a frequency
Nop ; 1uS
EndAsm
PORTB = 2
pauseus(timing)
Asm
GoTo $+1 ; 2uS
Nop ; 1uS
EndAsm
PORTB = $41
pauseus(timing)
Asm
GoTo $+1 ; 2uS
Nop ; 1uS
EndAsm
PORTB = $42
pauseus(timing)
Asm
GoTo $+1 ; 2uS
Nop ; 1uS
Nop ; 1uS
EndAsm
Wend
Thanks,
Ar