Plons
Joined: 24 May 2005 Posts: 435 Location: Hilversum - The Netherlands
|
Posted: Thu Jun 28, 2012 2:28 pm Post subject: <solved> Read string chr(26) : compiler reports an err |
|
|
Hi folks,
I was implementing a Help-file in my program and used <ctrl>Z as End-Of-File-marker. But the Bascom-compiler reports an error: Error : 42 Line : 74 Numeric parameter expected [CHR(26)]
I fixed it by using the string "End of Help-file" as EOF-marker, and testing on that in the While - Wend. That works fine, so I don't have a hot issue.
But I found it peculiar enough to report it here. IMO Chr(26) is very stringy
Cheers
Nard
Code: | 'Demo to show compiler error-message when string-read reads chr(26)
'Bascom 2.0.7.3-001
Const Comm_speed = 19200
'For normal operation: set both to 1
Const Soft_uart_out = 1
Const Soft_uart_in = 1
$regfile = "M328pdef.dat"
$crystal = 20000000
$baud = 19200
$hwstack = 50
$swstack = 40
$framesize = 40
'For terminal on USB connection:
#if Soft_uart_out = 1
'Terminal on USB
Open "comd.4:19200,8,n,1" For Output As # 4 'soft UART for output on PortD.4
#endif
#if Soft_uart_in = 1
'Terminal on USB
Open "comd.7:19200,8,n,1" For Input As # 3 'soft UART for input on PortD.7
#endif
Dim Help_page_line As String * 100 'that should be enough
'Print Help-page to terminal
Restore Help_file 'label
Read Help_page_line
'While Help_page_line <> "End of Help-file" 'keep reading and printing until that string is found
While Help_page_line <> Chr(26)
'<ctrl>Z as End-Of-File-marker would have been nice, but the Bascom-compiler reports an error:
'Error : 42 Line : 74 Numeric parameter expected [CHR(26)] , in File : D:\Voyager\AVR Werkmap\read_string1.bas
Print # 4 , Help_page_line
Read Help_page_line
Wend
Do
loop
$data
Help_file :
Data "Terminate a request or command with a <CR>, no <LF>"
Data ""
Data "ID of MySingleLabSupply is 2; for MyDualLabSupply: ID=1 for left, ID=2 for right side"
Data " -----------------------------------------"
Data "| Requests and Commands for the ISO PSU's |"
Data " -----------------------------------------"
Data "Requests:"
Data "Start with the Id of the ISO PSU, followed by"
Data " V Give the output Voltage in mV (also valid when output is disconnected)"
Data " A Give the output Current in mA"
Data " S Give Status"
Data " O Give Overload status (current)"
Data " (0 = no overload, any higher (max= means overload)"
Data " l (lower case L) Give the set current overLoad value"
Data " (now 0 - 255 in rev 0x, will be 0-6400 in rev1x, in mA, 10mA steps)"
Data " T Give Temperature (highest of heatsinks) in degr Celsius"
Data " m Give currently selected power mode:"
Data " Q Quiet"
Data " M SMPS pre-regulating by MC34063 or LT1074"
Data "Example: 2V<CR> gives you the outputvoltage in mV"
Data ""
Data "Plons, June 2012"
Data ""
Data "End of Help-file"
Data Chr(26) |
_________________ Bascom AVR ver 2.0.8.6
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel"
Last edited by Plons on Thu Jun 28, 2012 5:03 pm; edited 1 time in total |
|