The usual techniques for implementing current control for hard switched inverters usually involve PI control or hysteresis based control. PI strategies suffer from poor transient performance, and the latter requires complex analog circuitry to give a constant switching frequency. This paper describes a new current control algorithm suitable for implementation in software or digital hardware. A novel feature of the algorithm is that it is able to identify the required machine parameters online. Furthermore there is no tuning of control parameters required from the user. The algorithm output is the switching times for the inverter switches. Comprehensive simulation results are presented, and issues related to hardware digital implementation are presented