| Swordfish Library - PWM2 |
|
|
| Saturday, 04 April 2009 09:18 | |
|
Download the library: PWM2.bas
Other programs that use this library:
Variable Frequency PWM Example
Device = 18F2550 Clock = 48 ' set up config for 8MHz crystal and USB Config USBDIV = 2 Config CPUDIV = OSC1_PLL2 Config PLLDIV = 2 Config FOSC = HSPLL_HS Include "pwm2.bas" Include "adc.bas" Dim adc0,adc1 As Word Dim tt As Byte TRISA = 15 TRISB = 1 tt = 0 ADCON1 = 11 // AN0..AN3 active ADC's INTCON2.7 = 0 // RBPU active PWM.SetFreqByTable(tt) PWM.Start1 PWM.Start2 While true adc0 = ADC.Read(2) adc1 = ADC.Read(3) If tt = 0 Then PWM.SetDuty1(adc0) PWM.SetDuty2(adc1) Else PWM.SetDuty1(adc0 >> 1) PWM.SetDuty2(adc1 >> 1) End If If (PORTB And 1) = 0 Then Inc(tt) tt = tt And 1 PWM.SetFreqByTable(tt) Repeat DelayMS(5) Until (PORTB And 1) 0 EndIf Wend
Link: What is a Swordfish Library?
Comments (2)
Joomla components by Compojoom
|
|
| Last Updated ( Friday, 02 October 2009 08:19 ) |
Whos Online
- Jon Chandler
- MrDEB
Forum Activity
LCD / 18F1320 - mrdeb Friday, 19 March 2010 07:19 - [0 replies]
A 'throw-away" PIC board - mrdeb Thursday, 18 March 2010 06:19 - [32 replies]
Credit Where Credit's Due - jon chandler Tuesday, 16 March 2010 12:01 - [9 replies]
Marching LEDs - mrdeb Saturday, 13 March 2010 22:54 - [7 replies]
USB 8 Channel Servo Controller - andyo Saturday, 13 March 2010 01:19 - [2 replies]
Dedicated Servo Controller - graham Friday, 12 March 2010 17:58 - [0 replies]
Must have....delta temperature glowies! - graham Friday, 12 March 2010 17:31 - [3 replies]
Recent Comments
- 2010-03-17 22:58:18 Jon C...
Graham, Thanks for fixing the spacing on the array. This is how i...
- 2010-03-17 21:14:34 ASDne...
Thanks Graham, It is a problem with Flowcode because the demo wa...
- 2010-03-17 19:50:32 Graha...
Looks like you've pretty much solved every minor issue that was enc...
- 2010-03-17 11:42:03 Jon C...
The low-cost servo does have one other feature. The origina...
- 2010-03-17 10:56:44 Graha...
I am not familiar with flowcode, though did you try powering the bo...
- 2010-03-15 21:47:55 ASDne...
Hello there, I am still trying to get the LCD to work but I am pro...
- 2010-03-15 13:16:38 Graha...
Hi Hop, I've finally got some time this weekend to delve into the ...
- 2010-03-13 16:36:21 andyo
Very nice - 900,000 packets and 0 errors - can't ask for better tha...




All of these articles are very good, and present a nice library to learn SF Basic! A simple schematic would be nice, and really complete the lesson.
Thanks for all of these great articles!