News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

16F15223 Configuration issue

Started by okmn, May 15, 2024, 03:57 PM

Previous topic - Next topic

okmn

Quote from: trastikata on Jun 05, 2024, 04:44 AM
Quote from: okmn on Jun 04, 2024, 02:02 PMthe problem is timer0 interrupt issue
we could not see any led blinking still by using timer0 16bit

Did you try:

- 8-bit Timer0
- Fosc/4 instead of HFINTOSC
- Timer1

i had been tried this ;
Fosc/4 instead of HFINTOSC
same problem persists

I will try other tests later.

Pepe

#61
I have simulated the program in mplabx with pic-as and it works with the following values
 
T0CON1 = $45
TOCON0 = $90

PROCESSOR 16F15223
    #include <xc.inc>
  global Temporary , TemporaryH , Ten_MilliSeconds
    ;---------------------------------------------
; CONFIG FUSES
CONFIG FEXTOSC = OFF ,RSTOSC = HFINTOSC_32MHZ , CLKOUTEN = OFF , VDDAR = LO
CONFIG MCLRE=EXTMCLR ,PWRTS = PWRT_OFF ,WDTE=OFF,BOREN=ON,BORV=LO,PPS1WAY=OFF,STVREN=ON
CONFIG BBSIZE = BB512 , BBEN = OFF , SAFEN = OFF, WRTAPP = OFF , WRTB = OFF , WRTC = OFF ,WRTSAF = OFF ,LVP = ON
CONFIG CP = OFF

    psect udata
 
PP0:
    ds 1
PP0H:
    ds 1
PP1:
    ds 1
PP1H:
    ds 1
 
Ten_MilliSeconds:
    DS 1
Temporary:
    DS 1
TemporaryH:
    DS 1

    ; ALIAS VARIABLES
#define Blink_Led_1 LATA,2
#define Blink_Led_2 LATC,0

   
    psect code,delta=2,abs
 
 ORG 0x0000
 resetVect:
    goto main
   
ORG 0x0004
    goto ISR_Handler
     
delay_ms:
    clrf PP1H
delay_ms_wreg:
    movwf PP1
delayms_from_regs:
    movlw 255
    addwf PP1,F
    btfss STATUS,0
    addwf PP1H,F
    btfss STATUS,0
    return
    movlw 3
    movwf PP0H
    movlw 230
    call delay_us_wreg
    bra  delayms_from_regs
delay_us:
    clrf PP0H
delay_us_wreg:
    movwf PP0
    nop
    movlw 2
delay_us_loop:
    nop
    bcf STATUS,0
    subwfb PP0,F
    clrw
    subwfb PP0H,F
    btfsc STATUS,0
    bra delay_us_loop
    return
 
 main:

    banksel ANSELA
    clrf ANSELA
    clrf ANSELC
    clrf SLRCONA
    clrf SLRCONC
    clrf INLVLA
    clrf INLVLC
    banksel 0 
   
    call Setup

    clrf LATA
    clrf LATC

    banksel ANSELA
    clrf ANSELA
    clrf ANSELC
 
    banksel TRISA
    clrf TRISA
    clrf Ten_MilliSeconds
    clrf TemporaryH
    clrf Temporary

    banksel TMR0H
    movlw 246
    movwf TMR0H
    movlw 60
    movwf TMR0L
    movlw 69
    movwf T0CON1
    movlw 144
    movwf T0CON0
    banksel PIR0
    bcf PIR0,5
    bsf INTCON,6
    bsf INTCON,7
    bsf PIE0,5
    banksel T0CON0
    bsf T0CON0,7
lbl__2:   
    banksel LATC
    movlw 1
    xorwf LATC,F
    bcf TRISC,0
    clrf TemporaryH
    clrf Temporary
frlb__5:
    movlw 3
    subwf TemporaryH,W
    btfss STATUS,0
    bra cplb__2
    btfss STATUS,2
    bra nxlb__6
    movlw 232
    subwf Temporary,W
    btfsc STATUS,0
    bra nxlb__6
cplb__2:
    movlw 1
    banksel 0
    call delay_ms
