home *** CD-ROM | disk | FTP | other *** search
/ MACD 4 / MACD4.iso / Emulatory / PicSim / examples / SIMPLE.SRC < prev   
Encoding:
Text File  |  1978-03-06  |  629 b   |  37 lines

  1. ;this is a simple source
  2. ;
  3. ;this little program toggles the PortA bit 3,
  4. ;Port B counts every change on bit RA.3
  5. ;
  6.  
  7.  
  8.  
  9.     DEVICE PIC16C54,RC_OSC,WDT_OFF,PROTECT_OFF
  10.  
  11.     RESET    start
  12.  
  13. count1    =    0Bh            ;this defines the register
  14.  
  15.  
  16.  
  17.  
  18.  
  19. start    mov    !RA,#00000111b        ;bit 0 to bit 2 are inputs
  20.     mov    !RB,#0            ;portb is output
  21.     clr    RB            ;clear PortB
  22.  
  23. main    xor    RA,#000001000b        ;toggle bit 3 from PortA
  24.     inc    RB            ;increase PortB
  25.  
  26.     call    delay
  27.  
  28.     jmp    main            ;do the main loop
  29.  
  30.  
  31.  
  32.  
  33. delay    mov    count1,#20        ;mov 20 to count1
  34. :loop    djnz    count1,:loop        ;decrement count1 and jump to local symbol until
  35.                     ;loop is > 0
  36.     ret
  37.