ADVERTISEMENT

pic-basic-pro-uygulamalari.rar

Zastosowania PicBasic Pro: ACD, wyświetlacze, PWM, RS232, I2C i inne

ACD,Display,Dotmatrix,Led,Lcd,PWM,Hpwm,spwm,Read,write,lock,counter,rf,rs232,i2c other isis dsn and hex pbp other files http://rapidshare.com/files/172463188/pic-basic-pro-uygulamalari.rar


Download file - link to post
  • pic-basic-pro-uygulamalari.rar
    • say?c?.JPG
    • 0-9999.hex
    • say?c?3.bmp
    • 0-9999.mac
    • Thumbs.db
    • say?c?1.bmp
    • Last Loaded 0-9999.DBK
    • 0-9999.BAS.pbp
    • 0-9999.asm
    • 0-9999.DSN
    • 0-9999.PWI
    • say?c?2.bmp


pic-basic-pro-uygulamalari.rar > 16F628-PWM.txt

define osc 20

@ device HS_OSC
@ device pwrt_on & MCLR_OFF
@ device WDT_OFF
@ device protect_on & cpd_on

cmcon=7

TRISA = %11100111
TRISB = %00011111
porta=0
portb=0
'************* GÝRÝÞ ÇIKIÞ TANIMLAMALARI ************
volume1 var portb.5
volume2 var portb.6
balance var porta.3
bas var portb.7
tiz var porta.4
bilgi var porta

'********************* Deðiþken tanýmlamalarý **********
zaman1 var byte
zaman2 var byte
zaman3 var byte
zaman4 var byte
zaman5 var byte
giris var byte
deger var byte
yazgec var byte

'******** DEÐÝÞKEN ÝLK DEÐERLER ************
yazgec=0
porta=0:portb=0
bilgi=0
giris=0
zaman1=0:zaman2=0:zaman3=0:zaman4=0:zaman5=128

tmr0=0
option_reg=%10000100
pause 500
'///////////////// ANA PROGRAM \\\\\\\\\\\\\\\\\
'///////////////// ANA PROGRAM \\\\\\\\\\\\\\\\\
basla:
if tmr0 & gt; =zaman1 then volume1=0
if tmr0 & gt; =zaman2 then volume2=0
if tmr0 & gt; =zaman3 then bas=0
if tmr0 & gt; =zaman4 then tiz=0
if tmr0 & gt; =zaman5 then balance=0

if tmr0 & lt; 10 then
portb=255:porta=255
endif
giris=portb & %00011111
if bilgi=0 then basla
if bilgi=1 then zaman1=giris & lt; & lt; 3
if bilgi=2 then zaman2=giris & lt; & lt; 3
if bilgi=3 then zaman3=giris & lt; & lt; 3
if bilgi=4 then zaman4=giris & lt; & lt; 3
if bilgi=5 then zaman5=giris & lt; & lt; 3

goto basla
End


pic-basic-pro-uygulamalari.rar > HpwmKullan?m?.doc

Step by Step...

Firstly Defines come first... by default PBP assumes 4MHz clock, so you
don't need to have a DEFINE OSC statement unless your clock is other
than 4MHz.

Secondly, let's set the PIC up for internal oscillator and no MCLR (MCLR
pin can be used as an Input)...

@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT

' System Clock Options

@ DEVICE pic16F628, WDT_ON

' Watchdog Timer

@ DEVICE pic16F628, PWRT_ON

' Power-On Timer

@ DEVICE pic16F628, MCLR_OFF

' Master Clear Options (Internal)

@ DEVICE pic16F628, BOD_ON

' Brown-Out Detect

Now we have our PIC configured, we need to configure the pins... let's
say we want a Blinky LED on PortB.0 and of course our HPWM will fall out
of PortB.3...

LED var PortB.0

' Put a LED on this Port Pin

CMCON=7

' This assigns all pins Digital but it only affects PortA, so if

' you're not bothered with PortA this is irrelevant

TRISB=%00000000

' I've assigned ALL of PortB as Output,

' I only need to have done that for B.0 and B.3

Pause 200

' A large Pause at startup is only needed to wake-up sluggish

' external devices like LCD's...

HPWM 1,127,1000

' Yup, this will give 1kHz at 50% Duty

Loop:

Toggle LED

Pause 500

Goto Loop

