pastebin - collaborative debugging tool
kpaste.net RSS


Untitled
Posted by Anonymous on Sun 2nd Sep 2012 17:51
raw | new post

  1. CON
  2.   _clkmode = xtal1 + pll16x
  3.   _xinfreq = 5_000_000
  4.  
  5. CON
  6.   ColPos = 8  
  7.  
  8. OBJ
  9.   'pst   :       "Parallax Serial Terminal"
  10.   console : "FullDuplexSerial"
  11.  
  12. VAR
  13.   long div
  14. PUB Main
  15.  ' pst.Start(57_600)                                                            'Set Parallax Serial Terminal to 115200 baud
  16.   div :=100
  17.   console.start(31, 30, 0, 9600)
  18.   repeat
  19.   ' ' ping dureation , count
  20.     LED_Flash(16, 1, 1)                   'Flash led
  21.     LED_Flash(17, 1, 1)                  'Then another
  22.     LED_Flash(18, 1, 1)                   'And finally a third
  23.     LED_Flash(19, 1, 1)
  24.     LED_Flash(20, 1, 1)
  25.     LED_Flash(21, 1, 1)
  26.     LED_Flash(22, 1, 1)
  27.     LED_Flash(23, 1, 1)
  28.     LED_Flash(22, 1, 1)
  29.     LED_Flash(21, 1, 1)
  30.     LED_Flash(20, 1, 1)
  31.     LED_Flash(19, 1, 1)
  32.     LED_Flash(18, 1, 1)                   'And finally a third
  33.     LED_Flash(17, 1, 1)                  'Then another
  34.     div := div + 2
  35.  
  36.    ' div := div +2
  37.  
  38.  
  39. PUB LED_Flash(Pin, Duration, Count)        
  40. {Flash led on PIN for Duration a total of Count times.
  41.  Duration is in 1/100th second units.}
  42.   Duration := clkfreq / div * Duration   'Calculate cycle duration
  43.   dira[16..23]~~                         'Set pins to output
  44.  
  45.   repeat Count * 2                       'Loop Count * 2 times...
  46.     !outa[Pin]                           '  Toggle I/O pin
  47.     waitcnt(Duration + cnt)              '  Delay
  48.    'console.Clear
  49.    console.str(string("test",13))
  50.    console.Dec(div)                                 'Announce output

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at