Shop OBEX P1 Docs P2 Docs Learn Events
PULSIN about PropBASIC — Parallax Forums

PULSIN about PropBASIC

caskazcaskaz Posts: 957
edited 2010-04-06 18:17 in Propeller 1
Hi, everyone.

TASK alarm's LED is blinking, but main's LED is not on .
Sometimes P18 is on soon. but,Sometime after 2-5minutes.
Why does it ocurr?


DEVICE P8X32A,XTAL1,PLL16X
XIN      5_000_000
P0 PIN 0 INPUT
P18 PIN 18 LOW
alarm TASK
time_count VAR Long

Start:
cogstart alarm
Main:
DO
 PULSIN P0,0,time_count
 P18 = 1
LOOP

GOTO Main
END

TASK alarm
LED17 PIN 17 LOW
s PIN 0 INPUT
DO
 IF s = 0 THEN
  LED17 = 1
 ELSE
  LED17 = 0
 ENDIF
LOOP
ENDTASK


Comments

  • BeanBean Posts: 8,129
    edited 2010-03-27 20:53
    Your code is missing the PROGRAM line, so I assume this is not the complete program.
    I don't see anything wrong with it, so I'm not sure why it's not working.

    When I get a chance, I'll wire it up and see if it works for me.

    P.S. In the alarm task, you can just use "LED17 = ~s" instead of the IF..THEN...ELSE...ENDIF lines.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    ·
  • caskazcaskaz Posts: 957
    edited 2010-03-27 23:24
    Thanks, Bean.

    Nothing of Program line is my copy-miss.

    Reason P18 is not on is "Program Start LMM".
    P18 is on, when "Program Start".
    ".
    Actually "PULSIN" don't also work under program exceeding 492Longs.
  • caskazcaskaz Posts: 957
    edited 2010-03-31 01:18
    Hi, everyone.

    I combined to pbasic files.
    When I compile "ONKYO.pbas", error occur "PropClock.spin - Error at (1,5) Symbol Init is already defined".

    How does error solve?
  • BeanBean Posts: 8,129
    edited 2010-03-31 01:37
    In your INIT_LCD.pbas code you are using "init" as a variable name. That is not allowed.
    I'll add "INIT" to the invalid variable name file.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information

    Post Edited (Bean) : 3/31/2010 1:42:05 AM GMT
  • caskazcaskaz Posts: 957
    edited 2010-03-31 10:19
    Thanks, Bean.
    Error has gone.

    And, cannot calculation substract constant from variable?
    For example, it omit declare etc below.
    b  CON 400_000_000
    
    a = 400_123_456
    c = a - b
    DEBUG_DEC c
    d = 399_999_000
    e = b - d
    DEBUG_DEC e
    
    



    Result is c = 800123456 e=1000.

    Why is this?

    Post Edited (caskaz) : 3/31/2010 11:17:11 AM GMT
  • BeanBean Posts: 8,129
    edited 2010-03-31 11:53
    caskaz,
    Hmmmm, That is a bug. I will fix that in the next release.

    Thank you for finding it and letting me know about it.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
  • caskazcaskaz Posts: 957
    edited 2010-03-31 12:46
    Hi, Bean.

    I finished to translate from spin to pbas for your help.
    Code size is 1866Longs, and it's bigger than spin(about 1100Longs).
    I think PropBASIC is not needed, because this program don't need speed.
    But,this is good object for PropBASIC's lerning for me.
    Maybe you make more simple code.

    My request to next version:
    1.multiline comment like spin's {{...}}
    2.case instruction
    3.lookkup instruction

    How does about PULSIN and LMM?

    Thanks!
    640 x 480 - 44K
  • BeanBean Posts: 8,129
    edited 2010-04-01 16:12
    Just to let everyone know, the bug discovered above has been fixed in the current release 00.00.88 available here http://www.fnarfbargle.com/PropBasic/

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
  • caskazcaskaz Posts: 957
    edited 2010-04-02 01:45
    Bean, Thanks.

    Next release about PULSIN and LMM?
  • BeanBean Posts: 8,129
    edited 2010-04-02 12:24
    Yeah, I forgot about that one.
    The code looks right, so it took me awhile to figure out that the loop is just too tight for LMM (it takes too long to get back to the WAITCNT instruction which makes it hang up).

    I'll fix that in the next release. I will make the granularity 2uSec. So the value will STILL be in 1uSec units, but the value always be even.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
  • BeanBean Posts: 8,129
    edited 2010-04-06 18:17
    The latest version of PropBASIC 00.00.89 is now available.
    This version fixes the PULSIN problem when using LMM.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
Sign In or Register to comment.