EmbeddedRelated.com
Forums

software uart and ischarwaiting

Started by ktucker8825 November 12, 2003
I wanted to make 2 software uarts and ran into a strange situation.
If I open a port and then close it in one sub routine, open a second
port and close it in another subroutine, the program does not work.
If I open both ports in the same subroutine, use them and then close
both ports the program works.
I can program around this. I just thought it was strange.

Also I wanted to use IsCharWaiting for the software ports. The help
says I can use a channel number but it will not compile. I am using a
registered version of bascom 1.11.7.4

Thanx


From the Bascom AVR Help file for "CLOSE":
Every opened device must be closed using the CLOSE #channel statement. Of course, you must use the same channel number.

The best place for the CLOSE statement is at the end of your program

-Mike

----- Original Message -----
From: ktucker8825
To: avrclub@avrc...
Sent: Wednesday, November 12, 2003 6:05 PM
Subject: [AVR club] software uart and ischarwaiting I wanted to make 2 software uarts and ran into a strange situation.
If I open a port and then close it in one sub routine, open a second
port and close it in another subroutine, the program does not work.
If I open both ports in the same subroutine, use them and then close
both ports the program works.
I can program around this. I just thought it was strange.

Also I wanted to use IsCharWaiting for the software ports. The help
says I can use a channel number but it will not compile. I am using a
registered version of bascom 1.11.7.4

Thanx To unsubscribe from this group, send an email to:
avrclub-unsubscribe@avrc...



I now open the ports at the begining of my program and close them at
the end. In my subroutines I read and write to the ports when I need.
So far it seems to work ok.

Thanx
JoeT

--- In avrclub@avrc..., "Mike Putnam" <circuit@g...> wrote:
> From the Bascom AVR Help file for "CLOSE":
> Every opened device must be closed using the CLOSE #channel
statement. Of course, you must use the same channel number.
>
> The best place for the CLOSE statement is at the end of your program
>
> -Mike
>
> ----- Original Message -----
> From: ktucker8825
> To: avrclub@avrc...
> Sent: Wednesday, November 12, 2003 6:05 PM
> Subject: [AVR club] software uart and ischarwaiting > I wanted to make 2 software uarts and ran into a strange
situation.
> If I open a port and then close it in one sub routine, open a
second
> port and close it in another subroutine, the program does not
work.
> If I open both ports in the same subroutine, use them and then
close
> both ports the program works.
> I can program around this. I just thought it was strange.
>
> Also I wanted to use IsCharWaiting for the software ports. The
help
> says I can use a channel number but it will not compile. I am
using a
> registered version of bascom 1.11.7.4
>
> Thanx > To unsubscribe from this group, send an email to:
> avrclub-unsubscribe@avrc... >
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>