Re: [bascom] Sequence of CR LF using "Input " ?


From "ian dobson" <i.dobson@planet-ian.com>
Date Wed, 20 Jul 2005 20:44:43 +0200

No Problems, glad to be of service :)

Regards
Ian Dobson

Home of the Atmel based UDP mobile web cam http://www.planet-ian.com
All mails scanned with av-filter.pl (F-Prot / perl)

----- Original Message ----- From: "Huze@work" <hduff@cogeco.ca>
To: <bascom@grote.net>
Sent: Wednesday, July 20, 2005 8:06 PM
Subject: Re: [bascom] Sequence of CR LF using "Input " ?


Working like a charm Ian !
I cut and pasted it into my pgm and now it responds
to the CRLF as it should.
Many thanks !!!

Hugh


ian dobson wrote:

Hi,

I suffered the same problem, and ended up writing my own input routine. And here it is:-

$regfile = "m8def.dat"
$crystal = 8000000
$baud = 1200
Dim Msg As String * 20
Declare Function Myinput() As String

Do
  Msg = Myinput()
  Print Msg
Loop
End

Function Myinput() As String
Local Serialchar As Byte
Myinput = ""
Do
 If Ischarwaiting() <> 0 Then               'if yes
    Serialchar = Inkey()                          'get it
    If Serialchar > &H0D Then               'if it's not CR
      Myinput = Myinput + Chr(serialchar)   'add char to string
    End If
 End If
Loop Until Serialchar = &H0D
Serialchar = 0                                  'clear for next call
End Function

Note the call to MyInput(), that's all it is.

Regards
Ian Dobson

Home of the Atmel based UDP mobile web cam http://www.planet-ian.com
All mails scanned with av-filter.pl (F-Prot / perl)

----- Original Message ----- From: "Dennis Hambleton" <dennis.hambleton@bigpond.com>
To: <bascom@grote.net>
Sent: Wednesday, July 20, 2005 4:22 AM
Subject: RE: [bascom] Sequence of CR LF using "Input " ?


You could try this although I am guessing a bit and I am not sure what
effects it may have on other functions.

locate the file 'mcs.lib' - it is probably in a \bascom\lib directory.
make a copy of it and rename the copy so it is not lost and can be restored
Open mcs.lib with Notepad.
Search for 'cpi r24,13 ;
return ?'
this is the second occurrence of 'cpi r24,13' and it searches for a CR as
the end of input string (dec 13 = H0D)
Change to 'cpi r24,10' so it searches for LF as end of string (dec 10 = H0A)
Save mcs.lib
Recompile and try.

In the standard case the input sequence terminates when it gets the CR which leaves a LF hanging around to be the first char in the next data sequence.
That may be confusing your bascom program.  Changing the terminating
sequence to LF will absorb the CR to be the last character of your input
data which appears to cause no problems in your bascom program. Another way to fix your problem may to be leave mcs.lib as it is (preferred, I think)
and if possible to change your bascom program to handle/absorb the LF.

Regards,

Dennis


On 20/07/05, Huze@work <hduff@cogeco.ca> wrote:

Does anyone know if there is a way to change the sequence of line
termination that the Bascom serial receive instruction  "Input"
(i.e. Input , variable)  want to see ?
I am having trouble getting my board running a Basom program to
recognize the datastring being continuously sent from a commercial
software package that I am using.  It sends  data<CR><LF> but my
Bascom program is not responding.  I wrote a simple diagnostic program
in VB and it appears that it will work properly
when I send  data<LF>CR>  but not   data<CR><LF>.

Obviously I cannot change the output of the commercial software package.
Is there a way to change this in Bascom ?

Thanks, Hugh
A.R.S.  VA3TO