ctlb__7:
    movlw 1
    addwf Temporary,F
    movlw 0
    addwfc TemporaryH,F
    btfss STATUS,0
    bra frlb__5
nxlb__6:
lbl__4:
    bra lbl__2
   
ISR_Handler:
  banksel PIR0
    movf PIR0,W
    banksel 0
    btfss WREG,5
    bra lbl__9
    banksel PIR0
    bcf PIR0,5
    banksel TMR0H
    movlw 246
    movwf TMR0H
    movlw 60
    movwf TMR0L
    banksel Ten_MilliSeconds
    incf Ten_MilliSeconds,F
    movlw 50
    subwf Ten_MilliSeconds,W
    btfss STATUS,2
    bra lbl__11
    clrf Ten_MilliSeconds
    movlw 4
    xorwf LATA,F
    bcf TRISA,2
lbl__11:
lbl__9:
    retfie 
   
Setup:
    call Osc_Init_32MHz
    return

Osc_Init_32MHz:
    banksel OSCEN
    clrf OSCEN
    movlw 5
    movwf OSCFRQ
    clrf OSCTUNE
    banksel 0
    return
END

this is de source

''****************************************************************
''*  Name    : PIC16F15223_TMR0.BAS                              *
''*  Author  : [select VIEW...EDITOR OPTIONS]                    *
''*  Notice  : Copyright (c) 2024 [select VIEW...EDITOR OPTIONS] *
''*          : All Rights Reserved                              *
''*  Date    : 16.05.2024                                        *
''*  Version : 1.0                                              *
''*  Notes  :                                                  *
''*          :                                                  *
''****************************************************************
'
    Device = 16F15223                          ' Tell the compiler what device to compile for
    Declare Xtal = 32                          ' Tell the compiler what frequency the device is operating at (in MHz)

'--------------------------------------------------------------------------------------------------
' The main program starts here
'
On_Hardware_Interrupt GoTo ISR_Handler

Setup()                                    ' Setup the program and peripherals
LATA = 0
LATC = 0
ANSELA = 0
ANSELC = 0
TRISA = 0
TRISC = 0

Symbol Blink_Led_1 = LATA.2
Symbol Blink_Led_2 = LATC.0
Dim Ten_MilliSeconds As Byte = 0
Dim Temporary As Word = 0

'*****************************************************************************
'TMR0 10ms Interrupt Setting
 TMR0H = $F6
 TMR0L = $3C
 
 T0CON1 = $45
 'TOCON1.7 = Timer0 Clock Source Select Bit 2
 'TOCON1.6 = Timer0 Clock Source Select Bit 1
 'TOCON1.5 = Timer0 Clock Source Select Bit 0
 'TOCON1.4 = TMR0 Input Asynchronization Enable 0:The input to the TMR0 counter is synchronized to Fosc/4
 'TOCON1.3 =  Prescaler Rate Select Bit 3     
 'TOCON1.2 =  Prescaler Rate Select Bit 2
 'TOCON1.1 =  Prescaler Rate Select Bit 1
 'TOCON1.0 =  Prescaler Rate Select Bit 0
 
 
 T0CON0 = $90
 'TOCON0.7 = TMR0 Enable bit
 'TOCON0.6 = --
 'TOCON0.5 = TMR0 Output Read only
 'TOCON0.4 = 16-Bit Timer Operation Select 1:16 bit ; 0:8 bit
 'TOCON0.3 =  TMR0 Output Postscaler (Divider) Select Bit 3
 'TOCON0.2 =  TMR0 Output Postscaler (Divider) Select Bit 2
 'TOCON0.1 =  TMR0 Output Postscaler (Divider) Select Bit 1
 'TOCON0.0 =  TMR0 Output Postscaler (Divider) Select Bit 0

'******************************************************************************
PIR0bits_TMR0IF = 0
INTCONbits_PEIE = 1 'Peripheral Interrupt enabled
INTCONbits_GIE = 1  'Global Interrupt enabled
PIE0bits_TMR0IE = 1 'TMR0 Interrupt enabled
T0CON0Bits_T0EN = 1 'Timer0 Enabled
    Do
    Toggle Blink_Led_2
    For Temporary = 0 To 999
        DelayMS 1
    Next Temporary   
    Loop