End

This blinks an LED (somebody else wanted to know how to set up a 16F628
to do that so it answers that query as well), while at the same time it
will permanently output your PWM train in background.


pic-basic-pro-uygulamalari.rar > HPWM B?LG?.doc

HPWM

?ZAHI:

KANAL(P?N),DUTYCYLE(??_SÜRES?),FREKANS(SAYKIL_ADED?)

Dutycyle:ç?k?? sinyalinin gerilimidir.8 bitlik bir de?er olup 0*255
aras?ndad?r buda gerili olarak 0*5V aras?ndad?r.

16f877'de PORTC.1 ve PORTC.2 CCP1,CCP2 HPWM komutu kullan?larak bir
ledin parlakl??? ve bir motorun sa?a ve sola dönü?ü yap?labilir.

Yapaca??n?z program?n ba??na def?ne tan?mlamalar?n? yapman?z
gerekmektedir:

PIC16F877 PORTC.1 VE PORTC.2 PWM ÇIKI?IDIR

PIC16F628 PORTB.3 PWM ÇIKI?IDIR

r

Â

r

Â

Ä

Æ

Â

Ä

Æ

'HPWM PORTC.1

DEFINE CCP2_REG PORTC 'HPWM PORTC.2

DEFINE CCP1_BIT 2 'CCP1 P?N? PORTC.2

DEFINE CCP2_BIT 1 'CCP1 P?N? PORTC.1

ÖRNE??N: HPWM 1,127,1000

%50 ?? SÜRES? OLAN VE 1000 PWM S?NYAL?N? PORTC.2'DEN GÖNDER

%25 ?? SÜRES? YAKLA?IK 1.25V DEC?MAL 64

%50 ?? SÜRES? YAKLA?IK 2.5V DEC?MAL 127

%75 ?? SÜRES? YAKLA?IK 3.75V DEC?MAL 192

%100 ?? SÜRES? YAKLA?IK 5V DEC?MAL 255


pic-basic-pro-uygulamalari.rar > rgbPWM.txt

'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : Michael Schneider *
'* Notice : Copyright (c) 2005 motohoho *
'* : All Rights Reserved *
'* Date : 9/29/2005 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
DEFINE OSC 4

TRISB = %00000000 'set all of portb to output
TRISC = 0 'set all of portc to output

mode var byte'this will tell us which mode we are in
counterVar var word 'this will provide timing
colorGoal var byte[3] 'hold rgb for the color I am going to
currentColor var byte[3] 'holds rgb for where I am
colorCheck var byte 'will see if I reached my goal
x var byte 'for for


maxCount con 1' this is how fast it will happen (bigger = slower)

clear

high portc.0
pause 2000
low portc.0

main:

if countervar & gt; maxcount then 'if we counted up above max count then
countervar = 0 'reset counter
colorcheck = 0 'initialize test variable
for x = 0 to 3
if currentcolor[x] = colorgoal[x] then 'check to see if we have
colorcheck = colorcheck + 1 'reached our goal on each
endif 'if we have add 1 to colorcheck
next
if colorcheck = 3 then 'if they all matched colorcheck should be 3
mode = mode + 1 'go to the next mode
else 'if they didn't all match adjust currentcolor towards goal
for x = 0 to 3 'one at a time
if currentcolor[x] & lt; colorgoal[x] then
currentcolor[x] = currentcolor[x] + 1
else
currentcolor[x] = currentcolor[x] - 1
endif
next
endif
else
counterVar = countervar + 1
endif

select case mode//3 'assign color values according to which mode
case 0 'mode//(mod)3 will give us 0, 1 , 2
colorgoal[0] = 25
colorgoal[1] = 200
colorgoal[2] = 0
case 1
colorgoal[0] = 0
colorgoal[1] = 250
colorgoal[2] = 77
case 2
colorgoal[0] = 250
colorgoal[1] = 0
colorgoal[2] = 100
end select

pwm portc.0, currentcolor[0], 1 'pwm out colors
pwm portc.1, currentcolor[1], 1
pwm portc.2, currentcolor[2], 1

goto main


pic-basic-pro-uygulamalari.rar > PWM2.txt

PIC BASIC CODE for spewing out ADCIN variables:

‘****************************************************************
‘* Name : SIMPLESERVO_2.BAS *
‘* Author : Todd Holoubek / revised by Jaki Levy *
‘* Notice : Copyright (c) 2004 Todd Holoubel *
‘* : All Rights Reserved *
‘* Date : 10/17/2005 *
‘* Version : 1.0 *
‘* Notes : *
‘* : *
‘****************************************************************
DEFINE OSC 4

start:
‘DEBUG THE BOARD
OUTPUT PORTC.4

MAIN:
INCLUDE “modedefs.bas”

‘Test to make sure PIC PROGRAM IS WORKING -
HIGH PORTC.4

‘ Define ADCIN parameters
‘ Set number of bits in result
DEFINE ADC_BITS 10

‘ Set clock source (3=rc)
DEFINE ADC_CLOCK 3

‘ Set sampling time in microseconds
DEFINE ADC_SAMPLEUS 10

‘ Set PORTA to all input
TRISA = %11111111

‘ Set up ADCON1 analog and right justify the result
adcon1 = %10000010

‘define adc vars
redVal VAR WORD ‘Create variable to store result
greenVal VAR WORD ‘Create variable to store result

’set a var for the pulsewidth- this tells the motor where to go
pulseWidth var byte

‘ usage: serout2 dataPin, mode, [data]
serout2 portc.6, 16468, [”redVal = “, redVal, 10, 13, “greenVal = “, greenVal, 10, 13]

‘thes values can be vary with different motors
‘refreshPeriod CON 20main:

‘read adc data
ADCIN 0, redVal
ADCIN 1, greenVal

‘
redVal = (redVal/4)
greenVal = (greenVal/4)

if redVal & gt; = 255 then
redVal = 255
else
redVal = redVal
endif

if greenVal & gt; = 255 then
greenVal = 255
else
greenVal = greenVal
endif

‘assign pulseWidth to the position of the potentiometer
pulseWidth = redVal
pulseWidth = greenVal

’set the pin low
low PORTD.2

‘pulse the pin
PulsOut PORTD.2, pulseWidth

‘pause
‘pause refreshPeriod
GOTO main


pic-basic-pro-uygulamalari.rar > RGB FADE.txt

RGB Fading in PicBasic Pro
Michael Schneider wrote this program for fading RGB LED's using picBasic Pro. It uses PWM, not hardware PWM, so adding a lot of other code to it might make the LED's fade in a choppy manner. It's a good base for LED fading, though. Note that he uses the Basic stamp pin numbers for his LED pins (5 through 7). These correspond to pins RB5 through RB7.
' PicBasic Pro program for fading RGB LED's.
' Note that htis program uses the
' Basic Stamp-equivalent pin numbers, 5 through 7.
' These correspond to pins RB5 through RB7.


' By Michael Luck Schneider, Jan 2004.

include " modedefs.bas "


DEFINE OSC 4
DEFINE ADC_BITS 8
DEFINE ADC_CLOCK 3
DEFINE SAMPLEUS 50



TRISB = %00000000
TRISA = %11111111
TRISD = %00000000

ADCON1 = %00000010

rbgArray var byte[3] ' holds the rgb values in this case the led is rbg




x var byte
y var byte
adcVar var byte
rbg var byte 'which value we are changing in the rbg array
rainbowVal var byte 'the current value to produce rainbow
Delta var byte ' find the size of each section in the 6stage rainbow
Section var byte 'which section it is in

maxValue con 255 'the maximum input value for generating rainbow

delta = maxValue/6

y = 0



for x = 5 to 7

high x
pause 1000
low x

next
main:



adcin 0, rainbowval
'serout2 portc.6, 16468, [ " rainbow val: " , dec rainbowval, 13, 10]


gosub rbgrainbow



goto main


rbgrainbow:

for rbg = 0 to 2
section = ((rainbowval + ((rbg * 2)*delta))/ delta) // 6 ' this gives what section it is in
'serout2 portc.6, 16468, [ " rbg: " , dec rbg, 13,10, " section: " , dec section, 13, 10]
select case section
case 0
rbgarray[rbg] = (rainbowval // delta)*6 'this is how far it has gone in its section
case 1
rbgarray[rbg] = 255
case 2
rbgarray[rbg] = 255
case 3
rbgarray[rbg] = 255 - ((rainbowval //delta)*6)
case 4
rbgarray[rbg] = 0
case 5
rbgarray[rbg] = 0
case 6 'this one is for pics bad math
rbgarray[rbg] = 0
end select
next

gosub ledpwm

return

ledPWM:
for y = 0 to 2
pwm 5 + y, rbgarray[y], 1
'serout2 portc.6, 16468, [ " color " ,dec y, " : " , dec rbgarray[y], 13, 10]
next

return


pic-basic-pro-uygulamalari.rar > multi_SPWM.htm

Multiple Slow speed Software PWM




Multiple Slow speed Software PWM & nbsp;
(for PicBasic Pro)
OK, I finally got it working, Yahoo.
After writing the SSPWM
program. & nbsp; The first thing that everyone said was... & quot;How can I use
more than one SSPWM on the same chip? & quot; & nbsp; Of course the answer was..
& quot;You can't & quot;. & nbsp; SSPWM was written as a minimum impact Background
process. & nbsp; This means that it uses Timer1 to determine when the output needs
to change states, and uses very little processing time to accomplish it. & nbsp;
That way the main program can continue on without much disruption. & nbsp;
Therefore, to have more than 1 SSPWM output on the same chip would require 2
16-bit timers, one for each output. & nbsp; Since there aren't any 16F chips with
2 16-bit timers, this became a problem for everyone. & nbsp; So, back to the
proto-board I went
The result, is now called Multi_SPWM.pbp
and has the following features

up to 8 & nbsp; Slow Speed PWM outputs simultaneously on 1 chip
Works on just about any chip. 12F, 16F, 18F
Each SPWM output can be assigned to ANY General I/O pin on any Port
PWM is 8-bit (0-255) & nbsp; 0=Always Low, & nbsp; 255=Always High
Can be compiled with either MPASM or PM
It's an Include file, for easy implementation in your program.
Error checking is built in, and supplies Messages detailing the problems.

The downside to this version is that it uses a lot of processor time. & nbsp;
This leaves very little for the rest of the program. & nbsp; Depending on how it
is configured, it may use 75% or more of the available processing time. & nbsp;
The reason it & nbsp; uses so much is due to the large number of interrupts
required. & nbsp; Instead of only 2 interrupts per cycle like SSPWM, Multi_SPWM
needs 256 interrupts per cycle to be able to handle multiple outputs at various
DutyCycles. So if the PWM frequency is say 100Hz, it takes 25,600 interrupts per
second. & nbsp; With each output using around 20 instructions per interrupt, it
adds up to about 512,000 instructions per second, per output. & nbsp; Yowsa. & nbsp;
Needless to say, you probably won't want to run this on a 4Mhz processor.
Here's what it takes to use the program. & nbsp;

Define the PWM frequency







define SPWMFREQ 100 ' PWM frequency in Hz









For each output that you will be using, create a BYTE sized variable to hold
the Dutycycle value. & nbsp; They can be named anything you wish, but for the
example I'll just stick with the obvious.







DutyCycle1 VAR byte ' 0-255 0=Idle Low 255=Idle High
DutyCycle2 VAR byte
DutyCycle3 VAR byte









Designate the Output Pin for each PWM channel, and tell Multi_SPWM what
veriable holds the Dutycycle for that channel by using a define.







SPWM1PIN VAR PORTB.0 ' SPWM channel 1
define SPWM1VAR _DutyCycle1

SPWM2PIN VAR PORTB.1 ' SPWM channel 2
define SPWM2VAR _DutyCycle2

SPWM3PIN VAR PORTB.2 ' SPWM channel 3
define SPWM3VAR _DutyCycle3










And finally, include the Multi_SPWM.PBP file







Include & quot;Multi_SPWM.pbp & quot;








Congratulations, you now have 3 PWM channels running at 100hz, ready and
waiting for you to set the dutycycle. & nbsp; All PWM channels automatically
configure the pin as an output, and set the output to the LOW state. & nbsp; It
will IDLE there until the Dutycycle is changed.

The Dutycycle can be changed at any time by simply changing the
variable. & nbsp; The PWM output will be automatically updated (if nescessary)
on the next interrupt. & nbsp; There are no subroutines to call. & nbsp; It all
& quot;Just Happens & quot;.







DutyCycle1 = 0
DutyCycle2 = 50
DutyCycle3 = 255








That's all there is to it.
Here's the complete example program.






define OSC 20

define SPWMFREQ 100 ' PWM frequency in Hz

DutyCycle1 VAR byte ' 0-255 0=Idle Low 255=Idle High
DutyCycle2 VAR byte
DutyCycle3 VAR byte

SPWM1PIN VAR PORTB.0 ' SPWM channel 1
define SPWM1VAR _DutyCycle1

SPWM2PIN VAR PORTB.1 ' SPWM channel 2
define SPWM2VAR _DutyCycle2

SPWM3PIN VAR PORTB.2 ' SPWM channel 3
define SPWM3VAR _DutyCycle3

Include & quot;Multi_SPWM.pbp & quot;

DutyCycle1 = 0
DutyCycle2 = 127
DutyCycle3 = 255

Loop:
Pause 100
Goto Loop








This is a new program as of 5/16/2004 so I wouldn't be surprised if there's a
problem somewhere. & nbsp; So, if you have any problem, please let me know, as it
will help everyone involved. & nbsp; Please feel free to post a comment if you'd
like at the bottom of this page.
Best regards,
& nbsp; & nbsp; Darrel Taylor


pic-basic-pro-uygulamalari.rar > 74HC595.doc

Bu entegre senkron olarak çal??an, toplam 5 kontrol hatt?na sahip olan
ancak kullan?m

amac?na göre 2 hatla dahi kontrol edilmesi mümkün olan bir seri giri? 8
bit paralel ç?k??

entegresidir. Kontrol hatlar? SER, SCK, RCK, G, SCRL olarak a?a??da
yazan uçlard?r. Bu

hatlar?n entegreye nas?l etki ettikleri a?a??da aç?klanm??t?r.

SER: Bu pin seri data al?m? için data giri?idir.

SCK: Bu pin data hatt?ndaki bilginin entegredeki buffer diye tabir
edilen D tipi flip floplara

yüklenebilmesi için clock giri?idir.

RCK: Bu pin buffer olarak belirtti?imiz D tipi flip floplara yüklenen
verinin bir sonraki, yani ç?k???

sa?layan D tipi flip floplara yüklenmesini sa?layan clock giri?idir

G: Bu pin ise TRI-STATE output kontrolü giri? pinidir. Bu pine lojik 0
verir isek gönderilen bilgi

ç?k??ta görünür. Lojik 1 verir isek gönderilen bilgi ç?k??ta görünmez.

SCRL: Bu pin ise reset pinidir bu pine lojik 0 uygulad???m?zda entegreye
reset atm?? oluruz

dolay?s?yla o an içerisinde (tampon yani buffer) ve ç?k???nda bulunan
tüm veriler silinir. Bu pinin

reset at?m? an?, haricinde lojik 1 de tutmas? gereklidir yoksa entegreye
veri yüklenemez ç?k???na

aktar?lamaz.

ÇALI?MASI: yukar?da yap?lmas? gerekenler s?ral? olarak aç?kland?. Ama
?imdi bir araya

ö

ü

L

N

¬

ö

Ä L

risini 74HC595 e gönderip ç?k???nda gösterelim.

SCRL = 1 den 0-1 e getirildi, entegre içeri?i 0 oldu, SER = 1 yap?ld?,
SCK = 0 dan 1-0 a getirildi

?uan buffer içerisinde 0000 0001 verisi bulunuyor yani di?er bitler 0
oldu?u için sadece 1 bit

yollamam?z bizim için 0000 0001 verisini elde etmeye yeterli oldu, sonra
RCK = 0 dan 1-0

getirildi böylece veri ç?k?? flip floplar?na aktar?lm?? oldu. Son olarak
G = 1 den 0 a getirildi ve veri

ç?k??ta gösterilmi? oldu. Bu entegrenin temel çal??ma biçimi olmas?na
kar??n daha az hamle

yap?larak da kontrol edilebilir.

Örne?in: reset lojik 1 çekilip b?rak?l?r, QE yani G Pini lojik 0 a
çekilip b?rak?l?r di?er

pindende istenirse 2 clock hatt? birle?tirilerek kontrol pini say?s?
toplam 2 hatta dü?ürülebilir.

Ancak biz bu deneyde 3 hatta dü?ürmeyi yeterli gördü?ümüzden 2 ye
dü?ürmedik.


pic-basic-pro-uygulamalari.rar > 12F-RGB.txt

;***********************************************************************************
;
; LISTING 1
;
; " Rainbow LED indicates voltage with color, " EDN, December 7, 2004, pg 106
;
;***********************************************************************************

' PicBasic Pro program to read A/D on 12F675 ADC
' and display voltage A/D output using multi-color LED
' using a cold-to-hot color pallette. Center of range
' is dark.
'
' (c) 2003 by David Prutchi
'

i VAR BYTE ' Define loop variable
blue VAR BYTE ' Define blue pulse-width variable
green VAR BYTE ' Define green pulse-width variable
red VAR BYTE ' Define red pulse-width variable
' GPIO port 0 to GREEN LED
' GPIO port 1 TO RED LED
' GPIO port 2 to BLUE LED
color VAR BYTE ' Define LED color variable
x VAR BYTE ' Allocate A/D variable

' Set A/D Parameters
DEFINE ADC_BITS 8 ' Use 10-bit A/D as 8-bit A/D
ANSEL.3=1 ' Set ANS3 as analog input pin
ANSEL.4 = 0 ' Set A/D clock
ANSEL.5 = 1
ANSEL.6 = 0
ADCON0.0 = 1 ' Turn On A/D
ADCON0.2 = 1 ' A/D channel 3
ADCON0.3 = 1
ADCON0.6 = 0 ' VDD is voltage reference
ADCON0.7 = 0 ' Left Justify result

' Set GPIO port pins 0, 1 and 2 as outputs
TRISIO.0=0
TRISIO.1=0
TRISIO.2=0


GoTo mainloop ' Skip subroutines

' SUBROUTINES
' -----------

' Subroutine to read a/d converter
getad:

ADCON0.1 = 1 ' Start conversion
PauseUs 50 ' Wait for conversion
x = ADRESH
Return


' MAIN
' ----

mainloop:


GoSub getad ' Get x value by performing A/D conversion


' RGB ENCODING FUNCTION
' Convert A/D reading into color table
' Each color has 14 possible intensity levels


IF x & lt; =42 Then 'aqua
red=x/3
blue=14
green=(42-x)/3
EndIF
IF x & gt; 42 AND x & lt; =84 Then 'shades of violet
red=(84-x)/3
green=0
blue=14
EndIF
IF x & gt; 84 AND x & lt; =126 Then 'shades of green
red=0
green=0
blue=(126-x)/3
EndIF
IF x & gt; 126 AND x & lt; =130 Then 'dark
red=0
green=0
blue =0
EndIF
IF x & gt; 130 AND x & lt; =172 Then 'shades of red
red=(x-130)/3
green=0
blue=0
EndIF
IF x & gt; 172 AND x & lt; =214 Then 'red / orange / yellow
red=14
green=(x-172)/3
blue=0
EndIF
IF x & gt; 214 Then 'yellow to white
red=14
green=14
blue=(x-214)/3
EndIF


' PULSE WIDTH MODULATOR
' Each PWM frame has 14 steps.

For i = 1 TO 14 ' Cycle through 14 steps of frame
color=0
IF red & gt; 0 Then
color=color+2
red=red-1
EndIF
IF green & gt; 0 Then
color=color+1
green=green-1
EndIF
IF blue & gt; 0 Then
color=color+4
blue=blue-1
EndIF
GPIO=color
PauseUs 100 ' Allow LEDs to shine for a few microseconds
Next i
GPIO=0
GoTo mainloop ' Do it forever

End


pic-basic-pro-uygulamalari.rar > 629-Pwm.txt

OUTPUT 2

Low 2

fade VAR WORD

Main:

Pause 500

For fade = 1 to 1024 STEP 1

GPIO.2 = 1
PauseUS fade
GPIO.2 = 0
PauseUS 1025 - fade

Next

For fade = 1024 to 1 STEP - 1

GPIO.2 = 1
PauseUS fade
GPIO.2 = 0
PauseUS 1025 - fade

NEXT

Goto Main

END


pic-basic-pro-uygulamalari.rar > pwm.txt

DEFINE OSC 4



output portc.0


arf var byte
duty var byte
counter var byte


for arf = 0 to 3
high portc.0
pause 100
low portc.0
pause 200
next


main:


for duty = 0 to 255
pwm portc.0, duty, 1
next




goto main