Page 1 of 1

What program is on delivered Main Board?

PostPosted: Sun Dec 08, 2013 5:49 pm
by Gordon_H
Just curious as to what program is on the Main Board as delivered. Mine has D4 being PWM'ed to change the brightness- I didn't see it in the samples folder. Did I miss it?

Re: What program is on delivered Main Board?

PostPosted: Sun Dec 08, 2013 6:04 pm
by David John Barker
It's something Matt put together ages ago called "Throb" - I use it to test the board before it gets shipped. The Arduino layout doesn't have PWM on D13 but the PIC24HJ128GP502 has a mechanism called Peripheral Pin Select (PPS) which allows you to move the PWM hardware onto another pin. In this case of Firewing, D13 is actually PORTB.14 - here is the code:
Code: Select all
' pic startup...
sub OnStartup() handles PIC.OnStartup
   RPOR7 = &H0012               
   T2CON = &H8000               
   PR2 = &H100                 
   OC1RS = &H00               
   OC1CON = &H0006             
end sub       

' entry point...
sub Main()
   Dim bright as Byte
   
   while true
      for bright = 0 to 100
         OC1RS = bright
         delayms(10)
      next bright

      for bright = 100 to 0 step -1
         OC1RS = bright
         delayms(10)
      next bright
   end while
end sub