ISR_Handler:
Context Save
 If PIR0bits_TMR0IF = 1 Then   
    PIR0bits_TMR0IF = 0
    TMR0H = $F6
    TMR0L = $3C
    Inc Ten_MilliSeconds
    If Ten_MilliSeconds = 50 Then
        Ten_MilliSeconds = 0
        Toggle Blink_Led_1'Every 500ms blink
    EndIf           
 EndIf
Context Restore
 
'--------------------------------------------------------------------------------------------------
' Setup the program and peripherals
' Input    : None
' Output    : None
' Notes    : None
'
Proc Setup()
    Osc_Init_32MHz()                            ' Setup the PIC16F15223 to operate with its internal oscillator at 32MHz
'
' Any more setup code needed goes here, before the main program runs.
'
EndProc

'--------------------------------------------------------------------------------------------------
' Setup the PIC16F15223 to operate with its internal oscillator at 32MHz
' Input    : None
' Output    : None
' Notes    : None
'
Proc Osc_Init_32MHz()
    OSCEN = $00
    OSCFRQ = $05                                ' FRQ 32MHz
    OSCTUNE = $00
EndProc

'--------------------------------------------------------------------------------------------------
' Setup the config fuses for the internal 32MHz oscillator

    Config1 FEXTOSC_OFF,_                      ' External Oscillator not enabled
            RSTOSC_HFINTOSC_32MHZ,_            ' HFINTOSC 32MHz
            CLKOUTEN_OFF,_                      ' CLKOUT function is disabled. I/O function on RA4
            VDDAR_LO                            ' VDD Range Analog Calibration Selection bit->Internal analog systems are calibrated For operation between VDD = 1.8V - 3.6V

    Config2 MCLRE_EXTMCLR,_                    ' If LVP = 0, MCLR pin is MCLR. If LVP = 1. RA3 pin function is MCLR
            PWRTS_PWRT_OFF,_                    ' PWRT is disabled
            WDTE_OFF,_                          ' WDT disabled. SEN is ignored
            BOREN_ON,_                          ' Brown-out Reset Enabled. SBOREN bit is ignored
            BORV_LO,_                          ' Brown-out Reset Voltage (VBOR) set to 1.9V
            PPS1WAY_OFF,_                      ' The PPSLOCKED bit can be set and cleared as needed
            STVREN_ON                          ' Stack Overflow or Underflow will cause a reset

    Config4 BBSIZE_BB512,_                      ' 512 words boot block size
            BBEN_OFF,_                          ' Boot Block is disabled
            SAFEN_OFF,_                        ' SAF is disabled
            WRTAPP_OFF,_                        ' Application Block is not write-protected
            WRTB_OFF,_                          ' Boot Block is not write-protected
            WRTC_OFF,_                          ' Configuration Registers are not write-protected
            WRTSAF_OFF,_                        ' Storage Area Flash is not write-protected
            LVP_ON                            ' High Voltage on MCLR/Vpp must be used for programming

    Config5 CP_OFF                              ' User Program Flash Memory code protection is disabled
'

okmn

Quote from: Pepe on Jun 05, 2024, 08:43 PMI have simulated the program in mplabx with pic-as and it works with the following values
 
T0CON1 = $45
TOCON0 = $90

PROCESSOR 16F15223
    #include <xc.inc>
  global Temporary , TemporaryH , Ten_MilliSeconds
    ;---------------------------------------------
; CONFIG FUSES
CONFIG FEXTOSC = OFF ,RSTOSC = HFINTOSC_32MHZ , CLKOUTEN = OFF , VDDAR = LO
CONFIG MCLRE=EXTMCLR ,PWRTS = PWRT_OFF ,WDTE=OFF,BOREN=ON,BORV=LO,PPS1WAY=OFF,STVREN=ON
CONFIG BBSIZE = BB512 , BBEN = OFF , SAFEN = OFF, WRTAPP = OFF , WRTB = OFF , WRTC = OFF ,WRTSAF = OFF ,LVP = ON
CONFIG CP = OFF

    psect udata
 
