Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

serial <-> PC

 
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-8051 Archive
View previous topic :: View next topic  
Author Message
achzoll

Bascom Member



Joined: 18 Jun 2006
Posts: 1

germany.gif
PostPosted: Wed Jun 21, 2006 8:32 pm    Post subject: serial <-> PC Reply with quote

hallo zusammen

bin neu und denke darüber wurde schon geschrieben, aber ich brauche eine verbindung zum PC. mit print sende ich einen string aber mit input bleibt der mc stehen daher habe ich inkey benutz aber damit kann ich nur ein byte empfangen. ich würde gerne RI abfragen ob eine neue nachricht angekommen ist und dann diese lesen.
danke im vorraus

my problem is the serial port to the pc. i send a string with print but with input stand the mc. with inkey i can get one string but i want to get about RI the informatio for a new string from pc and then i want to read this string.
thanks for help


Achim
Back to top
View user's profile
Vilko

Bascom Member



Joined: 25 May 2004
Posts: 190
Location: Ljubljana, Slovenia

slovenia.gif
PostPosted: Tue Sep 19, 2006 9:09 am    Post subject: I use Serial Interrupt Reply with quote

I use serial interrupt routine to accept info from Serial.
The serial interrupt routine gets control for each byte if info and puts into RAM, it might detect Newline charater and set a bit, when transmition is over, main program tests the bit and if set evaluate received information.

I am not very good at bascom, it might be a competent bascom statement to do the work instead.
Back to top
View user's profile
Funci

Bascom Member



Joined: 03 Aug 2005
Posts: 58
Location: CRO

croatia.gif
PostPosted: Tue Sep 19, 2006 4:35 pm    Post subject: Reply with quote

Hi achzoll,

I am thinking that you don't have problems, because commands that you were used working just like you said.
So, if you want to use Inkey statement you must write routine that will wait for strings that are comming and analyse them.
Back to top
View user's profile Visit poster's website
Vilko

Bascom Member



Joined: 25 May 2004
Posts: 190
Location: Ljubljana, Slovenia

slovenia.gif
PostPosted: Tue Sep 19, 2006 4:54 pm    Post subject: bascom help says Reply with quote

Bascom help says about Inkey:

Quote:
Action
Returns the ASCII value of the first character in the serial input buffer.

Syntax
var = INKEY()
var = INKEY(#channel)


Remarks

Var Byte, Integer, Word, Long or String variable.
Channel The channel number of device
If there is no character waiting, a zero will be returned.


So, it says about character, not string. You must intercept each byte of a string separately.

(I my be wrong.)
Back to top
View user's profile
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-8051 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