View previous topic :: View next topic |
Author |
Message |
rredding
Joined: 25 Mar 2005 Posts: 63 Location: Tacoma WA
|
Posted: Sat Nov 12, 2016 12:14 am Post subject: Using com channel variable in LIB |
|
|
I am using an XMEGA chip with multiple COM ports. After configuring and opening the ports as is normally done, they can be referenced by a variable, such as Buart_Channel within the Basic code.
Example:
Code: |
Config Com3, .....
Open "com3:" for Binary As #3
Dim Buart_Channel As Byte
Buart_channel = 2 'For COM3, for example This is zero based
Print #Buart_channel, "Some text"
|
That works fine. But, if I wish to do something similar within a LIB, is that possible?
This works (fragment)
* STS {_temptx} , R24 '_temptx = &H1F in Basic application
*BASIC: Printbin #3, _temptx 'Send to USART.
Is there a way to use #Buart_channel instead of #3 and make this work somehow? What is the syntax to do so?
(BASCOM-AVR version : 2.0.8.0 , Latest : 2.0.7.8 ) |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Nov 14, 2016 10:20 am Post subject: |
|
|
sure.
*BASIC: Printbin #buart_channel, _temptx 'Send to USART _________________ Mark |
|
Back to top |
|
|
rredding
Joined: 25 Mar 2005 Posts: 63 Location: Tacoma WA
|
Posted: Mon Nov 14, 2016 6:04 pm Post subject: |
|
|
I thought I'd already tried that syntax. Well, second time is the charm. I must have had some other error in effect when I tried it. Now it works well. Thank you. |
|
Back to top |
|
|
rifat499
Joined: 09 Nov 2016 Posts: 1
|
Posted: Tue Nov 15, 2016 4:16 pm Post subject: |
|
|
hello everyone i am new here..so please help me anytime..thank you |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed Nov 16, 2016 9:56 am Post subject: |
|
|
welcome,
nice that you introduce yourself but you should not do that in a random topic. the idea of a topic is that all posts are about the topic, _________________ Mark |
|
Back to top |
|
|
|