PP0:
    ds 1
PP0H:
    ds 1
PP1:
    ds 1
PP1H:
    ds 1
 
Ten_MilliSeconds:
    DS 1
Temporary:
    DS 1
TemporaryH:
    DS 1

    ; ALIAS VARIABLES
#define Blink_Led_1 LATA,2
#define Blink_Led_2 LATC,0

   
    psect code,delta=2,abs
 
 ORG 0x0000
 resetVect:
    goto main
   
ORG 0x0004
    goto ISR_Handler
     
delay_ms:
    clrf PP1H
delay_ms_wreg:
    movwf PP1
delayms_from_regs:
    movlw 255
    addwf PP1,F
    btfss STATUS,0
    addwf PP1H,F
    btfss STATUS,0
    return
    movlw 3
    movwf PP0H
    movlw 230
    call delay_us_wreg
    bra  delayms_from_regs
delay_us:
    clrf PP0H
delay_us_wreg:
    movwf PP0
    nop
    movlw 2
delay_us_loop:
    nop
    bcf STATUS,0
    subwfb PP0,F
    clrw
    subwfb PP0H,F
    btfsc STATUS,0
    bra delay_us_loop
    return
 
 main:

    banksel ANSELA
    clrf ANSELA
    clrf ANSELC
    clrf SLRCONA
    clrf SLRCONC
    clrf INLVLA
    clrf INLVLC
    banksel 0 
   
    call Setup

    clrf LATA
    clrf LATC

    banksel ANSELA
    clrf ANSELA
    clrf ANSELC
 
    banksel TRISA
    clrf TRISA
    clrf Ten_MilliSeconds
    clrf TemporaryH
    clrf Temporary

    banksel TMR0H
    movlw 246
    movwf TMR0H
    movlw 60
    movwf TMR0L
    movlw 69
    movwf T0CON1
    movlw 144
    movwf T0CON0
    banksel PIR0
    bcf PIR0,5
    bsf INTCON,6
    bsf INTCON,7
    bsf PIE0,5
    banksel T0CON0
    bsf T0CON0,7
lbl__2:   
    banksel LATC
    movlw 1
    xorwf LATC,F
    bcf TRISC,0
    clrf TemporaryH
    clrf Temporary
frlb__5:
    movlw 3
    subwf TemporaryH,W
    btfss STATUS,0
    bra cplb__2
    btfss STATUS,2
    bra nxlb__6
    movlw 232
    subwf Temporary,W
    btfsc STATUS,0
    bra nxlb__6
cplb__2:
    movlw 1
    banksel 0
    call delay_ms
ctlb__7:
    movlw 1
    addwf Temporary,F
    movlw 0
    addwfc TemporaryH,F
    btfss STATUS,0
    bra frlb__5
nxlb__6:
lbl__4:
    bra lbl__2
   
ISR_Handler:
  banksel PIR0
    movf PIR0,W
    banksel 0
    btfss WREG,5
    bra lbl__9
    banksel PIR0
    bcf PIR0,5
    banksel TMR0H
    movlw 246
    movwf TMR0H
    movlw 60
    movwf TMR0L
    banksel Ten_MilliSeconds
    incf Ten_MilliSeconds,F
    movlw 50
    subwf Ten_MilliSeconds,W
    btfss STATUS,2
    bra lbl__11
    clrf Ten_MilliSeconds
    movlw 4
    xorwf LATA,F
    bcf TRISA,2
lbl__11:
lbl__9:
    retfie 
   
Setup:
    call Osc_Init_32MHz
    return

Osc_Init_32MHz:
    banksel OSCEN
    clrf OSCEN
    movlw 5
    movwf OSCFRQ
    clrf OSCTUNE
    banksel 0
    return
END

this is de source

