News:

;) This forum is the property of Proton software developers

Main Menu

16F15223 Configuration issue

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

Previous topic - Next topic

okmn

Hi guys,
do you see any wrong about this Config deatil for  16F15223

Device 16F15223
Config1 FEXTOSC_OFF,RSTOSC_HFINTOSC_32MHZ,CLKOUTEN_OFF,VDDAR_HI
Config2 MCLRE_EXTMCLR, PWRTS_PWRT_OFF, WDTE_OFF,BOREN_OFF,BORV_LO,PPS1WAY_ON,STVREN_OFF

Config4  BBSIZE_BB512,BBEN_OFF,SAFEN_OFF,WRTAPP_OFF,WRTB_OFF,WRTC_OFF,WRTSAF_OFF,LVP_OFF
Config5 CP_OFF
Declare Xtal = 32

top204

#1
According to the datasheet, you also have to setup an SFR for internal oscillator use. Try the code listing below for a template program outlay:

'
'   /\\\\\\\\\
'  /\\\///////\\\
'  \/\\\     \/\\\                                                 /\\\          /\\\
'   \/\\\\\\\\\\\/        /\\\\\     /\\\\\\\\\\     /\\\\\\\\   /\\\\\\\\\\\  /\\\\\\\\\\\  /\\\\\\\\\
'    \/\\\//////\\\      /\\\///\\\  \/\\\//////    /\\\/////\\\ \////\\\////  \////\\\////  \////////\\\
'     \/\\\    \//\\\    /\\\  \//\\\ \/\\\\\\\\\\  /\\\\\\\\\\\     \/\\\         \/\\\        /\\\\\\\\\\
'      \/\\\     \//\\\  \//\\\  /\\\  \////////\\\ \//\\///////      \/\\\ /\\     \/\\\ /\\   /\\\/////\\\
'       \/\\\      \//\\\  \///\\\\\/    /\\\\\\\\\\  \//\\\\\\\\\\    \//\\\\\      \//\\\\\   \//\\\\\\\\/\\
'        \///        \///     \/////     \//////////    \//////////      \/////        \/////     \////////\//
'                                  Let's find out together what makes a PIC Tick!
'
' A code listing template for a PIC16F15223 device operating at 32MHz with its internal oscillator
' Written by Les Johnson for the Positron8 BASIC compiler.
'
    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
'
Main:
    Setup()                                     ' Setup the program and peripherals
   
    Do
    '
    ' The program's code goes inside here, if it needs to be continuous
    '
    Loop
   
'--------------------------------------------------------------------------------------------------
' 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_HI                            ' VDD Internal analog systems are calibrated for operation between VDD = 2.3V - 5.5V

    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_OFF                             ' High Voltage on MCLR/Vpp must be used for programming

    Config5 CP_OFF                              ' User Program Flash Memory code protection is disabled

okmn

#2
there are 2 leds output

ra2 and rc0

vdd is 3v

i want internal 32mhz osc

any led no have blink

where is the wrong in these 3 sample codes?


Device 16F15223
Declare Xtal = 32
OSCCON = 0
OSCEN = $40
OSCFRQ = $05
OSCSTAT = 0
OSCTUNE = 0
Config1 FEXTOSC_OFF,RSTOSC_HFINTOSC_32MHZ,CLKOUTEN_OFF,VDDAR_LO
Config2 MCLRE_EXTMCLR, PWRTS_PWRT_OFF, WDTE_OFF,BOREN_OFF,BORV_LO,PPS1WAY_OFF,STVREN_OFF
Config4  BBSIZE_BB512,BBEN_OFF,SAFEN_OFF,WRTAPP_OFF,WRTB_OFF,WRTC_OFF,WRTSAF_OFF,LVP_ON
Config5 CP_OFF

LATA = 0
LATC = 0

TRISA = $28
TRISC = $1C

ANSELA = 0
ANSELC = $1C

WPUA = $20
WPUC = 0
ODCONA = 0
ODCONC = 0

SLRCONA = $37
SLRCONC = $3F

INLVLA = $3F
INLVLC = $3F

IOCAP = 0
IOCAN = 0
IOCAF = 0
IOCCP = 0
IOCCN = 0
IOCCF = 0
INTCONbits_PEIE = 0
INTCONbits_GIE = 0
PIE0bits_TMR0IE = 0
PIR0bits_TMR0IF = 0
T0CON0bits_T0EN = 0

