Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Inkey OR Ischarwaiting

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
kimmi

Moderator



Joined: 24 Feb 2006
Posts: 1922
Location: Denmark

denmark.gif
PostPosted: Fri Aug 04, 2006 1:20 am    Post subject: Inkey OR Ischarwaiting Reply with quote

Hello all ...

I am working on a serial prog and got some confligts Mega32

I use Config Serialin = Buffered , Size = 254
and it works fine for B = Inkey()
talking to my gsm phone
but i have a terminal on same port (only 1 serial) i M32
it is calld by set portb.0 =1 relay shift off phone from RX/TX and connect terminal to RX/TX
in terminal mode i use Ischarwaiting()
but here my problems start do to Config Serialin = Buffered , Size = 254 I THINK

is ther away to set Config Serialin = Buffered , Size = 254 off while terminal is in use ?
or what can I do ´
in terminal mode i send (1 char) to navigate in to menu then i use INPUT do to sub menu

can i fix this problem ? or do i have to stop using the ( 1 Char send ) in menu ?

Question

_________________
/ Kim
Back to top
View user's profile Visit poster's website MSN Messenger
DToolan

Bascom Member



Joined: 14 Aug 2004
Posts: 1384
Location: Dallas / Fort Worth, Texas (USA)

blank.gif
PostPosted: Fri Aug 04, 2006 2:39 am    Post subject: Reply with quote

Quote:
I use Config Serialin = Buffered , Size = 254

Seems like an awfully large buffer but, OK... as long as it works for you.

Quote:
is there a way to set Config Serialin = Buffered , Size = 254 off while terminal is in use?

Not easily, No

Quote:
in terminal mode i send (1 char) to navigate in to menu then i use INPUT do to sub menu. Can i fix this problem? or do i have to stop using the ( 1 Char send ) in menu?

I don't understand what the problem is? Post some of your (1 char send) menu code to further explain.

I am just guessing..., but are you trying to say that your problem is because the INPUT statement waits for a carriage return and line feed before it will move on to the next line of your code? Or maybe your problem is that the INPUT statement echos characters back at the terminal?
Back to top
View user's profile Yahoo Messenger
kimmi

Moderator



Joined: 24 Feb 2006
Posts: 1922
Location: Denmark

denmark.gif
PostPosted: Fri Aug 04, 2006 11:18 am    Post subject: Reply with quote

hi DToolan ...

my problem is only i dont get terminal send char into case select if cerialin=buffered

here is a snip of code :

Code:
Config Serialin = Buffered , Size = 169

Do
'the main program for phone  ect
'.this is just for this test
If Portb.0 = 1 Then Call Ee_menue
Loop




Sub Setup_ee()
 Cls
 Lcd " Wait setup running"

 Call Ee_menue
 A = 0
 Smsc = ""
 Print

Print "Enter command   0 = exit >  : "
Do


 A = Ischarwaiting()

   If A = 1 Then

Getcr Agr                               'filter out Cr Lf
Clearbuf                                '´(emty buffer  and get string if not emty for gsm )
Waitms 200


Select Case Smsc                        'smsc is serialin from buffer

  Case "?" : Call Ee_menue

  Case "S" : Call Ee_status

  Case "#" : Call Ee_erase

  Case "P" : Call Pass_set

  Case "A" : Call Gsma_set

  Case "1" : Call Gsm_user_set

  Case "2" : Call Gsm_port_out_set

  Case "4" : Call Port_sms_text_set

  Case "3" : Call Gsm_port_in_set

  Case "5" : Call Smstxt_comm

  Case "6" : Call Call_ee

  Case "7" : Call Gps_tcp_setup

  Case "8" : Call Heat_unit_stoker

  Case "9" : Call 112_call

  Case "!" : Call Reset_ee

  Case "0" : Print
              Goto Stuu

  Case Else :
  Print "COMMAND ERROR ! "
  Print : Print "Enter command  > : "
  Print
   Ss = ""
  End Select



Waitms 200
Ss = ""
Print ""

'YOU SEND (@) THEN IT RETURN TO NORMAL EXIT EEPROM UPDATE
End If
'IF
Loop                                    '
Print "END SETUP >"
Print



Waitms 2000
Goto Main_sms_con
                        'SEND TO VB TO SEE IT EXIT OK
                                  '** Return to MAIN Program Loop

 End Sub

Sub Ee_menue
Menuu:
Print
  Print "  FT-SMS 27 Eeprom setup "
  Print " ---------------------------------------------------"
  Print ""
  Print " ? - Help"
  Print " P = Enter Password for SMS access"
  Print " A = Enter gsm Admin number"
  Print " 1 = Enter User 1 - 5 number"
  Print " 2 = Setup output ports"
  Print " 3 = Setup port in aktiv on/off"
  Print " 4 = Enter port text for sms "
  Print " 5 = Test SMS in Emulator "
  Print " 6 = Setup for Calls and SMS "
  Print " 7 = GPS "
  Print " 8 = Stoker"
  Print " 9 = Setup for 112"
  Print " 0 = Set SMS Alert"
  Print " ! = RESET ATMEL "
  Print " # = Erase Eeprom "
  Print " S = See Eeprom setup status"
  Print " 0 = EXIT SETUP"
  Print "-------------------------------------------------------"
  Print
  'Input "Enter command + <Enter> :  " , Ss
End Sub


Sub Getcr(s As String)
 S = ""
Do
 B = Inkey()
 Select Case B
  Case 0
  Case 13
  Case 10 : If S <> "" Then Exit Do
  Case Else
  S = S + Chr(b)
 End Select
Loop Until B = 0
  Smsc = S
 Waitms 50

End Sub


Sub Clearbuf()
Kk = ""

 Waitms 250
 Do
  B = Inkey()

 Kk = Kk + Chr(b)
Loop Until B = 0
Waitms 150
End Sub
 

_________________
/ Kim


Last edited by kimmi on Fri Aug 04, 2006 11:33 am; edited 2 times in total
Back to top
View user's profile Visit poster's website MSN Messenger
kimmi

Moderator



Joined: 24 Feb 2006
Posts: 1922
Location: Denmark

denmark.gif
PostPosted: Fri Aug 04, 2006 11:25 am    Post subject: Reply with quote

Can i solve this problem if i creates software UART’s for terminal use

have never try´d this software UART’s and help for this is small in bascom ther thay use portc in exsample

_________________
/ Kim
Back to top
View user's profile Visit poster's website MSN Messenger
DToolan

Bascom Member



Joined: 14 Aug 2004
Posts: 1384
Location: Dallas / Fort Worth, Texas (USA)

blank.gif
PostPosted: Sat Aug 05, 2006 2:19 pm    Post subject: Reply with quote

kimmi... in your example posting, you left something out that's kind of important or you'll get no terminal send chars...
Code:
Config Serialin = Buffered , Size = 169

Enable Interrupts   '<- buffered serial requires this line

Do
 
'... etc

Loop

If you have that in your real code but left it out of your post, then I'll keep looking.
Back to top
View user's profile Yahoo Messenger
kimmi

Moderator



Joined: 24 Feb 2006
Posts: 1922
Location: Denmark

denmark.gif
PostPosted: Sat Aug 05, 2006 7:43 pm    Post subject: Reply with quote

Hi DToolan ...
tnx ..
Have fix the problem
the do loop in new sms i did not exit thats way it did not work
Embarassed

_________________
/ Kim
Back to top
View user's profile Visit poster's website MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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