''****************************************************************
''*  Name    : PIC16F15223_TMR0.BAS                              *
''*  Author  : [select VIEW...EDITOR OPTIONS]                    *
''*  Notice  : Copyright (c) 2024 [select VIEW...EDITOR OPTIONS] *
''*          : All Rights Reserved                              *
''*  Date    : 16.05.2024                                        *
''*  Version : 1.0                                              *
''*  Notes  :                                                  *
''*          :                                                  *
''****************************************************************
'
    Device = 16F15223                          ' Tell the compiler what device to compile for
    Declare Xtal = 32                          ' Tell the compiler what frequency the device is operating at (in MHz)

'--------------------------------------------------------------------------------------------------
' The main program starts here
'
On_Hardware_Interrupt GoTo ISR_Handler

Setup()                                    ' Setup the program and peripherals
LATA = 0
LATC = 0
ANSELA = 0
ANSELC = 0
TRISA = 0
TRISC = 0

Symbol Blink_Led_1 = LATA.2
Symbol Blink_Led_2 = LATC.0
Dim Ten_MilliSeconds As Byte = 0
Dim Temporary As Word = 0

'*****************************************************************************
'TMR0 10ms Interrupt Setting
 TMR0H = $F6
 TMR0L = $3C
 
 T0CON1 = $45
 'TOCON1.7 = Timer0 Clock Source Select Bit 2
 'TOCON1.6 = Timer0 Clock Source Select Bit 1
 'TOCON1.5 = Timer0 Clock Source Select Bit 0
 'TOCON1.4 = TMR0 Input Asynchronization Enable 0:The input to the TMR0 counter is synchronized to Fosc/4
 'TOCON1.3 =  Prescaler Rate Select Bit 3     
 'TOCON1.2 =  Prescaler Rate Select Bit 2
 'TOCON1.1 =  Prescaler Rate Select Bit 1
 'TOCON1.0 =  Prescaler Rate Select Bit 0
 
 
 T0CON0 = $90
 'TOCON0.7 = TMR0 Enable bit
 'TOCON0.6 = --
 'TOCON0.5 = TMR0 Output Read only
 'TOCON0.4 = 16-Bit Timer Operation Select 1:16 bit ; 0:8 bit
 'TOCON0.3 =  TMR0 Output Postscaler (Divider) Select Bit 3
 'TOCON0.2 =  TMR0 Output Postscaler (Divider) Select Bit 2
 'TOCON0.1 =  TMR0 Output Postscaler (Divider) Select Bit 1
 'TOCON0.0 =  TMR0 Output Postscaler (Divider) Select Bit 0

'******************************************************************************
PIR0bits_TMR0IF = 0
INTCONbits_PEIE = 1 'Peripheral Interrupt enabled
INTCONbits_GIE = 1  'Global Interrupt enabled
PIE0bits_TMR0IE = 1 'TMR0 Interrupt enabled
T0CON0Bits_T0EN = 1 'Timer0 Enabled
    Do
    Toggle Blink_Led_2
    For Temporary = 0 To 999
        DelayMS 1
    Next Temporary   
    Loop

ISR_Handler:
Context Save
 If PIR0bits_TMR0IF = 1 Then   
    PIR0bits_TMR0IF = 0
    TMR0H = $F6
    TMR0L = $3C
    Inc Ten_MilliSeconds
    If Ten_MilliSeconds = 50 Then
        Ten_MilliSeconds = 0
        Toggle Blink_Led_1'Every 500ms blink
    EndIf           
 EndIf
Context Restore
 
'--------------------------------------------------------------------------------------------------
' Setup the program and peripherals
' Input    : None
' Output    : None
' Notes    : None
'
Proc Setup()
    Osc_Init_32MHz()                            ' Setup the PIC16F15223 to operate with its internal oscillator at 32MHz
'
' Any more setup code needed goes here, before the main program runs.
'
EndProc

'--------------------------------------------------------------------------------------------------
' Setup the PIC16F15223 to operate with its internal oscillator at 32MHz
' Input    : None
' Output    : None
' Notes    : None
'
Proc Osc_Init_32MHz()
    OSCEN = $00
    OSCFRQ = $05                                ' FRQ 32MHz
    OSCTUNE = $00
EndProc

