News:

Let's find out together what makes a PIC Tick!

Main Menu

Fuse Configurator by JohnB

Started by TimB, Feb 02, 2021, 04:56 PM

Previous topic - Next topic

TimB


An invaluable tool to set fuses, Should be ver 2.


Tim

top204

An excellent tool from a true gentleman... JohnB.


RayEllam

Just what I'm looking for. Many thanks JohnB

gtvpic

Thank you very much for this great contribution. :)
it's a great tool for me
Thanks

Yasin

It's very practical. Thanks a lot.

SeanG_65

How do I add this to the positron IDE please? I've tried everything I can think of. It's fine in Proton.

rick.curl

Hi Sean-
It's already there.  Look below the active code window.  There are several tabs "Code", "Fuses", "Assembler", and "Hex file".  Just click on "fuses".

John really did a great job to make this easy for us!

-Rick

GaryC

It is easy and works great, would not be with out it.

Gary

SeanG_65

#8
GORDON BENNETT!! Just how stupid can I get (don't answer that).

I do so little electronics and coding these days  :'( . Most of my speciality is ultra low noise analogue (sonar and passive listening devices).Thanks Rick

Tried it but I get an Access Violation error. Will try re-installing Positron

SeanG_65

Back to using this again and with the SAME problem, VERY frustrating.


Stephen Moss

@SeanG_65 it looks like this thread was originally created with regard to the plug-in version for the original Mechnaique IDE.
 
If you are having an issue with the version included in Positron Studio IDE then I would suggest posting it somewhere here as it is more likely John will notice it and look into it if posted there.

JohnB

@SeanG_65 I haven't been maintaining the Fuse Configurator plugin for some years now as it has been migrated to Positron Studio.  Does this access violation occur in Positron Studio and if so does it occur with all devices or one specific device or family?

If its a Positron Studio issue I will look into it if you can give me specific details, the access violation is so general that it does not give me much to go on.  If its specific devices or source files, please give details so I can repeat the issue hear.

 
JohnB

SeanG_65

Hi John, PLEASE don't think I'm knocking your IDE, far from it, I LOVE it!

I'm using Les' code for PWM on a 12F1571 (it's nothing like ready to test for my application yet) but heres what I want to do;

Read A0-A3 then, depending on the binary value, set the duty of a PWM signal to a specific value and drive the backlight on an LCD. It's an update to a metal detector which was a big seller back in the day but the manufacturer closed so there are no repairs available and the displays keep failing.

'
'   /\\\\\\\\\
'  /\\\///////\\\
'  \/\\\     \/\\\                                                 /\\\          /\\\
'   \/\\\\\\\\\\\/        /\\\\\     /\\\\\\\\\\     /\\\\\\\\   /\\\\\\\\\\\  /\\\\\\\\\\\  /\\\\\\\\\
'    \/\\\//////\\\      /\\\///\\\  \/\\\//////    /\\\/////\\\ \////\\\////  \////\\\////  \////////\\\
'     \/\\\    \//\\\    /\\\  \//\\\ \/\\\\\\\\\\  /\\\\\\\\\\\     \/\\\         \/\\\        /\\\\\\\\\\
'      \/\\\     \//\\\  \//\\\  /\\\  \////////\\\ \//\\///////      \/\\\ /\\     \/\\\ /\\   /\\\/////\\\
'       \/\\\      \//\\\  \///\\\\\/    /\\\\\\\\\\  \//\\\\\\\\\\    \//\\\\\      \//\\\\\   \//\\\\\\\\/\\
'        \///        \///     \/////     \//////////    \//////////      \/////        \/////     \////////\//
'                                  Let's find out together what makes a PIC Tick!
'
' Experimental procedures for 16-bit PWM1 on a PIC12F1571 device
' Written by Les Johnson for the Positron8 BASIC compiler.
'
    Device = 12F1571                                ' Tell the compiler what device to compile for
    Declare Xtal = 16                               ' Tell the compiler what frequency the device will be operating at (in MHz)
'
' Create some defines for the PWM1 peripheral
'
$define PWM1_Start() PWM1CONbits_EN = 1             ' Start the PWM1 peripheral
$define PWM1_Stop() PWM1CONbits_EN = 0              ' Stop the PWM1 peripheral
$define PWM1_LoadBuffer() PWM1LDCONbits_LDA = 1     ' Load the phase of the PWM1 peripheral
'
' Create a variable to act as a parameter alias, to save RAM
'
    Dim PWM_wParam As Word

'----------------------------------------------------------------------------

     symbol P1SEL APFCON.0                           ' Use PORTA.5 as PWM1
     set p1sel
'----------------------------------------------------------------------------

' The main program starts here
'
Main:
    IntOsc_16MHz()                                  ' Set the device to use the internal oscillator at 16MHz

   PWM1_Init()

     pwm1_duty ($0300)

'----------------------------------------------------------
' Initialise the PWM1 peripheral
' Input     : None
' Output    : None
' Notes     : None
'
Proc PWM1_Init()
    PWM1INTE = $00
    PWM1INTF = $00
    PWM1CLKCON = $00            ' No_Prescalar
    PWM1LDCON = $00
    PWM1OFCON = $00
    PWM1PHL = $00               ' \
    PWM1PHH = $00               ' / Phase SFRs
    PWM1DCL = $E0               ' \
    PWM1DCH = $03               ' / Duty SFRs
    PWM1PRL = $CF               ' \
    PWM1PRH = $07               ' / Period SFRs
    PWM1OFL = $6D               ' \
    PWM1OFH = $6D               ' / Offset SFRs
    PWM1TMRH = $00              ' \
    PWM1TMRL = $00              ' / PWM Timer SFRs
    PWM1CON = 0b01000000        ' Setup for an active high, standard PWM
    PWMENbits_PWM1EN_A = 1
    PWMLDbits_PWM1LDA_A = 1
    PWMOUTbits_PWM1OUT_A = 0
    PinOutput PORTA.5           ' Make the PWM1 pin an output
EndProc

'----------------------------------------------------------
' Alter the phase of the PWM1 peripheral
' Input     : pPhase holds the 16-bit phase value
' Output    : None
' Notes     : None
'
Proc PWM1_Phase(pPhase As PWM_wParam)
    PWM1PHH = pPhase.Byte1
    PWM1PHL = pPhase.Byte0
EndProc

'----------------------------------------------------------
' Alter the duty of the PWM1 peripheral
' Input     : pDuty holds the 16-bit duty value
' Output    : None
' Notes     : None
'
Proc PWM1_Duty(pDuty As PWM_wParam)
    PWM1DCH = pDuty.Byte1
    PWM1DCL = pDuty.Byte0
EndProc

'----------------------------------------------------------
' Alter the period of the PWM1 peripheral
' Input     : pPeriod holds the 16-bit period value
' Output    : None
' Notes     : None
'
Proc PWM1_Period(pPeriod As PWM_wParam)
    PWM1PRH = pPeriod.Byte1
    PWM1PRL = pPeriod.Byte0
EndProc

'----------------------------------------------------------
' Alter the offset of the PWM1 peripheral
' Input     : pPeriod holds the 16-bit offset value
' Output    : None
' Notes     : None
'
Proc PWM1_Offset(pOffset As PWM_wParam)
    PWM1OFH = pOffset.Byte1
    PWM1OFL = pOffset.Byte0
EndProc

'----------------------------------------------------------
' Setup the internal oscillator to operate at 16MHz
' Input     : None
' Output    : None
' Notes     : None
'
Proc IntOsc_16MHz()
    OSCCON = 0b01111010   ' Setup for INTOSC, SPLLEN disabled, and 16MHz HF operation
    OSCTUNE = $00
    BORCON = $00
EndProc

'----------------------------------------------------------------------------
' Set the fuses for an internal oscillator on a PIC12F1571 device
'
    Config1 FOSC_INTOSC, WDTE_OFF, PWRTE_OFF, MCLRE_OFF, CP_OFF, BOREN_OFF, CLKOUTEN_OFF
    Config2 PLLEN_OFF, LVP_OFF, BORV_LO, WRT_OFF, STVREN_OFF, LPBOREN_OFF

if I start from scratch, I get the access violation, but if I delete the fuse settings in the above code, and try to put new ones in, I get this;

"pn1FusesHolder".

If I select a "demo" piece of code, I can change anything I want so it looks like it's just certain PIC's

JohnB

@SeanG_65 I am away until the new year, I get back to you after the NY celebrations are over.
JohnB

JonW

I get this occasionally, I just manually change the config settings.

JohnB

@SeanG_65
I have tried to repeat your problem on my system here and I cannot get it to error. 

I noticed when pasting the text into a newly created source page (File, New, Source) the device wasn't automatically picked up and I had to edit the Device Line (e.g. insert/delete a space) to get the device to be recognised (i.e. Change colour and appear in the code explorer).  I will look in to correcting this issue. 

While the device was unrecognised the Fuses Tab was essentially blank with No Fuses found message. As soon as I had made the edit on the device line all the FSRs became coloured and the fuses tab was populated with the fuse settings as per the document.

When I changed the fuse settings and updated them in the document the fuse configurator did not line detect the location of the existing fuses and overwrite them but inserted a new set at the cursor position.  This is wrong and I need to improve the code which locates existing fuse settings not created by fuse configurator.

I never got an access violation.

I did these tests with the 64 bit version of Positron Studio version 2.0.3 build 13 on a Windows 11 machine.  unless you can give me more details on your set up there is not much more I can do to help.
JohnB

SeanG_65

It MIGHT be my setup. I occasionally get an access violation when viewing the manuals and scrolling down too fast (grab slider bar and let rip).

I can live with the issues, now I know the work arounds. The problem is, I do so little design work and coding these days (so little of anything in reality) I only see issues once every blue moon.