News:

;) This forum is the property of Proton software developers

Main Menu

Unrecognized compiler Declare

Started by Dolci, Jul 21, 2025, 09:59 AM

Previous topic - Next topic

Dolci

    Device = 18F2620
    Declare Xtal = 20
   
;**** Added by Fuse Configurator ****
; Use the Fuse Configurator plug-in to change these settings   
    Config_Start   
      OSC = HS ;HS oscillator
      FCMEN = OFF ;Fail-Safe Clock Monitor disabled
      IESO = OFF ;Oscillator Switchover mode disabled
      PWRT = OFF ;PWRT disabled
      BOREN = OFF ;Brown-out Reset disabled in hardware and software
      BORV = 3 ;Minimum setting
      WDT = OFF ;WDT disabled (control is placed on the SWDTEN bit)
      WDTPS = 32768 ;1:32768
      CCP2MX = PORTC ;CCP2 input/output is multiplexed with RC1
      PBADEN = OFF ;PORTB<4:0> pins are configured as digital I/O on Reset
      LPT1OSC = OFF ;Timer1 configured for higher power operation
      MCLRE = On ;MCLR pin enabled; RE3 input pin disabled
      STVREN = OFF ;Stack full/underflow will not cause Reset
      LVP = OFF ;Single-Supply ICSP disabled
      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-003FFFh) not code-protected
      CP1 = OFF ;Block 1 (004000-007FFFh) not code-protected
      CP2 = OFF ;Block 2 (008000-00BFFFh) not code-protected
      CP3 = OFF ;Block 3 (00C000-00FFFFh) not code-protected
      CPB = OFF ;Boot block (000000-0007FFh) not code-protected
      CPD = OFF ;Data EEPROM not code-protected
      WRT0 = OFF ;Block 0 (000800-003FFFh) not write-protected
      WRT1 = OFF ;Block 1 (004000-007FFFh) not write-protected
      WRT2 = OFF ;Block 2 (008000-00BFFFh) not write-protected
      WRT3 = OFF ;Block 3 (00C000-00FFFFh) not write-protected
      WRTC = OFF ;Configuration registers (300000-3000FFh) not write-protected
      WRTB = OFF ;Boot Block (000000-0007FFh) not write-protected
      WRTD = OFF ;Data EEPROM not write-protected
      EBTR0 = OFF ;Block 0 (000800-003FFFh) not protected from table reads executed in other blocks
      EBTR1 = OFF ;Block 1 (004000-007FFFh) not protected from table reads executed in other blocks
      EBTR2 = OFF ;Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks
      EBTR3 = OFF ;Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks
      EBTRB = OFF ;Boot Block (000000-0007FFh) not protected from table reads executed in other blocks
    Config_End

;**** End of Fuse Configurator Settings ****
;-------------------------------------------------------------------------------

    Declare LCD_Type = 0          ' Alpha or Alphanumeric or Graphic or KS0108 or Toshiba or T6963
    Declare LCD_Data4_Pin PORTC.3 ' Connect PORTE.2 to the LCD's D4 line
    Declare LCD_Data5_Pin PORTC.2 ' Connect PORTE.0 to the LCD's D5 line
    Declare LCD_Data6_Pin PORTC.1 ' Connect PORTC.5 to the LCD's D6 line
    Declare LCD_Data7_Pin PORTC.0 ' Connect PORTB.5 to the LCD's D7 line
    Declare LCD_ENPin = PORTC.5   ' Assigns the Port and Pin that the LCD's EN line will attach to
    Declare LCD_RSPin = PORTC.4   ' Assigns the Port and Pins that the LCD's RS line will attach to
    Declare LCD_Interface = 4     ' Inform the compiler as to whether a 4-line or 8-line interface is required by the LCD
    Declare LCD_Lines = 2         ' Inform the compiler as to how many lines the LCD has.
    Declare LCD_CommandUs = 2000  ' Time to wait (in microseconds) between commands sent to the LCD
    Declare LCD_DataUs = 50       ' Time to wait (in microseconds) between data sent to the LCD.
   
    '
