My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
.I try to keep my development code as close to final as possible, cause I know I'll forget to change stuff back. At least this way I can fire and forget the pin initialization
grounding unused pins and setting them as outputs is pointless , useless and potentially catastrophic
just leaving them as analog is ten times easier and can never do any harm, setting them as input with wpu on is also ok and can never do any harm
if the device is not battery powered its not worth any sort of effort
Last edited by richard; - 4th March 2025 at 04:39.
Warning I'm not a teacher
- digital input,
- weak pull-up ON,
- pin not connected.
I try to stay away from analog settings; no idea why. Maybe cause I started using only digital way back when.
https://skills.microchip.com/introdu...tecture/691929
Unit will always be powered by wall adapter, or possibly USB; but never battery..
Last edited by Demon; - 4th March 2025 at 21:53.
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
According to this:
https://skills.microchip.com/introdu...tecture/691929
The pull-up is disabled automatically when either TRIS is set to an output or the pin is set as an analog input. These changes to TRIS and ANSEL will override WPU settings.
I can just set all pull-ups ON, leave the unused pins unconnected and forget about them. Then use the others as I wish in ANSEL and TRIS.
The only times I need to be concerned with WPU is on pins that must not be disturbed for whatever special reason.
Code:WPUA = %11111111 '----------------------------------------------------------------' WPUB = %11111111 ' ALWAYS SET WEAK PULL-UPS ON ALL PINS FIRST ' WPUC = %11111111 '----------------------------------------------------------------' ' CHANGES TO ANSEL AND TRIS WILL OVERRIDE AS REQUIRED ' '----------------------------------------------------------------' ANSELA = %00000010 ' Pin A3 = SW input not implemented yet ' Pin A2 = ADC (B5K) not implemented yet ' Pin A1 = ADC (B5K) ' Pin A0 = ADC (voltage divider) not implemented yet ANSELB = %00000000 ANSELC = %00000000 TRISA = %00000010 ' Pin A3 = SW input not implemented yet ' Pin A2 = ADC input 2 not implemented yet ' Pin A1 = ADC input 1 ' Pin A0 = ADC input 0 not implemented yet TRISB = %00000000 ' Pin B7 = ...not available, ICSPDAT ' Pin B6 = ...not available, ICSPCLK TRISC = %11000000 ' Pin C7 = RX *** Datasheet requirement, INPUT *** ' Pin C6 = TX *** Datasheet requirement, INPUT ***
EDIT: I can even leave PORT at the top in case a pin is left as analog output.
Code:PORTA = %00000000 '-------------------------------------------' PORTB = %00000000 ' ALWAYS SET PINS LOW FIRST ' PORTC = %00000000 '-------------------------------------------'
Or did I miss something important...?![]()
Last edited by Demon; - 4th March 2025 at 22:29.
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
it looks to me that you are creating problems and complications trying to solve a problem that does not exist.
generic pin control solutions will never work for all chips, there are too many chip variations.
pic pins to date always default to inputs, analog if possible. leave them that way unless you need one to be different.
each and every pin you employ needs to configured to suit its usage
mcc makes it easy
![]()
Warning I'm not a teacher
My memory is getting worse by the year. That's why I try ways to set my code so it's easy to copy and modify for future modules. Of course it rarely works.
Having WPUA.1 = 1 caused leakage to VSS; it wasn't completely 0; varying in the 1.1mV range. My ADC reading never reached 0.
I took out the Port = 0 settings, set WPU properly instead of leaving ANSEL/TRIS override it, and now my ADC reading varies from 0 to 1.
Code:WPUA = %11111101 '----------------------------------------------------------------' WPUB = %11111111 ' ALWAYS SET WEAK PULL-UPS ON ALL PINS FIRST ' WPUC = %11111111 '----------------------------------------------------------------' ' CHANGES TO ANSEL AND TRIS WILL OVERRIDE AS REQUIRED ' '----------------------------------------------------------------' ANSELA = %00000010 ' Pin A3 = SW input not implemented yet ' Pin A2 = ADC (B5K) not implemented yet ' Pin A1 = ADC (B5K) ' Pin A0 = ADC (voltage divider) not implemented yet ANSELB = %00000000 ANSELC = %00000000 TRISA = %00000010 ' Pin A3 = SW input not implemented yet ' Pin A2 = ADC input 2 not implemented yet ' Pin A1 = ADC input 1 ' Pin A0 = ADC input 0 not implemented yet TRISB = %00000000 ' Pin B7 = ...not available, ICSPDAT ' Pin B6 = ...not available, ICSPCLK TRISC = %11000000 ' Pin C7 = RX *** Datasheet requirement, INPUT *** ' Pin C6 = TX *** Datasheet requirement, INPUT ***
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
Yeah, FVR gave me a dead spot at the high end. These pots already have a slight deadzone at both ends, so FVR made it much more apparent.
Has light jitter with this pot.Code:adcin 1, ADCreading ADCinput = ADCreading >> 1
Works, but if I get a pot that's slightly "less good", I'll get jitters.Code:adcin 1, ADCreading ADCinput = ADCreading >> 2
I can work with >> 3, that still gives me 128 positions. That<S plenty of increments for a manual control, and I can always multiply by 4 when the flight sim absolutely wants 1024.
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
it happens to us all , especially if you don't use the knowledge regularly. that why i participate in the forum to keep my "practice" hours up.My memory is getting worse by the year. That's why I try ways to set my code so it's easy to copy and modify for future modules. Of course it rarely works.
the problem here is copying errors forward and propagating ancient pic myths. setting each pin as you employ it to make it work as you want it to is not difficult. imo it is actually easier and less prone to error.
using mcc documents it all for you and consolidates all pin setting into one file, it could not be easier
Warning I'm not a teacher
Bookmarks