'--------------------------------------------------------------------------------------------------
' Setup the config fuses for the internal 32MHz oscillator

    Config1 FEXTOSC_OFF,_                      ' External Oscillator not enabled
            RSTOSC_HFINTOSC_32MHZ,_            ' HFINTOSC 32MHz
            CLKOUTEN_OFF,_                      ' CLKOUT function is disabled. I/O function on RA4
            VDDAR_LO                            ' VDD Range Analog Calibration Selection bit->Internal analog systems are calibrated For operation between VDD = 1.8V - 3.6V

    Config2 MCLRE_EXTMCLR,_                    ' If LVP = 0, MCLR pin is MCLR. If LVP = 1. RA3 pin function is MCLR
            PWRTS_PWRT_OFF,_                    ' PWRT is disabled
            WDTE_OFF,_                          ' WDT disabled. SEN is ignored
            BOREN_ON,_                          ' Brown-out Reset Enabled. SBOREN bit is ignored
            BORV_LO,_                          ' Brown-out Reset Voltage (VBOR) set to 1.9V
            PPS1WAY_OFF,_                      ' The PPSLOCKED bit can be set and cleared as needed
            STVREN_ON                          ' Stack Overflow or Underflow will cause a reset

    Config4 BBSIZE_BB512,_                      ' 512 words boot block size
            BBEN_OFF,_                          ' Boot Block is disabled
            SAFEN_OFF,_                        ' SAF is disabled
            WRTAPP_OFF,_                        ' Application Block is not write-protected
            WRTB_OFF,_                          ' Boot Block is not write-protected
            WRTC_OFF,_                          ' Configuration Registers are not write-protected
            WRTSAF_OFF,_                        ' Storage Area Flash is not write-protected
            LVP_ON                            ' High Voltage on MCLR/Vpp must be used for programming

    Config5 CP_OFF                              ' User Program Flash Memory code protection is disabled
'


hi Pepe,

only Blink_Led_2 is blinking

Toggle Blink_Led_1 is not blinking.



Pepe

#63
Could you be so kind as to try the 2 hexs files again?
to determine if the interrupt is executed every 10ms

trastikata

Hello okmn,

can you try this ISR code where instead of toggling the LATA.2, it is being read first and then changed:

Context Save
    If PIR0bits_TMR0IF = 1 Then   
        PIR0bits_TMR0IF = 0
        TMR0H = $F6
        TMR0L = $3C
        Inc Ten_MilliSeconds
        If Ten_MilliSeconds = 50 Then
            Ten_MilliSeconds = 0
            If LATA.2 = 1 Then
                LATA.2 = 0
            Else
                LATA.2 = 1
            EndIf
        EndIf           
    EndIf
Context Restore

okmn

Quote from: Pepe on Jun 06, 2024, 02:14 AMCould you be so kind as to try the 2 hexs files again?
to determine if the interrupt is executed every 10ms

interrupt not runed,
 
only one led blinking it is in do--loop

okmn

Quote from: trastikata on Jun 06, 2024, 04:43 AMHello okmn,

can you try this ISR code where instead of toggling the LATA.2, it is being read first and then changed:

Context Save
    If PIR0bits_TMR0IF = 1 Then   
        PIR0bits_TMR0IF = 0
        TMR0H = $F6
        TMR0L = $3C
        Inc Ten_MilliSeconds
        If Ten_MilliSeconds = 50 Then
            Ten_MilliSeconds = 0
            If LATA.2 = 1 Then
                LATA.2 = 0
            Else
                LATA.2 = 1
            EndIf
        EndIf           
    EndIf
Context Restore


interrupt not runed,
 
only one led blinking it is in do--loop

okmn

only the led in do-loop is blinking

Timer0 16bit inerrupt rutine looks not enable/run (Although we write the relevant commands)


tumbleweed

Try setting the timer to run in async mode (T0CON1.ASYNC = 1)

Pepe

try again

okmn

Quote from: Pepe on Jun 06, 2024, 02:23 PMtry again


Leds.hex is ok. 
2 led are blinking


tnencon

Pepe, can you share the source code of the Leds program?
Thanks

Pepe

If the program I attached works well, then I have been able to determine what the error is why when it is compiled with positron it does not work and when it is compiled with ccs it works correctly.
I await your response okmn.
Thank you.

