Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Two different $timeout values for COM1 and COM2 in ATMEGA128

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
Pzx

Bascom Member



Joined: 05 May 2015
Posts: 39

poland.gif
PostPosted: Tue May 05, 2015 9:49 pm    Post subject: Two different $timeout values for COM1 and COM2 in ATMEGA128 Reply with quote

Hello,

I would like to have two different $timeout values for hardware COM1 and COM2 in Atmega 128.
Is it somehow possible?
I use BASCOM AVR 2.0.7.8

Thanks in advance for your help Smile

(BASCOM-AVR version : 2.0.7.8 )
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5915
Location: Holland

blank.gif
PostPosted: Wed May 06, 2015 7:58 pm    Post subject: Reply with quote

the way to do it :

$timeout=100000
input #1,S 'get some string data from COM1

'before using it on COM2 , just change the timeout
$timeout=400000
input #2,s 'longer timeout on COM2

so basically, you need to define the timeout before using the UART.

_________________
Mark
Back to top
View user's profile Visit poster's website
Pzx

Bascom Member



Joined: 05 May 2015
Posts: 39

poland.gif
PostPosted: Fri May 08, 2015 10:17 pm    Post subject: Reply with quote

Thanks Mark for your prompt answer.

Maybe I was not very clear in my previous post, so let me explain the issue a little bit longer.
I am using two different interrupts for reciving data from COM1 and COM2.
COM1 is configuered for 1200 Bauds (radio remote control) and COM2 for 115200 Bauds (bluetooth)
In both cases the data lengh can varry, so I use $timeout to quickly return from the interrupt and I would like to return really fast.
I dont know whitch COM will receve data, so I am not able to preconfigure $timeout in advance in the way You explained.

Can I have dedicated $timeoutCOM1 and $timeoutCOM2 regardless the expexted recived data order?
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5915
Location: Holland

blank.gif
PostPosted: Sat May 09, 2015 1:45 pm    Post subject: Reply with quote

I still do not get it.
you best post a small sample that demonstrate what you do, and how you want it.
The ISR is from the built in buffered serial or your own ring buffer?
And with input you mean you use INPUT statement, right?
My previous explanation would still be valid : specify $timeout before the INPUT statement.

_________________
Mark
Back to top
View user's profile Visit poster's website
Pzx

Bascom Member



Joined: 05 May 2015
Posts: 39

poland.gif
PostPosted: Sat May 09, 2015 11:07 pm    Post subject: Reply with quote

Thanks Mark, the issue is solved Smile
After some tests I finally got the point. Sometimes you need to repeat it twice Wink
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum