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 | Multi Tasking and Serial Communications

Discussion forum for the BasicX family of microcontroller chips.

Multi Tasking and Serial Communications - Philippe DAROUX - Jul 23 22:48:00 2004

I am using a BX-24 in the following configuration:
PC Com Port<--RS485--> RS485/TTL converter <--TTL-->
BX-24 <--TTL---> Equipment to control

I do this to convert a serial protocol to another one
the Equipment understands.

The BX-24 is used to receive serial commands on 2
pins, decode the protocol and convert it, send the
result through 2 other pins.

Up to now, I have been using a do loop and subs to
take care of everything. Unfortunately, this does not
allow me to keep the 2 Com queues open at the same
time and I sometimes lose some input commands.

I would like to use the multitasking advantage of
BX-24 and run one task to buffer the serial input from
PC, one task to decode and convert the inputs, one
task to send the commands.

The big hurdle I am facing is to keep the two coms
open at the same time on the BX-24. Anybody has
experience doing it ? A general example would be
appreciated.

Thank you.

Philippe
Vous manquez d’espace pour stocker vos mails ?
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com






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


Re: Multi Tasking and Serial Communications - Thad Larson - Jul 24 13:03:00 2004

The BasicX is able to have both Coms open and
available.

Note that Com3 is a software com port. It works as
long as Timer1 isn't used by another function. The
conflicts are detailed in the Operating System PDF.

Often, queue size and com setup seem to be my biggest
bugaboos. Some sample code of serial communication is
available with the download. I refer to that when I
have communication troubles.

Hope that helps,
Thad

--- Philippe DAROUX <> wrote:
> I am using a BX-24 in the following configuration:
> PC Com Port<--RS485--> RS485/TTL converter <--TTL-->
> BX-24 <--TTL---> Equipment to control
>
> I do this to convert a serial protocol to another
> one
> the Equipment understands.
>
> The BX-24 is used to receive serial commands on 2
> pins, decode the protocol and convert it, send the
> result through 2 other pins.
>
> Up to now, I have been using a do loop and subs to
> take care of everything. Unfortunately, this does
> not
> allow me to keep the 2 Com queues open at the same
> time and I sometimes lose some input commands.
>
> I would like to use the multitasking advantage of
> BX-24 and run one task to buffer the serial input
> from
> PC, one task to decode and convert the inputs, one
> task to send the commands.
>
> The big hurdle I am facing is to keep the two coms
> open at the same time on the BX-24. Anybody has
> experience doing it ? A general example would be
> appreciated.
>
> Thank you.
>
> Philippe >
> Vous manquez d’espace pour stocker vos mails ?
> Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
> Créez votre Yahoo! Mail sur
> http://fr.benefits.yahoo.com/
>
> Le nouveau Yahoo! Messenger est arrivé ! Découvrez
> toutes les nouveautés pour dialoguer instantanément
> avec vos amis. A télécharger gratuitement sur
> http://fr.messenger.yahoo.com
__________________________________________________
">http://mail.yahoo.com






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

Re: Multi Tasking and Serial Communications - Philippe DAROUX - Jul 24 23:15:00 2004

Thad,

apparently, I managed to open 2 com ports at the same
time. Thank you.

However, for multitasking, I tried the following
simple program:

Option Explicit

' ======= Module Variables Definition
======================================
Dim StackSerialInput(1 to 48) as Byte ' Stack for
Serial Input Task
Dim StackTTLOutput(1 to 48) as Byte ' Stack for TTL
Output Task ' ======= Main Program
===================================================== Public Sub Main() callTask "SerialInputTask", StackSerialInput
callTask "TTLOutputTask", StackTTLOutput

Do
debug.print "1"
Call sleep(120.0)
Loop

End Sub

Public Sub SerialInputTask()

do
debug.print "2"
call sleep(0.0)
loop

End Sub Public Sub TTLOutputTask()

do
debug.print "3"
call sleep(0.0)
loop

End Sub

and all it gives me back in the monitor windows are
some 2s.
3 appears the first time and 1 never appears.

Am I doing something wrong ?

Thank you.

Philippe

