View previous topic :: View next topic |
Author |
Message |
mmarlette
Joined: 30 Nov 2007 Posts: 311 Location: Delano, MN
|
Posted: Mon Oct 12, 2015 10:29 pm Post subject: Input # errors |
|
|
I have a small app that has a response coming from a serial terminal based upon a simple menu.
I use constants to define which serial port I am using on the target AVR.
Below is a simplified code example of the issue. When using a CONST reference on the INPUT the error is produced.
If using a hardcode numeric, it is fine. Maybe it thinks it is an AVR-DOS file handle ??
Maybe I am asking it to do something I should not.
Thoughts?
Code: |
$regfile = "m128def.dat" ' STK 500 / 501 board
Config SubMode = new
$crystal = 14745600 ' External Xtal, full swing mode
$baud = 115200 ' use baud rate
$hwstack = 200
$swstack = 250
$framesize = 1000
$programmer=7 ' Define programmer as stk500 extended
'
Const debugchannel = 1 ' serial port to display information on
Dim strTemp as string * 6
'-----[Serial Port(s)]--------------------------------------------------------
Config Com1 = 115200, Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
Open "com1:" For Binary As #debugchannel
print #debugchannel,
input #1, "Ready for model selection : ",strtemp ' no error
input #debugchannel, "Ready for model selection : ",strtemp ' errors see comments below
' above line will produce
'Error : 211 Line : 30 External routine not found [_GETFILEHANDLE] , in File : ......
'Error : 211 Line : 30 External routine not found [_FILEREADSTRING] , in File : .....
'Error : 61 Line : 23 Label not found [_GETFILEHANDLE] , in File : .......
'Error : 61 Line : 23 Label not found [_FILEREADSTRING] , in File : ......
end
|
TIA,
Mark
(BASCOM-AVR version : 2.0.7.8 ) |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Tue Oct 13, 2015 6:45 am Post subject: |
|
|
Earlier versions of Bascom used to handle things like that. I too have done similar things. But I never tried it on current versions of Bascom since about 1.11 or so.
An obvious work-around if indeed you cant get it to work is to use a constant as a conditional compile switch: Code: |
Const debugchannel = 1 'set to 2 for the other channel
#if debugchannel = 1
print #1,....
#endif
#if debugchannel = 2
print #2,....
#endif
etc
|
I find using the conditional compile is actually better, because you can just delete the entire debug blocks by appropriately setting the constant.
You can also switch various different sorts of input and output on and off depending on where you are in the debug cycle. _________________ Adrian Jansen
Computer language is a framework for creativity |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Oct 13, 2015 10:04 pm Post subject: |
|
|
yes it assumes an avr-dos file handle. but i changed it so it will work with an alias/const as well. _________________ Mark |
|
Back to top |
|
|
mmarlette
Joined: 30 Nov 2007 Posts: 311 Location: Delano, MN
|
Posted: Tue Oct 13, 2015 10:40 pm Post subject: |
|
|
AdrianJ,
Thanks for the work around. This one had many of those.
Mark,
Thank you for the enhancement!
Regards,
Mark |
|
Back to top |
|
|
mmarlette
Joined: 30 Nov 2007 Posts: 311 Location: Delano, MN
|
Posted: Sun Mar 20, 2016 7:40 pm Post subject: |
|
|
albertsm wrote: | yes it assumes an avr-dos file handle. but i changed it so it will work with an alias/const as well. |
MarkA,
Has this enhancement been released in v2.0.7.9?
I looked at the history and it didn't appear to be and then the action tracks, as it is still not working with a const and input from a serial terminal.
If it has then I will upload my test code for review.
Please advise.
Thanks! |
|
Back to top |
|
|
|
|
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
|
|