okmn

#73
Quote from: Pepe on Jun 07, 2024, 09:17 PMIf the program I attached works well, then I have been able to determine what the error is why when it is compiled with positron it does not work and when it is compiled with ccs it works correctly.
I await your response okmn.
Thank you.

Green color led is RC0
Red color Led is RA2



Pepe

Indeed the problem was what I thought, you will have to wait for Les to solve it.

top204

#75
Looking at the movlb mnemonic in the assembler listing, it is not being generated correctly as its device value, as posted in the anomaly section.

So.... Looking at the info details about the 16F15223 device, the only thing I could see different was in the "8bit_device.info" file, and it was a difference so subtle, it should not do anything, but it seems it does!

With Notepad.exe only, open the "8bit_device.info" file at "C:\Program Files (x86)\ProtonIDE\PDS\Includes\bin8\8bit_device.info\"

And do a text search for <PIC16F15223>.

The line will be:

<PART_INFO_TYPE><15223><PIC16F15223><16Exxx><a><1><7ff><40><7f><0><0-0><0-0><0><5>

So change it to:

<PART_INFO_TYPE><15223><PIC16F15223><16EXxx><a><1><7ff><40><7f><0><0-0><0-0><0><5>

Notice the subtle change of <16Exxx> to <16EXxx>.

Now the movlb mnemonic seems to create the correct device values. i.e:

017E movlb 0x3E

Instead of the incorrect one of:

003E movlb 0x3E

Wow! I've seen some subtle querks in programs, but that one is totally idiotic. Why on earth should a lowercase and uppercase character in a device's type make any difference to the mnemonic code it generates? They are the same device family. i.e. Enhanced 14-bit core devices! However, with microchip, every idiotic thing is possible in their programs. :-)

This should correct the anomaly with the movlb mnemonic and I have just found a 16F15224 that has the same querk, so I will run some tests, and post a new "8bit_device.info" file.

Many thanks for finding the anomaly.


okmn

Guys ,
tahnk you so much
16F15223 Timer0 interrupt is ok now 

Green led is RC0
red Led is RA2


''****************************************************************
''*  Name    : PIC16F15223_TMR0.BAS                              *
''*  Author  : [select VIEW...EDITOR OPTIONS]                    *
''*  Notice  : Copyright (c) 2024 [select VIEW...EDITOR OPTIONS] *
''*          : All Rights Reserved                              *
''*  Date    : 16.05.2024                                        *
''*  Version : 1.0                                              *
''*  Notes  :                                                  *
''*          :                                                  *
''****************************************************************
'
    Device = 16F15223                          ' Tell the compiler what device to compile for
    Declare Xtal = 32                          ' Tell the compiler what frequency the device is operating at (in MHz)

'--------------------------------------------------------------------------------------------------
' The main program starts here
'
On_Hardware_Interrupt GoTo ISR_Handler

Setup()                                    ' Setup the program and peripherals
LATA = 0
LATC = 0
ANSELA = 0
ANSELC = 0
TRISA = 0
TRISC = 0

Symbol Blink_Led_1 = LATA.2
Symbol Blink_Led_2 = LATC.0
Dim Ten_MilliSeconds As Byte = 0
Dim Temporary As Word = 0

'*****************************************************************************
'TMR0 10ms Interrupt Setting
 TMR0H = $F6
 TMR0L = $3C
 
 T0CON1 = $45
 'TOCON1.7 = Timer0 Clock Source Select Bit 2
 'TOCON1.6 = Timer0 Clock Source Select Bit 1
 'TOCON1.5 = Timer0 Clock Source Select Bit 0
 'TOCON1.4 = TMR0 Input Asynchronization Enable 0:The input to the TMR0 counter is synchronized to Fosc/4
 'TOCON1.3 =  Prescaler Rate Select Bit 3   
 'TOCON1.2 =  Prescaler Rate Select Bit 2
 'TOCON1.1 =  Prescaler Rate Select Bit 1
 'TOCON1.0 =  Prescaler Rate Select Bit 0
 
 
 T0CON0 = $90
 'TOCON0.7 = TMR0 Enable bit
 'TOCON0.6 = --
 'TOCON0.5 = TMR0 Output Read only
 'TOCON0.4 = 16-Bit Timer Operation Select 1:16 bit ; 0:8 bit
 'TOCON0.3 =  TMR0 Output Postscaler (Divider) Select Bit 3
 'TOCON0.2 =  TMR0 Output Postscaler (Divider) Select Bit 2
 'TOCON0.1 =  TMR0 Output Postscaler (Divider) Select Bit 1
 'TOCON0.0 =  TMR0 Output Postscaler (Divider) Select Bit 0