' Hardware Assignments
' --------------------
'
    ;Calculated Baudrate = 9597 @ Xtal 20MHz, Error = -0.03%
    Declare Hserial_RCSTA  = 144 ; Enable continuous receive
    Declare Hserial_TXSTA  = 36  ; Enable transmit, BRGH = 1
    Declare Hserial_Clear  = On  ; Clear overflow automatically
    Declare Hserial_SPBRG  = 8   ; Baud Rate Generator Low Byte Value
    SPBRGH         = 2   ; Baud Rate Generator High Byte Value
    BAUDCON.3      = 1   ; Enable the 16 bit Baud Rate Generator
   
    Declare Hserial_Parity Even   ; Enables/Disables parity on the serial port.
    Declare Hrsout_Pace 100       ; 0 to 65535 microseconds (us) Implements a delay between characters



   Declare Hrsout_Pace 100 --- this one making error.. any solution?

Pepe

Is
Declare Rsout_Pace = 0 to 65535 microseconds (us)  Implements a delay between characters transmitted by the Rsout command.

Dolci

Declares
There are several Declare directives for use with the Hserout commands. These are the same
declares as used by the HRsout commands.

and I was looking at Positron 16 .. my mistake :'(

Dolci

Rsin { Label }, MyByte, MyWord ---> this one is compiling but no responce on actual run
Rsin Label , MyByte, MyWord ---> this one General  Syntax Error

what is the correct syntax of the above command?
I am trying to arrange a command like below

RsIn TimeOut,Wait(CR,CR,LF),RsInData

any help please

Dolci

RGV250

Hi,
RsIn TimeOut,Wait(CR,CR,LF),RsInDataI think you need to give a time in mS before the TimeOut, also not sure about the Wait but are you expecting to see CR,CR,LF in the incoming string as it will not do anything if not. I wonder if you need to put ASCII codes for those as well?

Bob

Pepe

demo proteus


rx

;-------------------------------------------------------------------------------
;**** Added by Fuse Configurator ****
; Use the Fuse Configurator plug-in to change these settings

Device = 16F684

Config FOSC_INTOSCIO, WDTE_Off, PWRTE_ON, MCLRE_OFF, CP_ON, CPD_OFF, BOREN_OFF, IESO_OFF, FCMEN_OFF

;**** End of Fuse Configurator Settings ****
;-------------------------------------------------------------------------------

Declare Xtal = 8
Declare Optimiser_Level = 3

Declare Watchdog off


Symbol CR = 13
Symbol LF = 10

Declare Serial_Baud = 9600 ' Set the Baud rate for HRsoutLn
Declare RSIn_Timeout = 100
Declare RSIn_Pin = PORTA.1
Declare RSOut_Pin = PORTA.0
Declare RSIn_Mode = 0
Declare RSOut_Mode = 0


Dim var1[5] As Byte

 PORTA = 0
 TRISA.0 = 0
 
RsOut ""
Do

 Do
  Clear var1
  RsIn Wait(CR,CR,LF),Str var1 ' Receive a byte serially into Var1
 Loop While var1[0] = 0

 RsOutLn Str var1

Loop ' Loop forever



tx

;-------------------------------------------------------------------------------
;**** Added by Fuse Configurator ****
; Use the Fuse Configurator plug-in to change these settings

Device = 16F684

Config FOSC_INTOSCIO, WDTE_Off, PWRTE_ON, MCLRE_OFF, CP_ON, CPD_OFF, BOREN_OFF, IESO_OFF, FCMEN_OFF

;**** End of Fuse Configurator Settings ****
;-------------------------------------------------------------------------------

Declare Xtal = 8
Declare Optimiser_Level = 3

Declare Reminders Off
Declare Watchdog off


Symbol CR = 13
Symbol LF = 10

Declare Serial_Baud = 9600 ' Set the Baud rate for HRsoutLn

Declare RSOut_Pin = PORTA.0
Declare RSOut_Mode = 0

 PORTA = 0
 TRISA = 0
 
RsOut ""

Do

RsOut CR,CR,LF,"hello"
DelayMS 200
Loop ' Loop forever


Dolci

#6
thank you for the code Pepe but it didn't do exactly what the manual says.