TMR0H = $F3
TMR0L = $CB
T0CON1 = $46
T0CON0 = $13

On_Hardware_Interrupt GoTo ISR_Handler
    Symbol Blink_Led = PORTC.0
    Symbol Relay_Output = PORTA.2
T0CON0 = $93
Main:

    Do
      Relay_Output = ~Blink_Led
    Loop

 
ISR_Handler:
Context Save
 If PIR0bits_TMR0IF = 1 Then    'her 100ms de interrupt oluşur
    PIR0bits_TMR0IF = 0
    TMR0H = $F3
    TMR0L = $CB
    Toggle Blink_Led
EndIf

Context Restore


'
'  /\\\\\\\\\
'  /\\\///////\\\
'  \/\\\    \/\\\                                                /\\\          /\\\
'  \/\\\\\\\\\\\/        /\\\\\    /\\\\\\\\\\    /\\\\\\\\  /\\\\\\\\\\\  /\\\\\\\\\\\  /\\\\\\\\\
'    \/\\\//////\\\      /\\\///\\\  \/\\\//////    /\\\/////\\\ \////\\\////  \////\\\////  \////////\\\
'    \/\\\    \//\\\    /\\\  \//\\\ \/\\\\\\\\\\  /\\\\\\\\\\\    \/\\\        \/\\\        /\\\\\\\\\\
'      \/\\\    \//\\\  \//\\\  /\\\  \////////\\\ \//\\///////      \/\\\ /\\    \/\\\ /\\  /\\\/////\\\
'      \/\\\      \//\\\  \///\\\\\/    /\\\\\\\\\\  \//\\\\\\\\\\    \//\\\\\      \//\\\\\  \//\\\\\\\\/\\
'        \///        \///    \/////    \//////////    \//////////      \/////        \/////    \////////\//
'                                  Let's find out together what makes a PIC Tick!
'
' A code listing template for a PIC16F15223 device operating at 32MHz with its internal oscillator
' Written by Les Johnson for the Positron8 BASIC compiler.
'
    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
'
Main:
    Setup()                                    ' Setup the program and peripherals
ANSELA = 0
ANSELC = 0
TRISA = 0
TRISC = 0 
    Do
Toggle PORTC.0
DelayMS 500
Toggle PORTA.2
    Loop
 
'--------------------------------------------------------------------------------------------------
' 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_HI                            ' VDD Internal analog systems are calibrated for operation between VDD = 2.3V - 5.5V

    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_OFF                            ' High Voltage on MCLR/Vpp must be used for programming

    Config5 CP_OFF                              ' User Program Flash Memory code protection is disabled

but only ra2 led blinking random ms (no as the code set ms) when i changed ;

Declare Xtal = 4 and RSTOSC_HFINTOSC_1MHZ (1mhz)


Device 16F15223
Declare Xtal = 4
OSCCON = 0
OSCEN = $40
OSCFRQ = $05
OSCSTAT = 0
OSCTUNE = 0
Config1 FEXTOSC_OFF,RSTOSC_HFINTOSC_1MHZ,CLKOUTEN_OFF,VDDAR_LO
Config2 MCLRE_EXTMCLR, PWRTS_PWRT_OFF, WDTE_OFF,BOREN_OFF,BORV_LO,PPS1WAY_OFF,STVREN_OFF
Config4  BBSIZE_BB512,BBEN_OFF,SAFEN_OFF,WRTAPP_OFF,WRTB_OFF,WRTC_OFF,WRTSAF_OFF,LVP_ON
Config5 CP_OFF

LATA = 0
LATC = 0

TRISA = $28
TRISC = $1C

ANSELA = 0
ANSELC = $1C

WPUA = $20
WPUC = 0
ODCONA = 0
ODCONC = 0

SLRCONA = $37
SLRCONC = $3F

INLVLA = $3F
INLVLC = $3F

IOCAP = 0
IOCAN = 0
IOCAF = 0
IOCCP = 0
IOCCN = 0
IOCCF = 0
INTCONbits_PEIE = 0
INTCONbits_GIE = 0
PIE0bits_TMR0IE = 0
PIR0bits_TMR0IF = 0
T0CON0bits_T0EN = 0

