Good Evening all
I hope all are all in good health
You will have to excuse me for being somewhat possibly non understanding of how this all works as yet I'm still testing this rigorously and getting used to this
Previously my own error and having found out it was I that made mistake on last query , now corrected and solved, I decided to still check all functionality having got that all working thus far
How ever reset doesn't seem to work or perhaps me again who knows the previous had me pulling my hair out for hours The importance of naming folders differently with one letter difference I have thus learnt
Never mind , moving on and forward I have double checked , treble checked recompiled and recorded this for you
Any ideas appreciated
Many thanks mark
I embed two sections of code
With MCLRE set to on
With MCLRE set to off
Please could you view the mp4 desktop recording at this address
*** NB when you load this initially you will see it seems very bad recording but Ive found that if you play this 3/4 of the way then refresh the link with settings set to auto then quality is far far better and renders as it should ***
Dont ask me why this is so I dont know why
Mpeg 4 showing this issue
Please also see attached
In case simul file not attached here is the simul mark up code in raw format
I hope all are all in good health
You will have to excuse me for being somewhat possibly non understanding of how this all works as yet I'm still testing this rigorously and getting used to this
Previously my own error and having found out it was I that made mistake on last query , now corrected and solved, I decided to still check all functionality having got that all working thus far
How ever reset doesn't seem to work or perhaps me again who knows the previous had me pulling my hair out for hours The importance of naming folders differently with one letter difference I have thus learnt
Never mind , moving on and forward I have double checked , treble checked recompiled and recorded this for you
Any ideas appreciated
Many thanks mark
I embed two sections of code
With MCLRE set to on
- Code:
/*
* File: main.c
* Author: mark david harrington
*
* Created changed 12 October 2020, 13:37
*/
// PIC12F675 Configuration Bit Settings
// 'C' source line config statements
// CONFIG
#pragma config FOSC = INTRCIO // Oscillator Selection bits (INTOSC oscillator: I/O function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN)
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF // Power-Up Timer Enable bit (PWRT disabled)
#pragma config MCLRE = ON // GP3/MCLR pin function select (GP3/MCLR pin function is MCLR)
#pragma config BOREN = OFF // Brown-out Detect Enable bit (BOD disabled)
#pragma config CP = OFF // Code Protection bit (Program Memory code protection is disabled)
#pragma config CPD = OFF // Data Code Protection bit (Data memory code protection is disabled)
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#include <xc.h>
// lets recompile
#define _XTAL_FREQ 4000000
#define LED GPIObits.GP5// this is where I define the port for output
// I dont have to do anything more at this stage gpio4 should now be output and flash led */
// I recompile
void InitPic (void);
void main(void)
{
/* PICMicro initialization */
InitPic();
// Here is the 5 second delay before this starts so at reset we should see
// led stop flashing with another 5 second delay before starting but we dont
// In fact this should not work
__delay_ms(5000) ;
/* Never ending cycle...*/
while(1)
{
/*led is defined as above LED GPIObits.GP5 Now I will change this above */
LED^=1; /* LED alternate ON and OFF / invert this value when looping */
__delay_ms(200); /* delay macro (200ms) simple delay */
}
}
void InitPic (void)
{
/* I/O port configuration */
GPIO = 0x00; // clear port down
#ifdef _PIC12F675_H_
CMCON = 0x07; /* Disable comparators Correct */
#endif
ANSEL = 0x00; /* Disable A/D module Correct */
TRISIO = 0x00; /* All output is set as OUTPUT also Correct */
WPU = 0; /* Disable all internal pull-ups Correct again */
OPTION_REG = 0x80; /* Disable internal pull-ups global */
/*Option_REG is ad follows GPPU: GPIO Pull-up
* Enable bit1 = GPIO pull-ups are disabled 0
* = GPIO pull-ups are enabled by individual port latch values */
}
With MCLRE set to off
- Code:
/*
* File: main.c
* Author: mark david harrington
*
* Created changed 12 October 2020, 13:37
*/
// PIC12F675 Configuration Bit Settings
// 'C' source line config statements
// CONFIG
#pragma config FOSC = INTRCIO // Oscillator Selection bits (INTOSC oscillator: I/O function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN)
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF // Power-Up Timer Enable bit (PWRT disabled)
#pragma config MCLRE = OFF // GP3/MCLR intrenally tied to VDD
#pragma config BOREN = OFF // Brown-out Detect Enable bit (BOD disabled)
#pragma config CP = OFF // Code Protection bit (Program Memory code protection is disabled)
#pragma config CPD = OFF // Data Code Protection bit (Data memory code protection is disabled)
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#include <xc.h>
// lets recompile
#define _XTAL_FREQ 4000000
#define LED GPIObits.GP5// this is where I define the port for output
// I dont have to do anything more at this stage gpio4 should now be output and flash led */
// I recompile
void InitPic (void);
void main(void)
{
/* PICMicro initialization */
InitPic();
// Here is the 5 second delay before this starts so at reset we should see
// led stop flashing with another 5 second delay before starting but we dont
// In fact this should not work
__delay_ms(5000) ;
/* Never ending cycle...*/
while(1)
{
/*led is defined as above LED GPIObits.GP5 Now I will change this above */
LED^=1; /* LED alternate ON and OFF / invert this value when looping */
__delay_ms(200); /* delay macro (200ms) simple delay */
}
}
void InitPic (void)
{
/* I/O port configuration */
GPIO = 0x00; // clear port down
#ifdef _PIC12F675_H_
CMCON = 0x07; /* Disable comparators Correct */
#endif
ANSEL = 0x00; /* Disable A/D module Correct */
TRISIO = 0x00; /* All output is set as OUTPUT also Correct */
WPU = 0; /* Disable all internal pull-ups Correct again */
OPTION_REG = 0x80; /* Disable internal pull-ups global */
/*Option_REG is ad follows GPPU: GPIO Pull-up
* Enable bit1 = GPIO pull-ups are disabled 0
* = GPIO pull-ups are enabled by individual port latch values */
}
Please could you view the mp4 desktop recording at this address
*** NB when you load this initially you will see it seems very bad recording but Ive found that if you play this 3/4 of the way then refresh the link with settings set to auto then quality is far far better and renders as it should ***
Dont ask me why this is so I dont know why
Mpeg 4 showing this issue
Please also see attached
In case simul file not attached here is the simul mark up code in raw format
- Code:
<circuit speed="1000000" noLinAcc="5" animate="0" type="simulide_0.4" reactStep="50">
Resistor-15:
<item valLabRot="0" id="Resistor-2" labely="-20" valLabely="21" objectName="Resistor-15" Unit=" Ω" x="-408" itemtype="Resistor" labelrot="0" valLabelx="-11" hflip="1" labelx="-12" Show_id="false" y="-148" rotation="0" Show_res="true" Resistance="470" vflip="1"/>
Led-14:
<item valLabRot="0" id="Led-3" labely="-24" valLabely="0" objectName="Led-14" x="-436" itemtype="Led" MaxCurrent="0.025" labelrot="0" valLabelx="0" hflip="1" labelx="-16" Show_id="false" y="-112" rotation="90" Resistance="0.6" Grounded="false" vflip="1" Color="0" Threshold="2.2"/>
Ground-13:
<item hflip="1" labelx="-16" Show_id="false" rotation="0" x="-436" itemtype="Ground" valLabelx="0" y="-52" vflip="1" id="Ground-6" objectName="Ground-13" valLabely="0" labelrot="0" valLabRot="0" labely="8"/>
Resistor-12:
<item valLabRot="0" id="Resistor-9" labely="-20" valLabely="6" objectName="Resistor-12" Unit=" kΩ" x="-396" itemtype="Resistor" labelrot="0" valLabelx="-16" hflip="1" labelx="-12" Show_id="false" y="-36" rotation="0" Show_res="true" Resistance="10" vflip="1"/>
Fixed Voltage-11:
<item valLabRot="0" id="Fixed Voltage-11" labely="-24" valLabely="8" objectName="Fixed Voltage-11" Unit=" V" x="-524" itemtype="Fixed Voltage" Voltage="5" labelrot="0" valLabelx="-16" hflip="1" labelx="-64" Show_id="false" y="-36" rotation="0" vflip="1" Show_Volt="true"/>
pic12f675-10:
<item valLabRot="0" Program="../../../MPLABXProjects/TestLED.X/dist/default/production/TestLED.X.production.hex" id="pic12f675-21" labely="-20" Logic_Symbol="false" valLabely="0" objectName="pic12f675-10" x="-348" itemtype="PIC" labelrot="0" valLabelx="0" hflip="1" labelx="0" Show_id="true" y="-164" rotation="0" vflip="1" Mhz="4" eeprom="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" Auto_Load="false"/>
Voltimeter-9:
<item hflip="1" labelx="-24" Show_id="false" rotation="0" x="-572" itemtype="Voltimeter" valLabelx="0" y="-108" vflip="1" id="Voltimeter-43" objectName="Voltimeter-9" valLabely="0" labelrot="0" valLabRot="0" labely="-40"/>
Node-8:
<item hflip="1" labelx="-16" Show_id="false" rotation="0" x="-436" itemtype="Node" valLabelx="0" y="-80" vflip="1" id="Node-51" objectName="Node-8" valLabely="0" labelrot="0" valLabRot="0" labely="-24"/>
Node-7:
<item hflip="1" labelx="-16" Show_id="false" rotation="0" x="-364" itemtype="Node" valLabelx="0" y="-104" vflip="1" id="Node-57" objectName="Node-7" valLabely="0" labelrot="0" valLabRot="0" labely="-24"/>
TextComponent-6:
<item valLabRot="0" Margin="5" id="TextComponent-59" labely="-24" valLabely="0" objectName="TextComponent-6" Font="Helvetica [Cronyx]" Fixed_Width="true" x="-492" itemtype="TextComponent" Text="Reset cpu switch" labelrot="0" valLabelx="0" hflip="1" labelx="-16" Opacity="1" Show_id="false" y="-8" rotation="0" Font_Size="10" vflip="1" Border="1"/>
TextComponent-5:
<item valLabRot="0" Margin="5" id="TextComponent-73" labely="-24" valLabely="0" objectName="TextComponent-5" Font="Helvetica [Cronyx]" Fixed_Width="false" x="-608" itemtype="TextComponent" Text="I think could be another issue with
MCLRE Line and not with my own mistake as
Per reply If I set MCLRE in config to
On I should reset cpu Strictly this should
not work at all unless I tie gpio.3 to supply
Rail so here is the delay before mian loop in code" labelrot="0" valLabelx="0" hflip="1" labelx="-16" Opacity="1" Show_id="false" y="-288" rotation="0" Font_Size="10" vflip="1" Border="1"/>
Push-4:
<item valLabRot="0" id="Push-74" labely="-24" Norm_Close="false" valLabely="0" objectName="Push-4" x="-376" itemtype="Push" labelrot="0" valLabelx="0" hflip="1" labelx="-16" Show_id="false" y="44" rotation="0" Poles="1" Key="" vflip="1"/>
Node-3:
<item hflip="1" labelx="-16" Show_id="false" rotation="0" x="-404" itemtype="Node" valLabelx="0" y="24" vflip="1" id="Node-76" objectName="Node-3" valLabely="0" labelrot="0" valLabRot="0" labely="-24"/>
Ground-2:
<item hflip="1" labelx="-16" Show_id="false" rotation="0" x="-348" itemtype="Ground" valLabelx="0" y="80" vflip="1" id="Ground-79" objectName="Ground-2" valLabely="0" labelrot="0" valLabRot="0" labely="8"/>
TextComponent-1:
<item valLabRot="0" Margin="5" id="TextComponent-82" labely="-24" valLabely="0" objectName="TextComponent-1" Font="Helvetica [Cronyx]" Fixed_Width="false" x="-564" itemtype="TextComponent" Text="No reset ?? Mmmm
Any ideas on this one" labelrot="0" valLabelx="0" hflip="1" labelx="-16" Opacity="1" Show_id="false" y="44" rotation="0" Font_Size="10" vflip="1" Border="1"/>
Connector-16:
<item startpinid="Led-14-lPin" valLabRot="0" id="Connector-4" labely="-24" valLabely="0" objectName="Connector-16" endpinid="Resistor-15-lPin" x="-436" itemtype="Connector" labelrot="0" pointList="-436,-128,-436,-148,-424,-148" valLabelx="0" hflip="1" labelx="-16" Show_id="false" y="-128" rotation="0" enodeid="Circ_eNode-17" vflip="1"/>
Connector-18:
<item startpinid="Resistor-15-rPin" valLabRot="0" id="Connector-30" labely="-24" valLabely="0" objectName="Connector-18" endpinid="pic12f675-10-GP5" x="-392" itemtype="Connector" labelrot="0" pointList="-392,-148,-356,-148" valLabelx="0" hflip="1" labelx="-16" Show_id="false" y="-148" rotation="0" enodeid="Circ_eNode-19" vflip="1"/>
Connector-20:
<item startpinid="Resistor-12-rPin" valLabRot="0" id="Connector-24" labely="-24" valLabely="0" objectName="Connector-20" endpinid="Node-7-0" x="-380" itemtype="Connector" labelrot="0" pointList="-380,-36,-364,-36,-364,-104" valLabelx="0" hflip="1" labelx="-16" Show_id="false" y="-36" rotation="0" enodeid="enode-28" vflip="1"/>
Connector-22:
<item startpinid="Led-14-rPin" valLabRot="0" id="Connector-7" labely="-24" valLabely="0" objectName="Connector-22" endpinid="Node-8-0" x="-436" itemtype="Connector" labelrot="0" pointList="-436,-96,-436,-80" valLabelx="0" hflip="1" labelx="-16" Show_id="false" y="-96" rotation="0" enodeid="Circ_eNode-23" vflip="1"/>
Connector-24:
<item startpinid="Voltimeter-9-rPin" valLabRot="0" id="Connector-50" labely="-24" valLabely="0" objectName="Connector-24" endpinid="Node-8-1" x="-564" itemtype="Connector" labelrot="0" pointList="-564,-92,-564,-80,-436,-80" valLabelx="0" hflip="1" labelx="-16" Show_id="false" y="-92" rotation="0" enodeid="Circ_eNode-23" vflip="1"/>
Connector-25:
<item startpinid="Node-8-2" valLabRot="0" id="Connector-52" labely="-24" valLabely="0" objectName="Connector-25" endpinid="Ground-13-Gnd" x="-436" itemtype="Connector" labelrot="0" pointList="-436,-80,-436,-68" valLabelx="0" hflip="1" labelx="-16" Show_id="false" y="-80" rotation="0" enodeid="Circ_eNode-23" vflip="1"/>
Connector-26:
<item startpinid="Node-7-2" valLabRot="0" id="Connector-58" labely="-24" valLabely="0" objectName="Connector-26" endpinid="pic12f675-10-GP3" x="-364" itemtype="Connector" labelrot="0" pointList="-364,-104,-364,-132,-356,-132" valLabelx="0" hflip="1" labelx="-16" Show_id="false" y="-104" rotation="0" enodeid="enode-28" vflip="1"/>
Connector-27:
<item startpinid="Push-4-pinP0" valLabRot="0" id="Connector-75" labely="-24" valLabely="0" objectName="Connector-27" endpinid="Node-3-1" x="-392" itemtype="Connector" labelrot="0" pointList="-392,44,-404,44,-404,24" valLabelx="0" hflip="1" labelx="-16" Show_id="false" y="44" rotation="0" enodeid="enode-28" vflip="1"/>
Connector-29:
<item startpinid="Push-4-switch0pinN" valLabRot="0" id="Connector-80" labely="-24" valLabely="0" objectName="Connector-29" endpinid="Ground-2-Gnd" x="-360" itemtype="Connector" labelrot="0" pointList="-360,44,-348,44,-348,64" valLabelx="0" hflip="1" labelx="-16" Show_id="false" y="44" rotation="0" enodeid="Circ_eNode-30" vflip="1"/>
Connector-31:
<item startpinid="Fixed Voltage-11-outnod" valLabRot="0" id="Connector-81" labely="-24" valLabely="0" objectName="Connector-31" endpinid="Resistor-12-lPin" x="-508" itemtype="Connector" labelrot="0" pointList="-508,-36,-412,-36" valLabelx="0" hflip="1" labelx="-16" Show_id="false" y="-36" rotation="0" enodeid="Circ_eNode-32" vflip="1"/>
Connector-33:
<item startpinid="Voltimeter-9-lPin" valLabRot="0" id="Connector-56" labely="-24" valLabely="0" objectName="Connector-33" endpinid="Node-3-0" x="-580" itemtype="Connector" labelrot="0" pointList="-580,-92,-580,24,-404,24" valLabelx="0" hflip="1" labelx="-16" Show_id="false" y="-92" rotation="0" enodeid="enode-28" vflip="1"/>
Connector-28:
<item startpinid="Node-3-2" valLabRot="0" id="Connector-28" labely="-24" valLabely="0" objectName="Connector-28" endpinid="Node-7-1" x="-404" itemtype="Connector" labelrot="0" pointList="-404,24,-340,24,-340,-104,-364,-104" valLabelx="0" hflip="1" labelx="-16" Show_id="false" y="24" rotation="0" enodeid="enode-28" vflip="1"/>
PlotterWidget-34:
<item sizePolicy="" tabletTracking="false" frameGeometry="" y="0" baseSize="" maximumSize="" childrenRect="" MaxVolt="500" accessibleDescription="" mouseTracking="false" size="" updatesEnabled="true" sizeHint="" whatsThis="" rect="" windowFilePath="" focus="false" minimumHeight="200" sizeIncrement="" Tracks="1" font="Noto Sans,10,-1,5,50,0,0,0,0,0,Regular" geometry="" focusPolicy="0" fullScreen="false" x="0" maximized="false" inputMethodHints="0" minimumWidth="200" maximumHeight="200" toolTip="" childrenRegion="" accessibleName="" styleSheet="" minimized="false" contextMenuPolicy="1" minimumSizeHint="" windowTitle="" windowOpacity="1" frameSize="" maximumWidth="1000" isActiveWindow="true" autoFillBackground="false" visible="false" cursor="" statusTip="" windowModality="0" itemtype="Plotter" windowModified="false" toolTipDuration="-1" MinVolt="-500" minimumSize="" windowIcon="" layoutDirection="0" modal="false" palette="" width="200" height="200" locale="" objectName="PlotterWidget-34" pos="" acceptDrops="false" enabled="true" normalGeometry="" windowIconText="" Scale="1"/>
</circuit>
Last edited by MD Harrington on Tue Oct 13, 2020 12:22 am; edited 1 time in total (Reason for editing : Additional Instructions)