Shop OBEX P1 Docs P2 Docs Learn Events
PropBasic ? converting INL and INC to the Prop from earlier BS2 code. — Parallax Forums

PropBasic ? converting INL and INC to the Prop from earlier BS2 code.

$WMc%$WMc% Posts: 1,884
edited 2010-06-04 17:18 in Propeller 1
Hello All:

·I'm in the process of converting a remote controller I made with the BS2 and the 27980/27981 RF modules with a Propeller.·I used INL and INC with the BS2 to take in the button states.

·How do I due this with the Prop. and PropBasic ?

I have attached the BS2 code I wrote just to show what I did thier.It works great with the BS2.

I want to expand the capability's of my remote. and later replace the BS2s on the RX end as well.


Thanks in advance for any help!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA


You can feel stupid by asking a stupid question or You can be really·stupid by not asking at all.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-01 04:54
    INL is an alias for input pins 0-7 while INC is an alias for input pins 8-11. In PropBasic, you'd define a name for your group of I/O pins like this:
    INL   PIN   7..0 INPUT
    INC   PIN   11..8 INPUT
    


    The first pin number is that of the most significant bit of the value while the 2nd pin number is that of the least significant bit of the value.
  • JonnyMacJonnyMac Posts: 9,236
    edited 2010-06-01 05:24
    INC is a keyword in PropBASIC -- for incrementing a variable; otherwise, as Mike points out, you can define pin groups and PB will treat them the way you're used to.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • $WMc%$WMc% Posts: 1,884
    edited 2010-06-01 16:17
    Thanks Guys

    This is great and really simple too. I was way over thinking it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA


    You can feel stupid by asking a stupid question or You can be really·stupid by not asking at all.·
  • JonnyMacJonnyMac Posts: 9,236
    edited 2010-06-01 16:38
    Keep in mind that, unlike PBASIC INx, you cannot use pin groups in PropBASIC as freely as a regular variable. As inputs you can read their value into a variable, but that cannot be part of an expression.

    somevar = pingroup

    is okay. Likewise, you cannot write an expression to a pin group, you can only move the contents of a simple variable:

    pingroup = somevar

    These restrictions are fairly minor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • $WMc%$WMc% Posts: 1,884
    edited 2010-06-01 20:44
    JonnyMac
    ·I see Your point, as I couldn't get my first code to compile w/ PropBasic. I made the changes You spoke of with swaping PINs into another VAR " SomVar1 = controls " "SomVar2 = speeds" in my DO LOOP.· This finaly compiled OK w/· no errors.
    ·I'll have the test bed set-up in a lillte bit with the PropProDev.Board and the BOE bot.

    ·I can't Thank You guys enough for the PropBasic complier and the support!!!!




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA


    You can feel stupid by asking a stupid question or You can be really·stupid by not asking at all.
  • $WMc%$WMc% Posts: 1,884
    edited 2010-06-04 04:12
    Hello again

    · I'm still trying to get this to work. And I'm sruggling. I finaly got some code to compile but its not working rite.

    I have attched the code I'm useing. I'm just tring to read in pins 0-7 at this point.

    Thanks in advance for any Help!!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA


    You can feel stupid by asking a stupid question or You can be really·stupid by not asking at all.
  • BeanBean Posts: 8,129
    edited 2010-06-04 11:05
    You are missing a "1" on your ELSEIF line.

    Use underscores to make binary values easier to read.

    ELSEIF buttons = %1111_1111 then '1111_1111 then

    Here is how I would do it:

    DEVICE      P8X32A, XTAL1, PLL16X
    XIN         5_000_000
     
    IsOff       CON     0
    IsOn        CON     1
     
    buttons     PIN  7..0 INPUT
    LED         PIN  12 LOW
     
    PROGRAM Start
     
    Start:
      DO
        IF buttons = %1111_1111 THEN 'all buttons when not pressed should = 1111_1111
          LED = IsOff
        ELSE
          LED = IsOn
        ENDIF
        PAUSE 500
      LOOP
    END
     
    


    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
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]

    Post Edited (Bean) : 6/4/2010 11:12:09 AM GMT
  • $WMc%$WMc% Posts: 1,884
    edited 2010-06-04 17:18
    Thanks Bean

    That worked.

    I would like to send the button states to the PST to help me understand the pin masks.·I have tried this a few times with no success. I think its because I'm passing a BIN# of to valueStr and it will not compile.I looked through the PropBasic PDF docs, but didn't see anything. Any links or ideas here?


    Thanks in advance for any help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there············___$WMc%___···························· BoogerWoods, FL. USA


    You can feel stupid by asking a stupid question or You can be really·stupid by not asking at all.

    Post Edited ($WMc%) : 6/4/2010 5:23:18 PM GMT
Sign In or Register to comment.