--- Thad Larson <> a écrit :
> The BasicX is able to have both Coms open and
> available.
>
> Note that Com3 is a software com port. It works as
> long as Timer1 isn't used by another function. The
> conflicts are detailed in the Operating System PDF.
>
> Often, queue size and com setup seem to be my
> biggest
> bugaboos. Some sample code of serial communication
> is
> available with the download. I refer to that when I
> have communication troubles.
>
> Hope that helps,
> Thad
>
> --- Philippe DAROUX <> wrote:
> > I am using a BX-24 in the following configuration:
> > PC Com Port<--RS485--> RS485/TTL converter
> <--TTL-->
> > BX-24 <--TTL---> Equipment to control
> >
> > I do this to convert a serial protocol to another
> > one
> > the Equipment understands.
> >
> > The BX-24 is used to receive serial commands on 2
> > pins, decode the protocol and convert it, send the
> > result through 2 other pins.
> >
> > Up to now, I have been using a do loop and subs to
> > take care of everything. Unfortunately, this does
> > not
> > allow me to keep the 2 Com queues open at the same
> > time and I sometimes lose some input commands.
> >
> > I would like to use the multitasking advantage of
> > BX-24 and run one task to buffer the serial input
> > from
> > PC, one task to decode and convert the inputs, one
> > task to send the commands.
> >
> > The big hurdle I am facing is to keep the two coms
> > open at the same time on the BX-24. Anybody has
> > experience doing it ? A general example would be
> > appreciated.
> >
> > Thank you.
> >
> > Philippe
> >
> >
> >
> >
> >
> >
> > Vous manquez d’espace pour stocker vos mails ?
> > Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
> > Créez votre Yahoo! Mail sur
> > http://fr.benefits.yahoo.com/
> >
> > Le nouveau Yahoo! Messenger est arrivé ! Découvrez
> > toutes les nouveautés pour dialoguer
> instantanément
> > avec vos amis. A télécharger gratuitement sur
> > http://fr.messenger.yahoo.com
> > __________________________________________________
> ">http://mail.yahoo.com > ------------------------ Yahoo! Groups Sponsor
> --------------------~-->
> Make a clean sweep of pop-up ads. Yahoo! Companion
> Toolbar.
> Now with Pop-Up Blocker. Get it for free!
>
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/dN_tlB/TM
>
--------------------------------------------------------------------~- >
> Yahoo! Groups Links

Vous manquez d’espace pour stocker vos mails ?
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com






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

Re: Multi Tasking and Serial Communications - Thad Larson - Jul 25 0:00:00 2004

I would try changing your "call sleep(0.0)" to
something longer. It looks like you might be flooding
your serial port with "2" & "3" faster than you can
send it out.

Checkout the following for a great multitasking
example:
http://www.robologic.co.uk/tutprogadvmul.htm
Actually, it looks similar to your current program.

Hope that helps,
Thad

__________________________________






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

Re: Multi Tasking and Serial Communications - Philippe DAROUX - Jul 26 21:17:00 2004

Well I would tend to agree if I was doing anything
with the serial ports.

However, the code I gave is just a test of
multitasking displaying 2 if serial task is active and
3 if TTL task is active. Nothing more, nothing less.
No serial port is open, no queue created.

What I see from there is just 2s. So, if I understand
well, it keeps on activating serial task but not TTL
task.

Why ?

Anybody has a clue ?

Thanks for your help.

Philippe --- Thad Larson <> a écrit :

---------------------------------
I would try changing your "call sleep(0.0)" to
something longer. It looks like you might be flooding
your serial port with "2" & "3" faster than you can
send it out.

Checkout the following for a great multitasking
example:
http://www.robologic.co.uk/tutprogadvmul.htm
Actually, it looks similar to your current program.

Hope that helps,
Thad

__________________________________ Yahoo! Groups Sponsor ADVERTISEMENT ---------------------------------
Yahoo! Groups Links

To

Vous manquez d’espace pour stocker vos mails ?
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com





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

Re: Multi Tasking and Serial Communications - Philippe DAROUX - Jul 26 21:43:00 2004

Thanks to the link you gave, I discovered the
processor does not like too much to see a
"debug.print" command in a task. Or maybe it needs a
longer sleep to be able to process it ??
Howvere I modified it and got the 2 tasks to run at
the same speed and display the result in the main
subroutine.

Thank you for your help.

Philippe

--- Thad Larson <> a écrit :

---------------------------------
I would try changing your "call sleep(0.0)" to
something longer. It looks like you might be flooding
your serial port with "2" & "3" faster than you can
send it out.

Checkout the following for a great multitasking
example:
http://www.robologic.co.uk/tutprogadvmul.htm
Actually, it looks similar to your current program.

Hope that helps,
Thad

__________________________________ Yahoo! Groups Sponsor ADVERTISEMENT ---------------------------------
Yahoo! Groups Links

To

Vous manquez d’espace pour stocker vos mails ?
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com




______________________________
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 )

Com 3 port issues - Philippe DAROUX - Jul 27 9:17:00 2004

Anybody ever managed to open two Com3 ports on a BX-24
?

When I program it, it compiles and everything but the
program seems to lock as soon as I open the second
Com3 port if I do not close the first one first.

