With MCLR disabled, you don't need a pull-up, unless your input requires one for a switch or something.
And on the 16F1 (Enhanced Core) devices, you don't even need a pull-up when enabled. They have an internal pull-up on MCLR.
With MCLR disabled, you don't need a pull-up, unless your input requires one for a switch or something.
And on the 16F1 (Enhanced Core) devices, you don't even need a pull-up when enabled. They have an internal pull-up on MCLR.
DT
Thanks again, Darrel! I remember now reading about the internal pull-up in the data sheet. This is what happens when you start a project and come back to it 6 months later![]()
Hmm. That seemed to work on a simpler project but when I add it to the one I attached above (and which I'm attaching here for you to see) it doesn't help the _MotorRPM problem (motors still spin up to their maximum speed, i.e. MotorRPM >= 255) but what is weird is that it now takes almost 6 seconds for them to start spinning!?!??! I only added a pause of 100.
Nacelle_Motors_16F1825_32Mhz_Int_SN754410.txt
The internal oscillator runs at 500 Khz on power-up, which is 1/64th the 32 Mhz PBP is expecting.
So if you put it before the OSCCON statement, it will be equivelent to PAUSE 6400 or 6.4 seconds.
I'll try it on some real hardware tomorrow.
DT
That solved the 6 sec delay (by moving the 'pause 100' to after the OSCON statement) but it still spins up to max RPM ...
Nacelle_Motors_16F1825_32Mhz_Int_SN754410_Alt_Btn.txt
Ross,
I've run your program here on real hardware and real programmers.
I still cannot duplicate your reported problems.
The EEPROM is initialized correctly on the first run after programming.
The PWM ramps up to 150 dutycycle every time, and never goes to 255.
I'm measuring the dutycycle with an oscilloscope. I do not have motors hooked up.
I've used an melabs U2 programmer.
I've also used a PICkit3 programmer, and single stepped through it.
It always works exactly like it should.
What are your software versions (PBP3 and meProg)?
How are you driving the motors?
Do you have a scope?
DT
Here's what I've observed:
- Just adding the 'pause 100' doesn't seem to change anything
- Adding 'MotorRPM = 127' just before the spin up does work (although negating the use of EEPROM)
- I know the motors are spinning up to their max cycle becuase I have a mechanical rotary encoder which allows me to adjust the RPM; when I turn the knob CW the speed does **not** increase, while turning it CCW does reduce the speed. Also, this rotary encoder has a push button which I've set up to return the motor speed to default - this also works
- If I alter the speed (either by adjust the RPM up or down, or pressing the 'reset' button), the chip remembers this value the next time it's powered up
- If I grab a brand new chip, never previously programmed, it works straight away
I don't have a scope, Darrel - I wish I didHopefully the above is helpful. Here are my version details:
- OS: Windows 7 (running on a VM on my MacBook Pro)
- MicroCode Studio Plus: 5.0.0.3
- PicBasic Pro compiler: PBPX 3.0.6.4
- meLabs Programmer: v4.50 (with the U2 programmer)
Here are the two .pbp files (the only difference being the addition of the 'MotorRPM = 127'):
Nacelle_Motors_16F1825_32Mhz_Int_SN754410_2.txtNacelle_Motors_16F1825_32Mhz_Int_SN754410.txt
I've shared my .hex & .asm files here.
Here's my schematic. I'm using a SN754110 to drive the motors:
TOS_E_Rev2.pdf
Last edited by RossWaddell; - 24th October 2012 at 00:31.
Bookmarks