v. PIC18F26J50 32-bit low frequency PWM generator

PIC18F26J50 can generate a low frequency PWM (pulse width modulation) signal with the latest firmware (PIC18F26J50 firmware v2.6.3 - all subversions.zip). PWM is can drive a servo motor with frequencies from less than 1 Hz to more than 2 kHz. The generator is compatible with Velleman K8055 (with PIC18F2xJ50 adapter only) and K8055N experiment boards, as well as it can also be used separately. The low frequency generator can drive one of RB0 through RB7 outputs. However, this does not impair its capability to drive stepper motors, or do signal analysis, because ECCP units and timers are not used for low frequency signal generation. Software example with source code is provided in 32 and 64-bit versions: Multithreading example with LFG (32-bit) based on SVLIB_PIC18F24J50 v3.6.NET4.zip and Multithreading example with LFG (64-bit) based on SVLIB_PIC18F24J50 v3.6.NET4x64.zip from Downloads section.

NOTE: You can as easily and as cheaply build 8-channel low frequency generatior with 32-bit PIC32MX250F128B.

Function LowFreqGenConfiguration(<low phase length> as integer, <high phase length> as integer, <number for RBx output x={0,1,..7}> as byte) as Integer ' Configures the low frequency generator

Function LowFreqGen_Enable() as Integer ' enables and starts the generator

Function LowFreqGen_Disable() as Integer ' stops and disables the generator

Example:

The following new functions were added to SVLIB_PIC18F24J50 library:

Private Sub Button21_Click(sender As System.Object, e As System.EventArgs) Handles Bu_SetLFGen.Click

PIC.LowFreqGenConfiguration(CInt(Tb_LowPhase.Text), CInt(Tb_HighPhase.Text), CInt(Cb_LFGenOutput.Text))

PIC.LowFreqGen_Enable()

End Sub

Private Sub Button22_Click(sender As System.Object, e As System.EventArgs) Handles Button22.Click

PIC.LowFreqGen_Disable()

End Sub