Files
SyncHome/trunk/workspace/gcb/softpwm_dual_alternate.gcb
2023-03-09 12:51:54 +00:00

31 lines
849 B
Plaintext

' ########### start ###########
' pic:PIC16F886
' ########### end ###########
'SoftPWM_dual_alternate.gcb
'A program to brighten and dim the LEDs on Demo-Shield
'Red LEDs on PIC13 and Pin 10 will alternate
'Dimming and Brightening
'Chip model
#chip 16F886, 16
#include <chipino.h> ' Defines all the CHIPINO connections
#define PWM_out1 D13 ' define the PWMout 1 pin.
#define PWM_out2 D10 ' define the PWMout 1 pin.
'Main routine
Start:
'Turn one LED on, the other off
do
for cnt = 10 to 250 step 10 'Change duty cycle brighter
PWMOut(1, cnt, 10) 'slowly get brighter, 100 value sets speed
PWMOut(2, 250-cnt, 10)
next
for cnt = 250 to 10 step -10 'change duty cycle dimmer
PWMOut (1, cnt, 10) 'slowly dim, 100 value sets speed
PWMOut (2, 250-cnt, 10)
next
loop ' Continuous loop