'******************************************************************************
PIR0bits_TMR0IF = 0
INTCONbits_PEIE = 1 'Peripheral Interrupt enabled
INTCONbits_GIE = 1  'Global Interrupt enabled
PIE0bits_TMR0IE = 1 'TMR0 Interrupt enabled
T0CON0Bits_T0EN = 1 'Timer0 Enabled
    Do
    Toggle Blink_Led_2
    For Temporary = 0 To 999
        DelayMS 1
    Next Temporary 
    Loop

ISR_Handler:
Context Save
 If PIR0bits_TMR0IF = 1 Then 
    PIR0bits_TMR0IF = 0
    TMR0H = $F6
    TMR0L = $3C
    Inc Ten_MilliSeconds
    If Ten_MilliSeconds = 50 Then
        Ten_MilliSeconds = 0
        Toggle Blink_Led_1'Every 500ms blink
    EndIf         
 EndIf
Context Restore
 
'--------------------------------------------------------------------------------------------------
' Setup the program and peripherals
' Input    : None
' Output    : None
' Notes    : None
'
Proc Setup()
    Osc_Init_32MHz()                            ' Setup the PIC16F15223 to operate with its internal oscillator at 32MHz
'
' Any more setup code needed goes here, before the main program runs.
'
EndProc

'--------------------------------------------------------------------------------------------------
' Setup the PIC16F15223 to operate with its internal oscillator at 32MHz
' Input    : None
' Output    : None
' Notes    : None
'
Proc Osc_Init_32MHz()
    OSCEN = $00
    OSCFRQ = $05                                ' FRQ 32MHz
    OSCTUNE = $00
EndProc

'--------------------------------------------------------------------------------------------------
' Setup the config fuses for the internal 32MHz oscillator

    Config1 FEXTOSC_OFF,_                      ' External Oscillator not enabled
            RSTOSC_HFINTOSC_32MHZ,_            ' HFINTOSC 32MHz
            CLKOUTEN_OFF,_                      ' CLKOUT function is disabled. I/O function on RA4
            VDDAR_LO                            ' VDD Range Analog Calibration Selection bit->Internal analog systems are calibrated For operation between VDD = 1.8V - 3.6V

    Config2 MCLRE_EXTMCLR,_                    ' If LVP = 0, MCLR pin is MCLR. If LVP = 1. RA3 pin function is MCLR
            PWRTS_PWRT_OFF,_                    ' PWRT is disabled
            WDTE_OFF,_                          ' WDT disabled. SEN is ignored
            BOREN_ON,_                          ' Brown-out Reset Enabled. SBOREN bit is ignored
            BORV_LO,_                          ' Brown-out Reset Voltage (VBOR) set to 1.9V
            PPS1WAY_OFF,_                      ' The PPSLOCKED bit can be set and cleared as needed
            STVREN_ON                          ' Stack Overflow or Underflow will cause a reset

    Config4 BBSIZE_BB512,_                      ' 512 words boot block size
            BBEN_OFF,_                          ' Boot Block is disabled
            SAFEN_OFF,_                        ' SAF is disabled
            WRTAPP_OFF,_                        ' Application Block is not write-protected
            WRTB_OFF,_                          ' Boot Block is not write-protected
            WRTC_OFF,_                          ' Configuration Registers are not write-protected
            WRTSAF_OFF,_                        ' Storage Area Flash is not write-protected
            LVP_ON                            ' High Voltage on MCLR/Vpp must be used for programming

    Config5 CP_OFF                              ' User Program Flash Memory code protection is disabled