TMR0H = $F3
TMR0L = $CB
T0CON1 = $46
T0CON0 = $13

On_Hardware_Interrupt GoTo ISR_Handler
    Symbol Blink_Led = PORTC.0
    Symbol Relay_Output = PORTA.2
T0CON0 = $93
Main:

    Do
      Relay_Output = ~Blink_Led
    Loop

 
ISR_Handler:
Context Save
 If PIR0bits_TMR0IF = 1 Then    'her 100ms de interrupt oluşur
    PIR0bits_TMR0IF = 0
    TMR0H = $F3
    TMR0L = $CB
    Toggle Blink_Led
EndIf

Context Restore 

midali

I have the same troubles with 16F15213 . I'm not able to turn on one led on any pic port .  :'(

okmn

it is work with Mplab X IDE


but i still could not find where is the problem in positron

anyone have idea ?

top204

#5
There seems to be a config fuse value anomaly going on between the compiler's fuse values and the assembler creating the values in the hex file.

On examining the compiler's .ppi file for the newer enhanced 14-bit core deives and matching them to the datasheet, they are correct for the bits set and cleared etc.. Also, the info file for the assembler has the bits correctly set out (complex in their layout, but still correct). So I am investigating further.

tnencon

Quote from: top204 on May 21, 2024, 09:55 AMThere seems to be a config fuse value anomaly going on between the compiler's fuse values and the assembler creating the values in the hex file.

On examining the compiler's .ppi file for the newer enhanced 14-bit core deives and matching them to the datasheet, they are correct for the bits set and cleared etc.. Also, the info file for the assembler has the bits correctly set out (complex in their layout, but still correct). So I am investigating further.

It seems to be the assembler at fault, so I will go through its data files with a fine tooth comb and get back to you when I have the answer. Bloody microchip again, changing what does not need changing!

Hello Les; Although there is LVP_On in the program configuration sets for PIC16F15223, snap gives a warning that LVP is OFF. Is there something that needs to be corrected regarding LVP?

top204

OK. I think I have found the problem.

Microchip changed the format of config data files for the newer enhanced 14-bit core devices, and I had not noticed it. So the .ppi file creator was not inverting the bit pattern bits within a fuse word.

I'll do some more testing and upload a set of PPI files to correct the anomaly with the newer enhanced 14-bit core devices. I just wish microchip would leave things as they are when adding new devices. The new devices are not actually that new, and they are just bastardisations of the original devices, so why the constant change in the data files, or stop creating data files that have been around for a couple of decades for assembler code writers?

It seems that microchip are determined to get every user to use "their" compilers and utterly dreadful IDE, and to hell with the people who got them to be such a large company in the first place! So they hide as much as they can, and change as much as they can to make it difficult for third parties!


top204

I have uploaded a corrections update installer to replace the .ppi files for the effected enhanced 14-bit core devices here:

Positron Corrections Update 4.0.4.2-1.1.1.8

In the PPI file creator program I wrote, I had to change the bit image processing based upon its position within the config fuse word, which is something I never had to do in the past. So the effected Delphi (Pascal) code in it is now:

FuseValue := CSETTING_Value And Not FuseValue;

I've checked the fuses written in a program listing with the fuses in the MPLAB IPE programmer after a compile and they now all match.

okmn

#9
thank you Les  ,
this code ok 
'  /\\\\\\\\\
'  /\\\///////\\\
'  \/\\\    \/\\\                                                /\\\          /\\\
'  \/\\\\\\\\\\\/        /\\\\\    /\\\\\\\\\\    /\\\\\\\\  /\\\\\\\\\\\  /\\\\\\\\\\\  /\\\\\\\\\
'    \/\\\//////\\\      /\\\///\\\  \/\\\//////    /\\\/////\\\ \////\\\////  \////\\\////  \////////\\\
'    \/\\\    \//\\\    /\\\  \//\\\ \/\\\\\\\\\\  /\\\\\\\\\\\    \/\\\        \/\\\        /\\\\\\\\\\
'      \/\\\    \//\\\  \//\\\  /\\\  \////////\\\ \//\\///////      \/\\\ /\\    \/\\\ /\\  /\\\/////\\\
'      \/\\\      \//\\\  \///\\\\\/    /\\\\\\\\\\  \//\\\\\\\\\\    \//\\\\\      \//\\\\\  \//\\\\\\\\/\\
'        \///        \///    \/////    \//////////    \//////////      \/////        \/////    \////////\//
'                                  Let's find out together what makes a PIC Tick!
'
' A code listing template for a PIC16F15223 device operating at 32MHz with its internal oscillator
' Written by Les Johnson for the Positron8 BASIC compiler.
'
    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
'
Main:
    Setup()                                    ' Setup the program and peripherals
ANSELA = 0
ANSELC = 0
TRISA = 0
TRISC = 0
    Do
Toggle PORTC.0
DelayMS 500
Toggle PORTA.2
    Loop
 
'--------------------------------------------------------------------------------------------------
' 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_HI                            ' VDD Internal analog systems are calibrated for operation between VDD = 2.3V - 5.5V

    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_OFF                            ' High Voltage on MCLR/Vpp must be used for programming

    Config5 CP_OFF                              ' User Program Flash Memory code protection is disabled

but i still cold not resolve solutlon of this code with timer 0

if you will have some tips-tricks about using timer0 and (also)adc with these new 16F15223 i can never say no "i dont want help" .

'****************************************************************
'*  Name    : PIC16F15223_FTR10.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
Declare Xtal = 4
OSCCON = $20
OSCEN = $40
OSCFRQ = 2
OSCSTAT = 0
OSCTUNE = 0
Config1 FEXTOSC_OFF,RSTOSC_HFINTOSC_1MHZ,CLKOUTEN_OFF,VDDAR_LO
Config2 MCLRE_EXTMCLR, PWRTS_PWRT_OFF, WDTE_OFF,BOREN_OFF,BORV_LO,PPS1WAY_OFF,STVREN_OFF
Config4  BBSIZE_BB512,BBEN_OFF,SAFEN_OFF,WRTAPP_OFF,WRTB_OFF,WRTC_OFF,WRTSAF_OFF,LVP_ON
Config5 CP_OFF

LATA = 0
LATC = 0

TRISA = $28
TRISC = $1C

ANSELA = 0
ANSELC = $1C

WPUA = $20
WPUC = 0
ODCONA = 0
ODCONC = 0

SLRCONA = $37
SLRCONC = $3F

INLVLA = $3F
INLVLC = $3F

IOCAP = 0
IOCAN = 0
IOCAF = 0
IOCCP = 0
IOCCN = 0
IOCCF = 0
INTCONbits_PEIE = 0
INTCONbits_GIE = 0
PIE0bits_TMR0IE = 0
PIR0bits_TMR0IF = 0
T0CON0bits_T0EN = 0

TMR0H = $CF
TMR0L = $2C
T0CON1 = $41
T0CON0 = $93

On_Hardware_Interrupt GoTo ISR_Handler
    Symbol Blink_Led = PORTC.0
    Symbol Relay_Output = PORTA.2

 
Main:

    Do
       Relay_Output = ~Blink_Led
     
    Loop

 
ISR_Handler:
Context Save
 If PIR0bits_TMR0IF = 1 Then    'her 100ms de interrupt oluşur
    PIR0bits_TMR0IF = 0
    TMR0H = $CF
    TMR0L = $2C
    Toggle Blink_Led
EndIf

Context Restore 

RGV250

Hi,
I have only skimmed the post but for the timer 0 issue. It doesn't look like you have enabled the interrupts?

Bob

WilliGrundmann

Hi,
I just installed
Positron Studio 2 version 2.0.3 build 12
Positron8 BASIC compiler version 4.0.4 build 2
Positron16 BASIC compiler version 1.1.1 build 8
My program consists of

Device = 16F15223
Declare Xtal =32

Clicking the Fuses tab does not provide any config fuse options for the 16F15223 processor. The message "No fuse settings found" message is displayed. The fuse selector works fine for the 16F18323 processor.

Can anyone please point out, what I need to do to get the fuse selector to work for the 16F15223 processor. I am new to the Positron Studio, however have been using the Proton IDE and compiler for over 15 years.

JohnB

I am away from my PC and cannot look in to this until next week. You could try copying the device file in c:\program files(x86)\prontonide\pds\bin\ 8bit_device.info into pds\includes folder. It will overwrite the existing file but should have more up to date info.  I have modified Positron Studio to look in both files now but I am not sure if the version on my Dropbox has that change.
JohnB

okmn

Quote from: RGV250 on May 21, 2024, 09:45 PMHi,
I have only skimmed the post but for the timer 0 issue. It doesn't look like you have enabled the interrupts?

Bob

about timer0 enabled;

T0CON0   bit 7 is 1

$93 =%10010011

RGV250

QuoteT0CON0   bit 7 is 1

That just enables the timer, I think you need to look at
INTCONbits_GIE = 0
PIE0bits_TMR0IE = 0
to set up / enable the interrupt.

Bob


okmn

#15

While writing code, if you copy from another code you wrote, that's "me"!
thank you guys.
the blink is ok. :)


