PDA

View Full Version : PropBasic ? converting INL and INC to the Prop from earlier BS2 code.



$WMc%
06-01-2010, 11:45 AM
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.

Mike Green
06-01-2010, 11:54 AM
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.

JonnyMac
06-01-2010, 12:24 PM
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%
06-01-2010, 11:17 PM
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.·

JonnyMac
06-01-2010, 11:38 PM
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%
06-02-2010, 03:44 AM
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%
06-04-2010, 11:12 AM
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.

Bean
06-04-2010, 06:05 PM
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. [RUSH - Freewill]

Post Edited (Bean) : 6/4/2010 11:12:09 AM GMT

$WMc%
06-05-2010, 12:18 AM
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