News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

2 compiler errors I don't understand-help please

Started by basiclover, Jan 04, 2022, 09:24 AM

Previous topic - Next topic

basiclover

line 75 "lable main not found"

line 89"misplaced or incorrect Endif
'****************************************************************
'*  Name    : 16F877 essai simple LCD.BAS                                      *
'*  Author  : [select VIEW...EDITOR OPTIONS]                    *
'*  Notice  : Copyright (c) 2022 [select VIEW...EDITOR OPTIONS] *
'*          : All Rights Reserved                               *
'*  Date    : 1/3/2022                                          *
'*  Version : 1.0                                               *
'*  Notes   : rotary encoder                                                  *
'*          :                                                   *
'****************************************************************

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

Device = 16F877A

Config FOSC_HS, WDTE_OFF, PWRTE_OFF, BOREN_ON, LVP_OFF, CPD_OFF, WRT_OFF, DEBUG_OFF, CP_OFF

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

 ' LCD defs
    Declare LCD_Type = 0       'HITACHI HD44780 controller
    Declare LCD_DTPin PORTB.4  '4 pin config, data on 4 top pins(PortB4 to B7) of port B
    Declare LCD_RSPin = PORTB.3
    Declare LCD_ENPin = PORTB.2
    Declare LCD_Lines = 2
    Declare LCD_DataUs 75     'LCD time to wait beween data sent(microsec)for some older 16x2 44780 compatible displays (default = 50)

    Declare Xtal = 20     'mis 20 au lieu de 4 le 3 jan 21
   
    Dim pulse_detected As Byte
    Clear pulse_detected
    Dim rotary_pulses As SWord  'signed bytes to allow negative numbers
    Dim value1 As SWord
    Dim minus_value1 As SWord
    Dim value2 As SWord
    Dim minus_value2 As SWord
    Symbol INTEDG= OPTION_REG.6  '  if 0 interupt on falling edge RB0 , if 1 on rising edge
    Symbol Led1= PORTA.2
    'Symbol Led2= PORTA.5
    Symbol Led3= PORTD.0
    Symbol Led4= PORTD.1
    Symbol INTE= INTCON.4        ' if 1 enables external interrupt on B0
    Symbol INTF=INTCON.1         ' RB0 interrupt flag bit,if 1 interrupt occured
    Symbol GIE= INTCON.7       ' GIE=1  : enable all interrupts
    Symbol RotaryA  = PORTB.0  'pin A rotary encoder
    Symbol RotaryB  = PORTC.2  'pin B rotary encoder
    Symbol RotarySw = PORTB.1  'Rotary Encoder push button(ground when pushed)
    GIE=1                      ' enable all interrupts
    'INTE=1                     'enable B0 interrupt  enlevé 3 jan 21
       
    rotary_pulses=0
    ADCON1 = 6 ' Set all ports A to digital
    TRISA=%00000000 'set all portA to output
    TRISB=%00000011 'RB0 RB1=inputs, other=outputs
    TRISC=%00000100 'RC2 =input
    TRISD=%00000000 'RCD =ouputs
    'INTE=1           'enables external Interrupt On B0   
    INTEDG=0         'enable interupt On falling edge RB0
    INTF=0           'external interrupt did not occur
    'GoTo main
    On_Hardware_Interrupt  GoTo ENCODER_INTERRUPT_HANDLER ' where to go on interrupt.
   
    'Clear   deleted 3 jan 11h10
   
    Cls
    'DelayUS 75    ' deleted 3 jan 21
    DelayMS 2000   'added 3 jan 21
    Print At 2,1, "knutselaar.eu"      ' Standaard 2x16 44780 compatible display
   
    INTE=1           'enables external Interrupt On B0
    Clear Led1
75  GoTo main
ENCODER_INTERRUPT_HANDLER:              'Verandering van PORTB.1 gedetecteerd

Context Save PORTB,TRISB     ' Start interrupt (opslaan van het punt waar interrupt plaatsvond)

    DelayMS 6  '6ms au lieeu dde 500us 3 jan 21                                   'contact dender filter
    If RotaryA = 0 And RotaryB = 1 Then           'RoteryA = 0 houdt in; de neergaande flank
        If rotary_pulses < 3000 Then rotary_pulses = rotary_pulses + 1   'max32767 sword
    EndIf
    If RotaryA = 0 And RotaryB = 0 Then
        If rotary_pulses > -3000 Then rotary_pulses = rotary_pulses - 1  'max -32768 sword         
    EndIf
   
    If INTF=1  Then Set Led1
89   EndIf
     Print At 1,1,SDec rotary_pulses
     
     'DelayMS 3000
    INTF = 0      'Clear the PORTB.1 Interrupt FLAG

Context Restore  ' end interrupt
main     
    Clear Led1
    GoTo main
    End

trastikata

"If INTF=1  Then Set Led1" doesn't need EndIf statement when "Then" is followed by an operation.

main: - you forgot the semicolon

basiclover