Re: [bascom] BASCOM AVR Passing a string by subroutine


From "trbrenke" <trbrenke@educationexplorations.com>
Date Tue, 12 Aug 2003 20:51:38 -0700

send the address of the string varable instead.
then let your sub read it from that memory location.
 
dim lcd_string as string * 20
 
main
  to_sub = VARPTR( lcd_string )
  call lcd_something(to_sub)
 
 
 
 
                            as word
sub lcd_something(address_string) 
  local loc_string as string
  loc_string = inp(address_string)
  for x = 1 to 18
     loc_string = loc_string + inp(address_string + x)
  next x 
 
 
end sub
 
----- Original Message -----
Sent: Tuesday, August 12, 2003 8:19 PM
Subject: [bascom] BASCOM AVR Passing a string by subroutine

 
Just curious,
 
Has anyone tried to pass a string variable in a "SUB" ?
My subroutine displays a "passed" string on an LCD display. If I keep the string length to 4 characters, it displays fine using the LCD command.
Anything longer is not displayed.
 
Declare Sub will not let me set the string length.
I tried to "dim" the string before I declared the sub with the same results.
 
Any ideas???
 
Steve