Sign in

username:

password:



Not a member?

Search basicx



Search tips

Subscribe to basicx



basicx by Keywords

Accelerometer | ADC | ADXL | Adxl20 | AVR | BasicStamp | BX-35 | BX28 | BX35 | COM3 | Compiler | Downloader | EEPROM | Electromagnet | GetADC | GP2D1 | GPS | I2C | IDE | Keypad | LCD | LCD+ | MIDI | Motors | Multitasking | Netmedia | Networking | PCB | PID | PlaySound | PWM | Relays | RTC | Servo | ShiftOut | SitePlayer | SPI | Stack | Timer | USB


Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | BasicX | Very newbie question: referencing pins by number?

Discussion forum for the BasicX family of microcontroller chips.

Very newbie question: referencing pins by number? - Bruce Adams - Jan 19 20:59:33 2009

Hi,
I recently pulled out my BX-24 to do a thermostat project. My youngest
son expressed a desire to do an electronics project that would include
programming. He wants to do a prop clock. This involves turning pins
on and off in groups very quickly. I have done next to nothing with
the BX24 to this point, so we're kind of learning together.

My question is: is it possible to refer to a pin by a variable, so
that they can be manipulated in a For/Next loop or similar? The
compiler chokes when I try to do it.

Also, am I going to run into problems with the processor speed? If I
use a 1500 RPM motor, then I only get 20 clock ticks per revolution.
This is too coarse for a propeller clock. Am I missing something about
how fast the BX24 is, or do I need to use a significantly slower
motor? I know this type of project can be done on the BX24, as one of
the user projects touted by NetMedia is a similar concept executed on
the rotors of an RC helicopter.

Thanks,
Bruce
------------------------------------



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )


Re: Very newbie question: referencing pins by number? - rosa...@aol.com - Jan 19 22:28:28 2009


Hi,
Yes, you can assign a variable to a pin. Attached is small program that turn on/off all the pins using a for/loop.

Option Explicit
Public? Sub? Main()
dim out_pin? as byte
start:
for out_pin = 5 to 20
call Putpin(out_pin,bxoutputhigh)
call delay (0.01)
call Putpin(out_pin,bxoutputLow)
next
goto start
End Sub
My advice to you is to read the documentation so you can refresh how the BX24 works.

Regards,
rosarite

-----Original Message-----
From: Bruce Adams
To: b...@yahoogroups.com
Sent: Mon, 19 Jan 2009 7:59 pm
Subject: [BasicX] Very newbie question: referencing pins by number?

Hi,

I recently pulled out my BX-24 to do a thermostat project. My youngest

son expressed a desire to do an electronics project that would include

programming. He wants to do a prop clock. This involves turning pins

on and off in groups very quickly. I have done next to nothing with

the BX24 to this point, so we're kind of learning together.

My question is: is it possible to refer to a pin by a variable, so

that they can be manipulated in a For/Next loop or similar? The

compiler chokes when I try to do it.

Also, am I going to run into problems with the processor speed? If I

use a 1500 RPM motor, then I only get 20 clock ticks per revolution.

This is too coarse for a propeller clock. Am I missing something about

how fast the BX24 is, or do I need to use a significantly slower

motor? I know this type of project can be done on the BX24, as one of

the user projects touted by NetMedia is a similar concept executed on

the rotors of an RC helicopter.

Thanks,

Bruce

[Non-text portions of this message have been removed]
------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Very newbie question: referencing pins by number? - David Sousa Mendes - Jan 20 8:34:33 2009

Rosarite
You forgot to put a call delay in your for-next cycle. It should be like:
for
putpin (out_pin, 1)
delay(1.0)
putpin (out_pin, 0)
delay(1.0)
next

Otherwise it will not stay on a low level

David M.
----- Original Message -----
From: r...@aol.com
To: b...@yahoogroups.com
Sent: Tuesday, January 20, 2009 2:28 AM
Subject: Re: [BasicX] Very newbie question: referencing pins by number?

Hi,
Yes, you can assign a variable to a pin. Attached is small program that turn on/off all the pins using a for/loop.

Option Explicit
Public? Sub? Main()
dim out_pin? as byte
start:
for out_pin = 5 to 20
call Putpin(out_pin,bxoutputhigh)
call delay (0.01)
call Putpin(out_pin,bxoutputLow)
next
goto start
End Sub
My advice to you is to read the documentation so you can refresh how the BX24 works.