WilliGrundmann

Thanks JohnB,

I found the 8bit_device.info file in the bin8 folder and copied it into the folders you mentioned. The fuse configurator comes up now.

Just noticed that Positron Studio still calls the PrPlus.exe compiler and not with the Pos8.exe or Pos16.exe compiler. Is this correct?


JohnB

Positron Studio calls loader.exe which calls prplus.exe (preprocessor) and then the appropriate compiler exe.
JohnB

okmn

#18
Quote from: okaman on May 22, 2024, 03:08 PMWhile writing code, if you copy from another code you wrote, that's "me"!
thank you guys.
the blink is ok. :)



I realized that I gave incorrect information in the answer here,

It didn't happen with blink timer0!
I still can't blink with timer0 with 15223!!!

I tried it in ccs and I see that it works.
Why couldn't I do it with positron? I still haven't found the reason?
What are your suggestions?

PIC16f15223
osc 32mhz
Led1  500ms blink
Led2  1sn blink both codes


Positron  .bas 

''****************************************************************
''*  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
Main:
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 = $65 'T0CS HFINTOSC; T0CKPS 1:32; T0ASYNC synchronised; =>Prescaler 1:32
 '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 = $13 'T0OUTPS 1:4; T0EN Disabled; T016BIT 16-bit;=>Postscaler 1:4
 '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



