| 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
MARCHING ledS - mrdeb Thursday, 11 March 2010 10:48 - [2 replies]
REALISTIC LED candle flicker - mrdeb Wednesday, 10 March 2010 05:48 - [0 replies]
the LCD demo hello world - mrdeb Wednesday, 10 March 2010 05:41 - [29 replies]
USB problem - jon chandler Tuesday, 09 March 2010 11:31 - [3 replies]
Servo Module - andyo Tuesday, 09 March 2010 03:39 - [3 replies]
pic to ps2 communication - roshan Friday, 05 March 2010 01:30 - [7 replies]
Way Off Topic: Worldwide Ignite Week - jon chandler Wednesday, 03 March 2010 20:33 - [4 replies]
Recent Comments
- 2010-03-11 21:03:32 Jon C...
If this wasn't a class project that had to be done on a PIC16F690 u...
- 2010-03-11 15:30:06 uuu
I am going to send two data from ADC to USART(async mode) to serial...
- 2010-03-05 13:24:23 mrpse...
I was thinking of battery with powered routers or powered for every...
- 2010-03-05 12:17:40 andyo
50 rooms - wow. The XBee modules are very easy to use but I'm not ...
- 2010-03-05 11:46:37 mrpse...
Thanks AndyO. What I have to do is design a device to monitor temp...
- 2010-03-05 03:08:58 andyo
The circuit used for the remote sensor can be found here: [url]http...
- 2010-03-04 07:19:06 renno
plz i need help do u know from where i could download it or how cou...
- 2010-03-04 07:16:05 renno
hello everyone i'm trying to finish my final project and i want to ...




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!