Regards,
rosarite

-----Original Message-----
From: Bruce Adams
To: b...@yahoogroups.com
Sent: Mon, 19 Jan 2009 7:59 pm
Subject: [BasicX] Very newbie question: referencing pins by number?

Hi,

I recently pulled out my BX-24 to do a thermostat project. My youngest

son expressed a desire to do an electronics project that would include

programming. He wants to do a prop clock. This involves turning pins

on and off in groups very quickly. I have done next to nothing with

the BX24 to this point, so we're kind of learning together.

My question is: is it possible to refer to a pin by a variable, so

that they can be manipulated in a For/Next loop or similar? The

compiler chokes when I try to do it.

Also, am I going to run into problems with the processor speed? If I

use a 1500 RPM motor, then I only get 20 clock ticks per revolution.

This is too coarse for a propeller clock. Am I missing something about

how fast the BX24 is, or do I need to use a significantly slower

motor? I know this type of project can be done on the BX24, as one of

the user projects touted by NetMedia is a similar concept executed on

the rotors of an RC helicopter.

Thanks,

Bruce

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Very newbie question: referencing pins by number? - rosa...@aol.com - Jan 20 12:37:13 2009


Hi,

I just did that the light turn on and then off. But the most important is that you got the idea how the program works.
Regards,
Rosarite

-----Original Message-----
From: David Sousa Mendes
To: b...@yahoogroups.com
Sent: Tue, 20 Jan 2009 7:34 am
Subject: Re: [BasicX] Very newbie question: referencing pins by number?

Rosarite

You forgot to put a call delay in your for-next cycle. It should be like:

for

putpin (out_pin, 1)

delay(1.0)

putpin (out_pin, 0)

delay(1.0)

next

Otherwise it will not stay on a low level

David M.

----- Original Message -----

From: r...@aol.com

To: b...@yahoogroups.com

Sent: Tuesday, January 20, 2009 2:28 AM

Subject: Re: [BasicX] Very newbie question: referencing pins by number?

Hi,

Yes, you can assign a variable to a pin. Attached is small program that turn on/off all the pins using a for/loop.

Option Explicit

Public? Sub? Main()

dim out_pin? as byte

start:

for out_pin = 5 to 20

call Putpin(out_pin,bxoutputhigh)

call delay (0.01)

call Putpin(out_pin,bxoutputLow)

next

goto start

End Sub

My advice to you is to read the documentation so you can refresh how the BX24 works.

Regards,

rosarite

-----Original Message-----

From: Bruce Adams

To: b...@yahoogroups.com

Sent: Mon, 19 Jan 2009 7:59 pm

Subject: [BasicX] Very newbie question: referencing pins by number?

Hi,

I recently pulled out my BX-24 to do a thermostat project. My youngest

son expressed a desire to do an electronics project that would include

programming. He wants to do a prop clock. This involves turning pins

on and off in groups very quickly. I have done next to nothing with

the BX24 to this point, so we're kind of learning together.

My question is: is it possible to refer to a pin by a variable, so

that they can be manipulated in a For/Next loop or similar? The

compiler chokes when I try to do it.

Also, am I going to run into problems with the processor speed? If I

use a 1500 RPM motor, then I only get 20 clock ticks per revolution.

This is too coarse for a propeller clock. Am I missing something about

how fast the BX24 is, or do I need to use a significantly slower

motor? I know this type of project can be done on the BX24, as one of

the user projects touted by NetMedia is a similar concept executed on

the rotors of an RC helicopter.

Thanks,

Bruce

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]
------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Very newbie question: referencing pins by number? - Bruce Adams - Jan 20 13:43:38 2009

Rosarite,

Thanks for the tip. I was using the wrong data type, integer instead
of byte. Naturally, my son and I have already hard-coded all the pin
numbers. I told him it'll give us an option when it comes to
optimization.

Regarding the question about speed of execution: We'll simply have to
build it and see. I found Richard Friedrich's description of the
helicopter project. His rotors spun at >1400 RPM and his program was
able to display text with fairly closely-spaced "pixels". If our first
attempts are less than successful, I'll ask Mr. Friedrich how he did it.

Thanks!
Bruce
------------------------------------



(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )