Page 1 of 1
Does OnFwd use regulation
Posted: 03 Oct 2010, 23:31
by gloomyandy
Quick NXC question... When you use OnFwd in NXC will the resultant motor output be using any form of speed regulation or does it simply set a power level for the motor? I had a quick look at the doc, but the answer wasn't obvious (to me at least)...
Re: Does OnFwd use regulation
Posted: 04 Oct 2010, 01:47
by afanofosc
OnFwd winds up generating this code:
Code: Select all
setout _ports, Power, _pwr, OutputMode, OUT_MODE_MOTORON+OUT_MODE_BRAKE, RegMode, OUT_REGMODE_IDLE, RunState, OUT_RUNSTATE_RUNNING, TurnRatio, 0, TachoLimit, 0, RegPValue, _p, RegIValue, _i, RegDValue, _d, UpdateFlags, UF_UPDATE_TACHO_LIMIT+UF_UPDATE_MODE+UF_UPDATE_SPEED+UF_UPDATE_PID_VALUES+_reset
Based on this I would say that it is without regulation (OUT_REGMODE_IDLE).
John Hansen
Re: Does OnFwd use regulation
Posted: 04 Oct 2010, 01:54
by mattallen37
No PID, just a PWM speed control.
Edit: sorry, John already said that.
Re: Does OnFwd use regulation
Posted: 04 Oct 2010, 22:24
by gloomyandy
Thanks, I thought that was probably the case (I was looking at some nxc code and trying to work out what it did), but wasn't 100% sure...
Andy