Faster and Faster with a PIC16F628(A)

PIC Home Previous Page Next Page Next Chapter

Page: 1 2

You are ready to program

Copy and Pastable code


Be sure to create a new project first.
For a review of creating projects please go here
Paste BELOW your program name!
PROGRAM NAME CREATED VIA NEW PROJECT!!
COPY AND PASTE FROM NEXT LINE DOWN
'*********************
Dim booger as Integer  ' Just to prove that anything goes
'*********************
Sub Procedure Snot    ' Snot   Sure, why not!
booger = booger - 1
Vdelay_ms(booger)     ' Check it out, This Delay is variable
End Sub
'*********************
Sub Procedure scroll  ' Pretty Marquee lights
  PortB = %01001001
  Snot
  PortB = %10010010
  Snot
  PortB = %00100100
  Snot
End Sub
'*********************
Main:
  TrisB = %00000000   ' Configure PortB pins as output
  TrisA = %00001111   ' Configure some PortA pins as input
  CMCON = %00000111   ' Stupid Comparitor
  booger = 200
MainLoop:             ' We could have called it Kansas
  scroll
  If booger <=25 Then ' Try creeping 25 down
                      ' at some point it craps out
     PortB = %10000001
     Delay_ms(50)
     PortB = %01000010
     Delay_ms(60)
     PortB = %00100100
     Delay_ms(70)
     PortB = %00011000
     Delay_ms(80)
     PortB = %00111100
     Delay_ms(90)
     PortB = %01111110
     Delay_ms(95)
     PortB = %10000001
     Delay_ms(100)
     PortB = %00000000 ' Turn off all the lights
     Delay_ms(1000)    ' Chill for a sec
     booger = 200      ' Reset Booger
  End If
Goto MainLoop          ' Take me back to Kansas
End.
PIC Home Previous Page Next Page Next Chapter