Pic Basic megszakítás!HELP

Peter Pavai Peter.Pavai at temic.com
Fri May 12 16:50:09 CEST 2006


Üdv Szakik!

Adott egy Pic-es kapcsolás és telepről üzemelne!
És a SLEEP funkció tök jó lenne. Le megy Sleep-be de nem tudom
megszakítással felébreszteni!
Esetleg valakinek nincs egy mintája?
Biztos hogy én vagyok a láma de nem tudok rájönni mi a probléma!
Tudnátok segíteni?
Elküldöm a progit

Péter

rem                                             auto
rem device 16F627
option_reg = %00000000
intcon = %11010010
config INTRC_OSC_CLKOUT,  WDT_OFF, PWRTE_ON, boden_on, lvp_off,mclre_off
      asm
clrf porta
movlw 0x07
movwf cmcon
bcf status, rp1
bsf status, rp0
movlw 0x1f
      endasm
trisa = %00000
low porta
trisb = %10001101
symbol accout = portb.1
symbol charge = portb.2
symbol sw = portb.3
symbol ignition= portb.4
symbol starter = portb.5
symbol ignition2 = portb.6
symbol accin = portb.7
dim K as byte
dim n as word
dim A as word
dim L as word
dim M as word
n = 60100
M = 500
low ignition
low ignition2
low starter
low accout
delayms 1000
alap:
L = 0
K = 0
A = 10000
low ignition2
low ignition
low starter
   if accin = 0 then delayms 1
   if accin = 0 then
   high accout
   n = 10
   endif
              if accin = 0 and sw = 0 then delayms 1
              if accin = 0 and sw = 0 then goto inditas
                      if n < 60000 and accout = low then dec M
                       if M = 0 and accout = low then goto szundi
                     if n > 0 then dec n
                      if n = 0 then
                      low accout
                      endif
                                   if sw = 0 then delayms 1
                                   if sw = 0 then goto u
delayms 20
                                                      if accin = 0 and sw =
0 then delayms 1
                                                      if accin = 0 and sw =
0 then goto inditas
goto alap
u:
       toggle accout
wait1:
               if sw = 0 then
               delayms 1
               goto wait1
               endif
n = 60500
goto alap
inditas:
      A = 10000
      high ignition
      high ignition2
                                   wait2:
                                   delayms 1
                                   if sw = 0 then
                                   goto wait2
                                   endif
iinditas:
      high ignition
      if sw = 1 then L = 0
                          if sw = 0 then delayms 10
             if sw = 0 then inc L
             if L > 25 then
              A = 10000
             high starter
             low accout
             low ignition2
             else
             low starter
             high accout
             high ignition2
             endif
  if accin = 1 then delayms 10
  if accin = 1 then
  n = 10
  goto alap
  endif
       if charge = 0 then delayms 100
       if charge = 0 then low starter
       if charge = 0 then delayms 1000
       if charge = 0 then goto stopp
          if A > 0 then dec A
                 if A =  0 then
          goto alap
          endif
delayms 1
      goto iinditas
stopp:
      low starter
            if sw = 1 then K = 0
      high accout
      high ignition
      high ignition2
                       if charge = 1 then delayms 10
                       if charge = 1 then K = 120
                      if accin = 1 then delayms 10
                       if accin = 1 then
                       n = 10
                       goto alap
                       endif
                                  if sw = 0 then delayms 5
                                  if sw = 0 then inc K
                                  delayms 5
                                  if K > 120 then
                                  low ignition
                                  low ignition2
wait3:
     delayms 1
      if sw = 0 then
      goto wait3
      endif
                                  delayms 1000
                                  n = 10
                                  goto alap
                                  endif
goto stopp
szundi:
      ON INTERRUPT goto ugras
      sleep
ugras:
      high ignition
      delayms 1000
      n = 60100
      M = 500
      goto alap
end


* * * * Ezt a levelet a ScanMail Vírusírtó automatikusan ellenőrizte ! This
Mail is verified  automatically by ScanMail virus scanner ! * * * *




More information about the Elektro mailing list