CCS Codes  .c

#include <PIC16F15223_TMR0_10ms.h>
  unsigned int8 Ten_Mili_Seconds = 0;
  unsigned int16 Temporary = 0;

#INT_TIMER0
void  TIMER0_isr(void)
{
  set_timer0(0XF63C);//0XFD8F
  Ten_Mili_Seconds++;
  If (Ten_Mili_Seconds == 50) //500ms
      {
        Ten_Mili_Seconds = 0;
        output_toggle(Blink_Led_1);         
      }                                 
}
 
void main()
{
  port_a_pullups(0x00);
  port_c_pullups(0x00);
  setup_timer_0(T0_INTERNAL |T0_INPUT_SYNCRONIZED| T0_DIV_32 |T0_16_BIT|4);//TMR0 10ms T0_HFINTOSC
  set_timer0(0XF63C);//0XFD8F
  enable_interrupts(INT_TIMER0);
  enable_interrupts(GLOBAL);
  while(TRUE)
 
  {
      for (Temporary=1;Temporary<=1000;++Temporary)
            {
              delay_ms(1);
            } 
      output_toggle(Blink_Led_2);

  } 

.h

#include <16F15223.h>
#device ADC=10
#FUSES LVP
#FUSES NOEXTOSC                //External Oscillator not enabled
#FUSES RSTOSC_HFINTRC_32MHZ    //On Power-up clock running from HFINTRC at 32 MHz
#FUSES ANALOGRANGE_LOW          //Internal analog systems are calibrated for operation between Vdd = 1.8V - 3.6V
#FUSES NOBROWNOUT              //No brownout reset
#FUSES WDTWIN_62%              //Watchdog Window is 62.5% of WDT period

#use delay(internal=32MHz)
#use FIXED_IO( A_outputs=PIN_A5,PIN_A4,PIN_A3,PIN_A2,PIN_A1,PIN_A0 )
#use FIXED_IO( C_outputs=PIN_C5,PIN_C4,PIN_C3,PIN_C2,PIN_C1,PIN_C0 )
#define Blink_Led_1  PIN_A2
#define Blink_Led_2  PIN_C0
                             


---CCS code video---

RGV250

Hi,
I do not use 16 series anymore but have you used the brilliant fuse configurator to choose your settings.

Bob