30 lines
839 B
Plaintext
30 lines
839 B
Plaintext
' ########### start ###########
|
|
' pic:PIC16F886
|
|
' ########### end ###########
|
|
|
|
'softPWM_dual_together.gcb
|
|
'A program to brighten and dim the LEDs on Demo-Shield
|
|
'Red LEDs on PIC13 and PIn 10 will DIM together and brighten together
|
|
|
|
'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, 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, cnt, 10)
|
|
next
|
|
loop ' Continuous loop
|
|
|
|
|