QuoteParameters
Modifiers may be one of the serial data modifiers explained below.
Variable can be any user defined variable.
An optional Timeout Label may be included to allow the program to jump to a BASIC label if a
byte is not received within a certain amount of time. It can also be one of the compiler directives;
Break or Continue, if the command is used inside a loop. Break will exit a loop if a timeout
occurs, and Continue will re-iterate the loop. Timeout is specified in units of 1 millisecond
and is specified by using a Declare directive.

Example
     Device = 18F25K20
     Declare Xtal = 20 ' Tell the compiler the device will be operating at 20MHz
     Declare Rsin_Timeout = 2000 ' Timeout after 2 seconds
     Dim MyByte as Byte
     Dim MyWord as Word
     MyByte = Rsin, {Label}
     Rsin MyByte, MyWord
     Rsin { Label }, MyByte, MyWord
Label: { do something when timed out }

Correct me if I am wrong.. In my understanding the Declare Rsin_Timeout will jump to a label.

appreciate much
Dolci

Get well soon Pepe

RGV250

Hi,
In Pepe's example the TimeOut declare is included but I do not see a label for it to jump to.

Bob

top204

#8
Below is a code listing demo for the RSin command with a timeout, and the Declares required:

'
'   /\\\\\\\\\
'  /\\\///////\\\
'  \/\\\     \/\\\                                                 /\\\          /\\\
'   \/\\\\\\\\\\\/        /\\\\\     /\\\\\\\\\\     /\\\\\\\\   /\\\\\\\\\\\  /\\\\\\\\\\\  /\\\\\\\\\
'    \/\\\//////\\\      /\\\///\\\  \/\\\//////    /\\\/////\\\ \////\\\////  \////\\\////  \////////\\\
'     \/\\\    \//\\\    /\\\  \//\\\ \/\\\\\\\\\\  /\\\\\\\\\\\     \/\\\         \/\\\        /\\\\\\\\\\
'      \/\\\     \//\\\  \//\\\  /\\\  \////////\\\ \//\\///////      \/\\\ /\\     \/\\\ /\\   /\\\/////\\\
'       \/\\\      \//\\\  \///\\\\\/    /\\\\\\\\\\  \//\\\\\\\\\\    \//\\\\\      \//\\\\\   \//\\\\\\\\/\\
'        \///        \///     \/////     \//////////    \//////////      \/////        \/////     \////////\//
'                                  Let's find out together what makes pMin PIC Tick!
'
' Demonstrate the RSin command with a timeout
' Written for the Positron8 compiler by Les Johnson.
'
    Device = 18F26K22                           ' Tell the compiler what device to compile for
    Declare Xtal = 16                           ' Tell the compiler what frequency the device is operating at (in MHz)
'
' Setup RSin/RSout
'
    Declare Serial_Baud = 9600                  ' Set the Baud rate for RSin and RSout
    Declare RSOut_Pin = PORTC.6                 ' Set the pin for RSout
    Declare RSOut_Mode = 0                      ' Set the mode for RSout to inverted
   
    Declare RSIn_Pin = PORTC.7                  ' Set the pin for RSin
    Declare RSIn_Mode = 0                       ' Set the mode for RSin to inverted
    Declare RSIn_Timeout = 5000                 ' Set the timeout for RSin to 5000 milliseconds
'
' Create any global variables and constants here
'
    Dim MyByte As Byte
   
'----------------------------------------------------------------------------
' The main program starts here
' Receive data, and if not received in a certain time, jump to a timeout label
'
Main:

TryAgain:
    Do                                          ' Create a loop
        RsIn {TimedOut}, Wait(13), MyByte       ' Receive serial data, with a timeout
        RsOut MyByte                            ' Transmit what was received
    Loop                                        ' Do it forever
'
' Jump to here if the receive timed out
'   
TimedOut:
    RsOutLn "\rTimed Out"                       ' Transmit the text "Timed Out"
    GoTo TryAgain                               ' Go back and receive more data

Within the RSin command, the timeout label is held in the curly braces, so that the compiler's parser knows that it is a "jump to" label, and not a modifier or variable to load into etc..

Below is a screenshot of the above code listing working in the proteus simulator:

RSin-RSou With Timeout.jpg

Dolci

problem solve. curly hair is the culprit. :P

thank you top204

Dolci