Can the chip handle two Com3 ports at the same time ?

Philippe
Vous manquez d’espace pour stocker vos mails ?
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com






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

Re: Com 3 port issues - Don Kinzer - Jul 27 9:52:00 2004

--- In , Philippe DAROUX <pdaroux@y...> wrote:
> Anybody ever managed to open two Com3 ports on a BX-24?

Com3 is a software UART (as opposed Com1 which is a hardware UART)
and the BX-24 is only capable of supporting one such channel. The
compiler doesn't know anything about this limitation and therefore
doesn't warn you that it won't work to open two at once. (Similarly,
it doesn't warn you when your code uses the same variable for two
different purposes.)

There are some messages in the archives about people using multiple
Com3 ports by opening one, using it, closing it and then opening
another, etc.

Another option is to add an external hardware UART. The MAX3110E is
a dual SPI UART which some have used. There are some articles here
and there describing how to use it with the BasicStamp. Using it
with the BX-24 would be similar or you might be able to use the BX-
24's SPI interface to connect it.

Here is a link to a Stamp article by Al Williams:
http://www.wd5gnr.com/suart.htm





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

Re: Re: Com 3 port issues - Philippe DAROUX - Jul 27 10:28:00 2004

Don,

thank you for your answer.

Philippe

--- Don Kinzer <> a écrit :
---------------------------------
--- In , Philippe DAROUX
<pdaroux@y...> wrote:
> Anybody ever managed to open two Com3 ports on a
BX-24?

Com3 is a software UART (as opposed Com1 which is a
hardware UART)
and the BX-24 is only capable of supporting one such
channel. The
compiler doesn't know anything about this limitation
and therefore
doesn't warn you that it won't work to open two at
once. (Similarly,
it doesn't warn you when your code uses the same
variable for two
different purposes.)

There are some messages in the archives about people
using multiple
Com3 ports by opening one, using it, closing it and
then opening
another, etc.

Another option is to add an external hardware UART.
The MAX3110E is
a dual SPI UART which some have used. There are some
articles here
and there describing how to use it with the
BasicStamp. Using it
with the BX-24 would be similar or you might be able
to use the BX-
24's SPI interface to connect it.

Here is a link to a Stamp article by Al Williams:
http://www.wd5gnr.com/suart.htm
Yahoo! Groups Sponsor ADVERTISEMENT ---------------------------------
Yahoo! Groups Links

To

Vous manquez d’espace pour stocker vos mails ?
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com





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

Re: Re: Com 3 port issues - Jim Fouch - Jul 27 10:32:00 2004

I have a project that I use the DEBUG.PRINT command to allow me to use two ser. ports. I use COM1 and COM3 at the same time.

Here is some sample code... Public LCDIN(1 to 2) As Byte
Public LCDOUT(1 to 29) As Byte

Public Com1In(1 to 2) as Byte
Public Com1Out(1 to 29) as Byte

In my Sub Main ... 'Setup Com 3 for LCD @ 9600 Baud
OpenQueue LCDIN, 1
OpenQueue LCDOUT, 29
DefineCom3 0, LCDPIN, bx1000_1000
OpenCom 3, 9600, LCDIN, LCDOUT

'Setup Com 1 for BOB-3 @ 153600 Baud
OpenQueue Com1In, 1
OpenQueue Com1Out, 29
OpenCom 1, 153600, Com1In, Com1OUT
>
> From: "Don Kinzer" <>
> Date: 2004/07/27 Tue AM 10:52:34 EDT
> To:
> Subject: [BasicX] Re: Com 3 port issues
>
> --- In , Philippe DAROUX <pdaroux@y...> wrote:
> > Anybody ever managed to open two Com3 ports on a BX-24?
>
> Com3 is a software UART (as opposed Com1 which is a hardware UART)
> and the BX-24 is only capable of supporting one such channel. The
> compiler doesn't know anything about this limitation and therefore
> doesn't warn you that it won't work to open two at once. (Similarly,
> it doesn't warn you when your code uses the same variable for two
> different purposes.)
>
> There are some messages in the archives about people using multiple
> Com3 ports by opening one, using it, closing it and then opening
> another, etc.
>
> Another option is to add an external hardware UART. The MAX3110E is
> a dual SPI UART which some have used. There are some articles here
> and there describing how to use it with the BasicStamp. Using it
> with the BX-24 would be similar or you might be able to use the BX-
> 24's SPI interface to connect it.
>
> Here is a link to a Stamp article by Al Williams:
> http://www.wd5gnr.com/suart.htm >
> Yahoo! Groups Links


______________________________
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 )